-
Notifications
You must be signed in to change notification settings - Fork 3
/
path-ruleset.yaml
189 lines (187 loc) · 6.03 KB
/
path-ruleset.yaml
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
functions:
[
parameter-example-check,
parameter-filter-description-check,
parameter-sorter-description-check,
word-count,
deprecation,
path-parameter-integer-number-formats,
response-validator,
path-query-parameter-check,
path-descriptions-check,
path-oauth-scope-check,
path-user-levels-check,
path-operation-check,
ascii,
path-reserved-keywords-check,
summary-check
]
rules:
path-parameters-must-have-description:
description: "Rule 303: Path/Query parameters must have a description: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#303"
given: $.*.parameters.*
severity: error
then:
field: description
function: truthy
path-parameters-must-have-a-lengthy-description:
description: "Rule 303: The description of parameters must be at least 8 characters: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#303"
type: style
given: $.*.parameters.*
severity: error
then:
field: description
function: length
functionOptions:
min: 8
path-filter-parameter-must-follow-format:
message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#324"
given: $.[*].parameters[?(@.in == "query" && @.name == "filters")].description
severity: error
then:
function: parameter-filter-description-check
functionOptions:
rule: 324
path-sorter-parameter-must-follow-format:
message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#325"
given: $.[*].parameters[?(@.in == "query" && @.name == "sorters")].description
severity: error
then:
function: parameter-sorter-description-check
functionOptions:
rule: 325
path-parameters-must-have-example:
message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#304"
given: $.*.parameters.*
severity: error
then:
function: parameter-example-check
functionOptions:
rule: 304
path-parameters-must-have-valid-formats-for-numbers-and-integers:
message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#171"
given: $.*.parameters.*
severity: error
then:
function: path-parameter-integer-number-formats
functionOptions:
rule: 171
path-summary-length:
message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#305"
given: $.*.summary
severity: warn
then:
function: word-count
functionOptions:
maxWordCount: 5
rule: 305
path-description-html-chars:
message: "{{error}}"
given: $.*.description
severity: error
then:
function: path-descriptions-check
functionOptions:
rule: 405
path-must-have-security-defined:
message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#104"
given: $.*
severity: error
then:
function: path-oauth-scope-check
functionOptions:
rule: 104
path-must-have-user-levels-defined:
message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#321"
given: $.*
severity: error
then:
function: path-user-levels-check
functionOptions:
rule: 321
# # path-deprecated-apis-should-have-deprecation-and-sunset-dates:
# # message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#189"
# # given: $[*]
# # severity: warn
# # then:
# # function: deprecation
# # functionOptions:
# # rule: 189
path-must-have-required-key-on-all-parameters:
description: "Rule 317: Operations must have required key on all parameters: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#317"
given: $.*.parameters.*
severity: error
then:
field: required
function: defined
path-must-define-specific-response-codes:
message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#151"
given: $.*.responses
severity: error
then:
function: response-validator
functionOptions:
rule: 151
path-boolean-parameters-must-have-default:
message: "Rule 310: Optional boolean values must have a default https://sailpoint-oss.github.io/sailpoint-api-guidelines/#310"
given: $.*.parameters.[?(@.$ref == null && @.required == false && @.schema.type == 'boolean')].schema
severity: error
then:
field: default
function: defined
path-operation-check:
message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#400"
given: $
severity: error
then:
function: path-operation-check
functionOptions:
rule: 400
ascii-characters:
message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#401"
given: $
severity: error
then:
function: ascii
functionOptions:
rule: 401
path-summary-check:
message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#305"
given: $
severity: error
then:
function: summary-check
functionOptions:
rule: 305
# path-tag-check:
# message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#402"
# given: $
# severity: error
# then:
# function: tag-check
# functionOptions:
# rule: 402
# path-parameters-must-not-use-reserved-keywords:
# message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#504"
# given: $.[*].parameters[?(@.$ref == null)]
# severity: error
# then:
# function: path-reserved-keywords-check
# functionOptions:
# rule: 504
# path-parameters-should-have-query-parameter-fields:
# given: $.[get]
# severity: warn
# then:
# function: path-query-parameter-check
# functionOptions:
# field: fields
# rule: 157
# path-parameters-should-have-query-parameter-embed:
# given: $.[get]
# severity: warn
# then:
# function: path-query-parameter-check
# functionOptions:
# field: embed
# rule: 158