-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-spectral-rules.yml
More file actions
83 lines (83 loc) · 2.88 KB
/
github-spectral-rules.yml
File metadata and controls
83 lines (83 loc) · 2.88 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
rules:
info-title-required:
severity: error
given: $.info
then: {field: title, function: truthy}
info-title-format:
severity: warn
given: $.info.title
then: {function: pattern, functionOptions: {match: "^GitHub "}}
info-description-required:
severity: error
given: $.info
then: {field: description, function: truthy}
info-version-required:
severity: error
given: $.info
then: {field: version, function: truthy}
servers-defined:
severity: error
given: $
then: {field: servers, function: truthy}
servers-https-only:
severity: error
given: $.servers[*].url
then: {function: pattern, functionOptions: {match: "^https://"}}
paths-no-trailing-slash:
severity: error
given: $.paths
then: {field: "@key", function: pattern, functionOptions: {notMatch: "\\/$"}}
paths-kebab-case:
severity: info
description: Path segments should use kebab-case or snake_case.
given: $.paths
then: {field: "@key", function: pattern, functionOptions: {notMatch: "\\/[a-z]+[A-Z]"}}
operation-description-required:
severity: error
given: $.paths[*][get,post,put,patch,delete]
then: {field: description, function: truthy}
operation-operationid-required:
severity: error
given: $.paths[*][get,post,put,patch,delete]
then: {field: operationId, function: truthy}
operation-operationid-unique:
severity: error
given: $
then: {function: oasOpId}
operation-tags-required:
severity: warn
given: $.paths[*][get,post,put,patch,delete]
then: {field: tags, function: truthy}
tags-title-case:
severity: info
given: $.tags[*].name
then: {function: pattern, functionOptions: {match: "^[A-Z][a-zA-Z0-9]*(\\s[A-Za-z0-9]+)*$"}}
parameter-description-required:
severity: error
given: $.paths[*][get,post,put,patch,delete].parameters[*]
then: {field: description, function: truthy}
parameter-snake-case:
severity: info
description: Parameter names should use snake_case (GitHub convention).
given: $.paths[*][get,post,put,patch,delete].parameters[*]
then: {field: name, function: pattern, functionOptions: {match: "^[a-z][a-z0-9_]*$"}}
response-success-required:
severity: error
given: $.paths[*][get,post,put,patch,delete].responses
then: {function: schema, functionOptions: {schema: {anyOf: [{required: ["200"]}, {required: ["201"]}, {required: ["204"]}]}}}
response-description-required:
severity: error
given: $.paths[*][get,post,put,patch,delete].responses[*]
then: {field: description, function: truthy}
security-schemes-defined:
severity: warn
given: $.components
then: {field: securitySchemes, function: truthy}
get-no-request-body:
severity: error
given: $.paths[*].get
then: {field: requestBody, function: falsy}
no-empty-descriptions:
severity: error
given: "$..description"
then: {function: truthy}