-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmicrocks-rules.yaml
180 lines (166 loc) · 4.59 KB
/
microcks-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
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
functions:
- oas-verify-mocks
- aas-verify-mocks
extends: [[spectral:oas, off], [spectral:asyncapi, off]]
rules:
microcks-info-extension-valid:
description: x-microcks extension must be valid
message: "x-microcks extension must be valid"
formats:
- oas3
- aas2
- aas3
severity: warn
given: "$.info.x-microcks"
then:
function: schema
functionOptions:
schema:
type: object
properties:
labels:
type: object
additionalProperties:
type: string
required:
- labels
additionalProperties: false
microcks-operation-extension-valid:
description: x-microcks-operation extension must be valid
message: "x-microcks-operation extension must be valid"
formats:
- oas3
- aas2
- aas3
severity: warn
given:
- "$.paths.*.*.x-microcks-operation"
- "$.channels.*.[publish,subscribe].x-microcks-operation"
- "$.operations.*.x-microcks-operation"
then:
function: schema
functionOptions:
schema:
type: object
properties:
delay:
type: number
format: int32
frequency:
type: number
format: int32
dispatcher:
type: string
dispatcherRules:
type: string
parameterConstraints:
type: array
items:
type: object
properties:
name:
type: string
in:
type: string
enum: [path, query, header]
required:
type: boolean
recopy:
type: boolean
mustMatchRegexp:
type: string
required:
- name
- in
additionalProperties: false
oas3-valid-media-example: true
oas3-valid-schema-example: true
microcks-examples-in-required-parameter:
description: Required param must have examples
message: "Required param must have examples"
formats:
- oas3
severity: warn
given: "$..parameters[?(@.required == true)]"
then:
field: examples
function: truthy
microcks-examples-in-optional-parameter:
description: Optional param should have examples
message: "Optional param should have examples"
formats:
- oas3
severity: info
given: "$..parameters[?(@.required != true)]"
then:
field: examples
function: truthy
microcks-examples-in-request-content:
description: Request with content must have examples
message: "Request with content must have examples"
formats:
- oas3
severity: warn
given: "$.paths..requestBody..content.*"
then:
field: examples
function: truthy
microcks-examples-in-response-content:
description: Response with content must have examples
message: "Response with content must have examples"
formats:
- oas3
severity: warn
given: "$.paths..responses..content.*"
then:
field: examples
function: truthy
microcks-examples-fragments-to-complete-mocks:
description: Response example must match required params examples to form full mocks
message: "{{error}}"
formats:
- oas3
severity: warn
given: "$.paths.*.*"
then:
function: oas-verify-mocks
asyncapi-message-examples: true
microcks-aas-examples-in-messages:
description: Message must have examples
message: "Message must have examples"
formats:
- aas2
severity: warn
given: "$.channels.*.[publish,subscribe].message"
then:
field: examples
function: truthy
microcks-aas3-examples-in-messages:
description: Message must have examples
message: "Message must have examples"
formats:
- aas3
severity: warn
given: "$.components.messages.*"
then:
field: examples
function: truthy
microcks-aas-examples-in-parameter:
description: Parameter must have examples
message: "Parameter must have examples"
formats:
- aas2
severity: warn
given: "$.channels.*.parameters.*.schema"
then:
field: examples
function: truthy
microcks-aas-examples-fragments-to-complete-mocks:
description: Message example must match params examples to form full mocks
message: "{{error}}"
formats:
- aas2
severity: warn
given: "$.channels.*"
then:
function: aas-verify-mocks