1
1
formats :
2
- - ' oas3'
2
+ - " oas3"
3
3
extends : spectral:oas
4
4
functionsDir : isp-functions
5
5
functions :
@@ -17,15 +17,15 @@ rules:
17
17
# Use JSON as much as possible
18
18
json-responses :
19
19
severity : error
20
- message : ' {{description}}: {{error}}'
20
+ message : " {{description}}: {{error}}"
21
21
given : $..responses.[?(@property == '200' || @ == '201' || @ == '202' || @ == '400' || @ == '401' || @ == '403' || @ == '404' || @ == '422' || @ == '500')].content
22
22
then :
23
23
function : contains
24
24
functionOptions :
25
- match : ' json'
25
+ match : " json"
26
26
patch-request-content-type :
27
27
severity : error
28
- description : ' `PATCH` requests cannot use `application/json`'
28
+ description : " `PATCH` requests cannot use `application/json`"
29
29
given : $.paths.*.[?(@property == 'patch')].requestBody.content[?(@property == 'application/json')]^
30
30
then :
31
31
function : falsy
47
47
then :
48
48
function : pattern
49
49
functionOptions :
50
- match : ' localhost|/v[0-9]+$'
50
+ match : " localhost|/v[0-9]+$"
51
51
# Use ISO 8601 for dates
52
52
iso8601 :
53
53
severity : warn
@@ -132,19 +132,19 @@ rules:
132
132
description : Delete should return an HTTP 204
133
133
given : $.paths.*[?(@property === 'delete')].responses
134
134
then :
135
- field : ' 204'
135
+ field : " 204"
136
136
function : truthy
137
137
# Errors must include a `detail` field
138
138
error-detail :
139
139
severity : error
140
- description : Errors must be JSON and include a "detail" field
140
+ description : Errors must be problem+ JSON and include a "detail" field
141
141
given : $..responses.[?(@property.toString().startsWith("4") || @property.toString() === "500")]
142
142
then :
143
143
- field : content
144
144
function : truthy
145
- - field : content.application/json.schema
145
+ - field : content.application/problem+ json.schema
146
146
function : truthy
147
- - field : content.application/json.schema.properties.detail
147
+ - field : content.application/problem+ json.schema.properties.detail
148
148
function : truthy
149
149
# Header & parameter casing
150
150
headers-hyphenated-pascal-case :
0 commit comments