forked from ethereum/builder-specs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.spectral.yml
41 lines (39 loc) · 1.23 KB
/
.spectral.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
extends: [["spectral:oas", "all"]]
formats: ["oas3"]
rules:
operation-singular-tag: off
oas3-parameter-description: off
contact-properties: off
operation-tags: error
openapi-tags-alphabetical: error
operation-tag-defined: error
paths-snake-case:
description: All YAML paths MUST follow snake-case
severity: error
recommended: true
message: "path is not snake-case: {{error}}"
given: $.paths[*]~
then:
function: pattern
functionOptions:
match: "^\/([a-z0-9]+(_[a-z0-9]+)*)?(\/[a-z0-9]+(_[a-z0-9]+)*|\/{.+})*$"
parameters-snake-case-alphanumeric:
description: Path parameters MUST follow snake case
severity: error
recommended: true
message: "{{property}} parameter is not snake case: {{error}}"
given: $..parameters[?(@.in == 'path' || @.in == 'query')].name
then:
function: pattern
functionOptions:
match: "^[a-z][_a-z0-9]+$"
oas3-request-support-json:
description: Every request MUST support `application/json` media type
formats:
- oas3
recommended: true
severity: error
message: "{{description}}: {{error}}"
given: $.paths.[*].requestBody.content[?(@property.indexOf('json') === -1)]^
then:
function: falsy