forked from MikeRalphson/api-specification-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.spectral.yml
45 lines (42 loc) · 1.4 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
41
42
43
44
45
extends: spectral:oas
rules:
example-value-or-externalValue: false
oas3-unused-components-schema: false # needed by inter-file references e.g. Voice API
oas3-valid-content-schema-example: false
oas3-valid-oas-content-example: false
oas3-valid-oas-parameter-example: false
oas3-valid-parameter-schema-example: false
oas3-valid-schema-example: false
openapi-tags: false
operation-description: false
operation-tags: false
# Check field names meet api standards
property-names:
severity: warn
message: "Invalid property name: {{value}} (expected: lowercase with underscores)"
recommended: true
given: "$.paths.*.*.parameters.*.name"
then:
function: pattern
functionOptions:
match: "^[a-z_]+$"
# Check response field names meet api standards
response-property-names:
severity: warn
message: "Invalid response property name: {{property}} (expected: lowercase with underscores)"
recommended: true
given: "$..components.schemas.*.properties[*]~"
then:
function: pattern
functionOptions:
match: "^[a-z_]+$"
# Require 3-part Semantic Versions as the spec versions
semver:
severity: error
recommended: true
message: Specs should follow semantic versioning. {{value}} is not a valid version.
given: $.info.version
then:
function: pattern
functionOptions:
match: "^([0-9]+.[0-9]+.[0-9]+)$"