@unispechq/unispec-schema 0.3.1 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,318 +1,318 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://unispec.dev/schema/unispec-tests.schema.json",
4
- "title": "UniSpec Tests document",
5
- "description": "Executable test cases targeting UniSpec-described services.",
6
- "type": "object",
7
- "required": ["uniSpecTestsVersion", "target", "tests"],
8
- "properties": {
9
- "uniSpecTestsVersion": {
10
- "type": "string",
11
- "description": "UniSpec Tests format version (SemVer)."
12
- },
13
- "target": {
14
- "type": "object",
15
- "description": "Service and environment that this test document targets.",
16
- "required": ["serviceName"],
17
- "properties": {
18
- "serviceName": {
19
- "type": "string",
20
- "description": "Identifier of the service, matching service.name from UniSpec."
21
- },
22
- "serviceVersion": {
23
- "type": "string",
24
- "description": "Optional service contract version, matching service.version when provided."
25
- },
26
- "environment": {
27
- "type": "string",
28
- "description": "Optional environment name, matching service.environments[].name when provided."
29
- }
30
- },
31
- "additionalProperties": false
32
- },
33
- "tests": {
34
- "type": "array",
35
- "description": "List of test cases.",
36
- "items": {
37
- "$ref": "#/$defs/TestCase"
38
- }
39
- },
40
- "extensions": {
41
- "type": "object",
42
- "description": "Custom vendor-specific extensions (x-*) at the document root.",
43
- "additionalProperties": true
44
- }
45
- },
46
- "$defs": {
47
- "TestCase": {
48
- "type": "object",
49
- "required": ["name", "target", "request", "expect"],
50
- "properties": {
51
- "name": {
52
- "type": "string",
53
- "description": "Test identifier, unique within this document."
54
- },
55
- "description": {
56
- "type": "string",
57
- "description": "Human-readable description of the test case."
58
- },
59
- "target": {
60
- "$ref": "#/$defs/TestTarget"
61
- },
62
- "request": {
63
- "$ref": "#/$defs/TestRequest"
64
- },
65
- "expect": {
66
- "$ref": "#/$defs/TestExpect"
67
- },
68
- "tags": {
69
- "type": "array",
70
- "description": "Tags for grouping and filtering tests.",
71
- "items": {
72
- "type": "string"
73
- }
74
- },
75
- "extensions": {
76
- "type": "object",
77
- "description": "Custom vendor-specific extensions (x-*) for this test.",
78
- "additionalProperties": true
79
- }
80
- },
81
- "additionalProperties": false
82
- },
83
- "TestTarget": {
84
- "type": "object",
85
- "required": ["protocol", "operationId"],
86
- "properties": {
87
- "protocol": {
88
- "type": "string",
89
- "description": "Protocol of the operation under test.",
90
- "enum": ["rest", "graphql", "websocket"]
91
- },
92
- "operationId": {
93
- "type": "string",
94
- "description": "Operation identifier within the service (for example, REST route name)."
95
- },
96
- "environment": {
97
- "type": "string",
98
- "description": "Optional environment name overriding the document-level target.environment."
99
- }
100
- },
101
- "additionalProperties": false
102
- },
103
- "TestRequest": {
104
- "type": "object",
105
- "description": "Protocol-specific request definition.",
106
- "properties": {
107
- "rest": {
108
- "$ref": "#/$defs/RestRequest"
109
- },
110
- "graphql": {
111
- "$ref": "#/$defs/GraphQLRequest"
112
- },
113
- "websocket": {
114
- "$ref": "#/$defs/WebSocketRequest"
115
- }
116
- },
117
- "additionalProperties": false
118
- },
119
- "TestExpect": {
120
- "type": "object",
121
- "description": "Protocol-specific expectations.",
122
- "properties": {
123
- "rest": {
124
- "$ref": "#/$defs/RestExpect"
125
- },
126
- "graphql": {
127
- "$ref": "#/$defs/GraphQLExpect"
128
- },
129
- "websocket": {
130
- "$ref": "#/$defs/WebSocketExpect"
131
- }
132
- },
133
- "additionalProperties": false
134
- },
135
- "RestRequest": {
136
- "type": "object",
137
- "properties": {
138
- "params": {
139
- "type": "object",
140
- "properties": {
141
- "path": {
142
- "type": "object",
143
- "additionalProperties": true
144
- },
145
- "query": {
146
- "type": "object",
147
- "additionalProperties": true
148
- }
149
- },
150
- "additionalProperties": false
151
- },
152
- "headers": {
153
- "type": "object",
154
- "additionalProperties": true
155
- },
156
- "body": {
157
- "description": "Request body (arbitrary JSON value)."
158
- },
159
- "authProfile": {
160
- "type": "string",
161
- "description": "Identifier of an authentication profile configured in tooling."
162
- }
163
- },
164
- "additionalProperties": false
165
- },
166
- "RestExpect": {
167
- "type": "object",
168
- "required": ["status"],
169
- "properties": {
170
- "status": {
171
- "description": "Expected HTTP status code or list of acceptable codes.",
172
- "oneOf": [
173
- {
174
- "type": "integer"
175
- },
176
- {
177
- "type": "array",
178
- "items": {
179
- "type": "integer"
180
- }
181
- }
182
- ]
183
- },
184
- "headers": {
185
- "type": "object",
186
- "description": "Expected headers (usually partial match).",
187
- "additionalProperties": true
188
- },
189
- "body": {
190
- "$ref": "#/$defs/BodyExpectation"
191
- }
192
- },
193
- "additionalProperties": false
194
- },
195
- "BodyExpectation": {
196
- "type": "object",
197
- "properties": {
198
- "mode": {
199
- "type": "string",
200
- "enum": ["exact", "contains", "schemaOnly", "snapshot"],
201
- "description": "Assertion mode for the response body."
202
- },
203
- "json": {
204
- "description": "JSON value used for exact or contains mode."
205
- },
206
- "schemaRef": {
207
- "type": "string",
208
- "description": "Reference to a schema from service.schemas for schemaOnly mode."
209
- }
210
- },
211
- "additionalProperties": false
212
- },
213
- "GraphQLRequest": {
214
- "type": "object",
215
- "properties": {
216
- "operationName": {
217
- "type": "string"
218
- },
219
- "query": {
220
- "type": "string"
221
- },
222
- "variables": {
223
- "type": "object",
224
- "additionalProperties": true
225
- },
226
- "headers": {
227
- "type": "object",
228
- "additionalProperties": true
229
- },
230
- "authProfile": {
231
- "type": "string",
232
- "description": "Identifier of an authentication profile configured in tooling."
233
- }
234
- },
235
- "required": ["query"],
236
- "additionalProperties": false
237
- },
238
- "GraphQLExpect": {
239
- "type": "object",
240
- "properties": {
241
- "data": {
242
- "description": "Expectations on the data field (exact or partial match)."
243
- },
244
- "errors": {
245
- "description": "Expectations on the errors field."
246
- },
247
- "bodyMode": {
248
- "type": "string",
249
- "description": "Optional control over how strictly data and errors are matched."
250
- }
251
- },
252
- "additionalProperties": false
253
- },
254
- "WebSocketRequest": {
255
- "type": "object",
256
- "properties": {
257
- "channel": {
258
- "type": "string",
259
- "description": "Channel identifier, matching protocols.websocket.channels[].name."
260
- },
261
- "direction": {
262
- "type": "string",
263
- "enum": ["publish", "subscribe", "both"]
264
- },
265
- "messages": {
266
- "type": "array",
267
- "description": "Message actions (send/expect) forming a small interaction script.",
268
- "items": {
269
- "$ref": "#/$defs/WebSocketMessageAction"
270
- }
271
- },
272
- "authProfile": {
273
- "type": "string",
274
- "description": "Identifier of an authentication profile configured in tooling."
275
- }
276
- },
277
- "required": ["channel"],
278
- "additionalProperties": false
279
- },
280
- "WebSocketMessageAction": {
281
- "type": "object",
282
- "required": ["type", "messageName"],
283
- "properties": {
284
- "type": {
285
- "type": "string",
286
- "enum": ["send", "expect"],
287
- "description": "Whether this action sends or expects a message."
288
- },
289
- "messageName": {
290
- "type": "string",
291
- "description": "Name of the message, matching protocols.websocket.channels[].messages[].name."
292
- },
293
- "payload": {
294
- "description": "Payload to send or expected payload structure."
295
- }
296
- },
297
- "additionalProperties": false
298
- },
299
- "WebSocketExpect": {
300
- "type": "object",
301
- "properties": {
302
- "messages": {
303
- "type": "array",
304
- "description": "Expected messages to be observed on the channel.",
305
- "items": {
306
- "$ref": "#/$defs/WebSocketMessageAction"
307
- }
308
- },
309
- "timeoutMs": {
310
- "type": "integer",
311
- "description": "Timeout for the WebSocket interaction in milliseconds."
312
- }
313
- },
314
- "additionalProperties": false
315
- }
316
- },
317
- "additionalProperties": false
318
- }
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unispec.dev/schema/unispec-tests.schema.json",
4
+ "title": "UniSpec Tests document",
5
+ "description": "Executable test cases targeting UniSpec-described services.",
6
+ "type": "object",
7
+ "required": ["uniSpecTestsVersion", "target", "tests"],
8
+ "properties": {
9
+ "uniSpecTestsVersion": {
10
+ "type": "string",
11
+ "description": "UniSpec Tests format version (SemVer)."
12
+ },
13
+ "target": {
14
+ "type": "object",
15
+ "description": "Service and environment that this test document targets.",
16
+ "required": ["serviceName"],
17
+ "properties": {
18
+ "serviceName": {
19
+ "type": "string",
20
+ "description": "Identifier of the service, matching service.name from UniSpec."
21
+ },
22
+ "serviceVersion": {
23
+ "type": "string",
24
+ "description": "Optional service contract version, matching service.version when provided."
25
+ },
26
+ "environment": {
27
+ "type": "string",
28
+ "description": "Optional environment name, matching service.environments[].name when provided."
29
+ }
30
+ },
31
+ "additionalProperties": false
32
+ },
33
+ "tests": {
34
+ "type": "array",
35
+ "description": "List of test cases.",
36
+ "items": {
37
+ "$ref": "#/$defs/TestCase"
38
+ }
39
+ },
40
+ "extensions": {
41
+ "type": "object",
42
+ "description": "Custom vendor-specific extensions (x-*) at the document root.",
43
+ "additionalProperties": true
44
+ }
45
+ },
46
+ "$defs": {
47
+ "TestCase": {
48
+ "type": "object",
49
+ "required": ["name", "target", "request", "expect"],
50
+ "properties": {
51
+ "name": {
52
+ "type": "string",
53
+ "description": "Test identifier, unique within this document."
54
+ },
55
+ "description": {
56
+ "type": "string",
57
+ "description": "Human-readable description of the test case."
58
+ },
59
+ "target": {
60
+ "$ref": "#/$defs/TestTarget"
61
+ },
62
+ "request": {
63
+ "$ref": "#/$defs/TestRequest"
64
+ },
65
+ "expect": {
66
+ "$ref": "#/$defs/TestExpect"
67
+ },
68
+ "tags": {
69
+ "type": "array",
70
+ "description": "Tags for grouping and filtering tests.",
71
+ "items": {
72
+ "type": "string"
73
+ }
74
+ },
75
+ "extensions": {
76
+ "type": "object",
77
+ "description": "Custom vendor-specific extensions (x-*) for this test.",
78
+ "additionalProperties": true
79
+ }
80
+ },
81
+ "additionalProperties": false
82
+ },
83
+ "TestTarget": {
84
+ "type": "object",
85
+ "required": ["protocol", "operationId"],
86
+ "properties": {
87
+ "protocol": {
88
+ "type": "string",
89
+ "description": "Protocol of the operation under test.",
90
+ "enum": ["rest", "graphql", "websocket"]
91
+ },
92
+ "operationId": {
93
+ "type": "string",
94
+ "description": "Operation identifier within the service (for example, REST route name)."
95
+ },
96
+ "environment": {
97
+ "type": "string",
98
+ "description": "Optional environment name overriding the document-level target.environment."
99
+ }
100
+ },
101
+ "additionalProperties": false
102
+ },
103
+ "TestRequest": {
104
+ "type": "object",
105
+ "description": "Protocol-specific request definition.",
106
+ "properties": {
107
+ "rest": {
108
+ "$ref": "#/$defs/RestRequest"
109
+ },
110
+ "graphql": {
111
+ "$ref": "#/$defs/GraphQLRequest"
112
+ },
113
+ "websocket": {
114
+ "$ref": "#/$defs/WebSocketRequest"
115
+ }
116
+ },
117
+ "additionalProperties": false
118
+ },
119
+ "TestExpect": {
120
+ "type": "object",
121
+ "description": "Protocol-specific expectations.",
122
+ "properties": {
123
+ "rest": {
124
+ "$ref": "#/$defs/RestExpect"
125
+ },
126
+ "graphql": {
127
+ "$ref": "#/$defs/GraphQLExpect"
128
+ },
129
+ "websocket": {
130
+ "$ref": "#/$defs/WebSocketExpect"
131
+ }
132
+ },
133
+ "additionalProperties": false
134
+ },
135
+ "RestRequest": {
136
+ "type": "object",
137
+ "properties": {
138
+ "params": {
139
+ "type": "object",
140
+ "properties": {
141
+ "path": {
142
+ "type": "object",
143
+ "additionalProperties": true
144
+ },
145
+ "query": {
146
+ "type": "object",
147
+ "additionalProperties": true
148
+ }
149
+ },
150
+ "additionalProperties": false
151
+ },
152
+ "headers": {
153
+ "type": "object",
154
+ "additionalProperties": true
155
+ },
156
+ "body": {
157
+ "description": "Request body (arbitrary JSON value)."
158
+ },
159
+ "authProfile": {
160
+ "type": "string",
161
+ "description": "Identifier of an authentication profile configured in tooling."
162
+ }
163
+ },
164
+ "additionalProperties": false
165
+ },
166
+ "RestExpect": {
167
+ "type": "object",
168
+ "required": ["status"],
169
+ "properties": {
170
+ "status": {
171
+ "description": "Expected HTTP status code or list of acceptable codes.",
172
+ "oneOf": [
173
+ {
174
+ "type": "integer"
175
+ },
176
+ {
177
+ "type": "array",
178
+ "items": {
179
+ "type": "integer"
180
+ }
181
+ }
182
+ ]
183
+ },
184
+ "headers": {
185
+ "type": "object",
186
+ "description": "Expected headers (usually partial match).",
187
+ "additionalProperties": true
188
+ },
189
+ "body": {
190
+ "$ref": "#/$defs/BodyExpectation"
191
+ }
192
+ },
193
+ "additionalProperties": false
194
+ },
195
+ "BodyExpectation": {
196
+ "type": "object",
197
+ "properties": {
198
+ "mode": {
199
+ "type": "string",
200
+ "enum": ["exact", "contains", "schemaOnly", "snapshot"],
201
+ "description": "Assertion mode for the response body."
202
+ },
203
+ "json": {
204
+ "description": "JSON value used for exact or contains mode."
205
+ },
206
+ "schemaRef": {
207
+ "type": "string",
208
+ "description": "Reference to a schema from service.schemas for schemaOnly mode. Recommended format: <SchemaName> (where SchemaName is a key in service.schemas). Tools may also accept a JSON Pointer in the form #/service/schemas/<SchemaName>."
209
+ }
210
+ },
211
+ "additionalProperties": false
212
+ },
213
+ "GraphQLRequest": {
214
+ "type": "object",
215
+ "properties": {
216
+ "operationName": {
217
+ "type": "string"
218
+ },
219
+ "query": {
220
+ "type": "string"
221
+ },
222
+ "variables": {
223
+ "type": "object",
224
+ "additionalProperties": true
225
+ },
226
+ "headers": {
227
+ "type": "object",
228
+ "additionalProperties": true
229
+ },
230
+ "authProfile": {
231
+ "type": "string",
232
+ "description": "Identifier of an authentication profile configured in tooling."
233
+ }
234
+ },
235
+ "required": ["query"],
236
+ "additionalProperties": false
237
+ },
238
+ "GraphQLExpect": {
239
+ "type": "object",
240
+ "properties": {
241
+ "data": {
242
+ "description": "Expectations on the data field (exact or partial match)."
243
+ },
244
+ "errors": {
245
+ "description": "Expectations on the errors field."
246
+ },
247
+ "bodyMode": {
248
+ "type": "string",
249
+ "description": "Optional control over how strictly data and errors are matched."
250
+ }
251
+ },
252
+ "additionalProperties": false
253
+ },
254
+ "WebSocketRequest": {
255
+ "type": "object",
256
+ "properties": {
257
+ "channel": {
258
+ "type": "string",
259
+ "description": "Channel identifier, matching protocols.websocket.channels[].name."
260
+ },
261
+ "direction": {
262
+ "type": "string",
263
+ "enum": ["publish", "subscribe", "both"]
264
+ },
265
+ "messages": {
266
+ "type": "array",
267
+ "description": "Message actions (send/expect) forming a small interaction script.",
268
+ "items": {
269
+ "$ref": "#/$defs/WebSocketMessageAction"
270
+ }
271
+ },
272
+ "authProfile": {
273
+ "type": "string",
274
+ "description": "Identifier of an authentication profile configured in tooling."
275
+ }
276
+ },
277
+ "required": ["channel"],
278
+ "additionalProperties": false
279
+ },
280
+ "WebSocketMessageAction": {
281
+ "type": "object",
282
+ "required": ["type", "messageName"],
283
+ "properties": {
284
+ "type": {
285
+ "type": "string",
286
+ "enum": ["send", "expect"],
287
+ "description": "Whether this action sends or expects a message."
288
+ },
289
+ "messageName": {
290
+ "type": "string",
291
+ "description": "Name of the message, matching protocols.websocket.channels[].messages[].name."
292
+ },
293
+ "payload": {
294
+ "description": "Payload to send or expected payload structure."
295
+ }
296
+ },
297
+ "additionalProperties": false
298
+ },
299
+ "WebSocketExpect": {
300
+ "type": "object",
301
+ "properties": {
302
+ "messages": {
303
+ "type": "array",
304
+ "description": "Expected messages to be observed on the channel.",
305
+ "items": {
306
+ "$ref": "#/$defs/WebSocketMessageAction"
307
+ }
308
+ },
309
+ "timeoutMs": {
310
+ "type": "integer",
311
+ "description": "Timeout for the WebSocket interaction in milliseconds."
312
+ }
313
+ },
314
+ "additionalProperties": false
315
+ }
316
+ },
317
+ "additionalProperties": false
318
+ }