-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrules.yaml
117 lines (117 loc) · 3.38 KB
/
rules.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
functions:
[
folderDescription,
request2XXor3XXResponse,
deleteResponse200or204,
pathVariablesRequire404Response,
requestNameShouldNotEndInCopy,
patchRequestShouldHaveBody,
requestWithAuthRequire401Response,
]
rules:
collection-description-is-mandatory:
description: Collection must have a description.
given: $.collection.info
severity: error
then:
field: description
function: truthy
request-description-is-mandatory:
description: All requests must have a description.
given: $..request
severity: error
then:
field: description
function: truthy
folder-description-is-mandatory:
description: All folders should have a description.
message: "{{error}}"
given: $
severity: warn
then:
function: "folderDescription"
request-url-is-mandatory:
description: Requests must have a URL.
given: $..request
severity: error
then:
field: url
function: truthy
request-have-response-2XX-or-3XX:
description: All requests have at least a 2XX or 3XX example.
given: $..item[*]
severity: error
then:
function: request2XXor3XXResponse
all-responses-have-status-code:
description: All responses must have a status code.
given: $..response[*]
severity: error
then:
field: code
function: truthy
http-should-not-be-used:
description: HTTP should not be used.
message: "HTTP should not be used: {{value}}"
given: $..url.raw
severity: warn
then:
function: pattern
functionOptions:
notMatch: "/^http:/i"
delete-responses-should-have-200-or-204-code:
description: DELETE responses must have a 200 or 204 status code.
given: $..response[*]
severity: error
then:
function: deleteResponse200or204
path-variables-require-404-response:
description: Requests with path variables require a 404 response.
given: $..item[*]
severity: error
then:
function: pathVariablesRequire404Response
examples-should-be-json-format:
description: Response bodies should be in JSON.
message: "JSON should be used in examples: {{value}}"
given: $..response[*]._postman_previewlanguage
severity: warn
then:
function: pattern
functionOptions:
match: "/^json/i"
request-name-should-not-end-in-Copy:
description: Request names should not end in "Copy".
message: "{{error}}"
given: $..item[*]
severity: warn
then:
function: requestNameShouldNotEndInCopy
query-parameters-require-description:
description: All request query parameters must have a description.
given: $..request.url.query[*]
severity: error
then:
field: description
function: truthy
path-parameters-require-description:
description: All request path parameters must have a description.
given: $..request.url.variable[*]
severity: error
then:
field: description
function: truthy
patch-requests-require-body:
description: All PATCH requests require a request body.
message: "{{error}}"
given: $..request
severity: error
then:
function: patchRequestShouldHaveBody
authenticated-requests-require-401-response:
description: All authenticated requests require a 401 response.
message: "{{error}}"
given: $..item[*]
severity: error
then:
function: requestWithAuthRequire401Response