@unispechq/unispec-schema 0.2.1 → 0.3.0
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.
package/package.json
CHANGED
|
@@ -57,10 +57,24 @@
|
|
|
57
57
|
"additionalProperties": {
|
|
58
58
|
"$ref": "#/$defs/Response"
|
|
59
59
|
}
|
|
60
|
+
},
|
|
61
|
+
"security": {
|
|
62
|
+
"type": "array",
|
|
63
|
+
"description": "Security requirements for this route. Each item represents an alternative set of named security schemes.",
|
|
64
|
+
"items": {
|
|
65
|
+
"$ref": "#/$defs/SecurityRequirement"
|
|
66
|
+
}
|
|
60
67
|
}
|
|
61
68
|
},
|
|
62
69
|
"additionalProperties": false
|
|
63
70
|
},
|
|
71
|
+
"SecurityRequirement": {
|
|
72
|
+
"type": "array",
|
|
73
|
+
"description": "Alternative set of named security schemes applied to an operation.",
|
|
74
|
+
"items": {
|
|
75
|
+
"$ref": "./common.schema.json#/$defs/Identifier"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
64
78
|
"Parameter": {
|
|
65
79
|
"type": "object",
|
|
66
80
|
"required": ["name"],
|
|
@@ -138,6 +152,15 @@
|
|
|
138
152
|
"items": {
|
|
139
153
|
"$ref": "#/$defs/Route"
|
|
140
154
|
}
|
|
155
|
+
},
|
|
156
|
+
"securitySchemes": {
|
|
157
|
+
"type": "object",
|
|
158
|
+
"description": "Authentication mechanisms available for this REST surface.",
|
|
159
|
+
"additionalProperties": {
|
|
160
|
+
"type": "object",
|
|
161
|
+
"description": "Security scheme definition (shape is intentionally flexible and may evolve).",
|
|
162
|
+
"additionalProperties": true
|
|
163
|
+
}
|
|
141
164
|
}
|
|
142
165
|
},
|
|
143
166
|
"additionalProperties": false
|
|
@@ -15,6 +15,28 @@
|
|
|
15
15
|
"description": {
|
|
16
16
|
"$ref": "./common.schema.json#/$defs/Description"
|
|
17
17
|
},
|
|
18
|
+
"version": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Service contract version (SemVer)."
|
|
21
|
+
},
|
|
22
|
+
"owner": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "Owning team or group identifier."
|
|
25
|
+
},
|
|
26
|
+
"tags": {
|
|
27
|
+
"type": "array",
|
|
28
|
+
"description": "Simple string tags used for grouping and filtering in tooling.",
|
|
29
|
+
"items": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"links": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"description": "Well-known URLs related to the service (for example, repo, runbook, dashboard).",
|
|
36
|
+
"additionalProperties": {
|
|
37
|
+
"type": "string"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
18
40
|
"protocols": {
|
|
19
41
|
"type": "object",
|
|
20
42
|
"description": "Protocol-specific API surfaces exposed by this service.",
|
|
@@ -30,6 +52,44 @@
|
|
|
30
52
|
}
|
|
31
53
|
},
|
|
32
54
|
"additionalProperties": false
|
|
55
|
+
},
|
|
56
|
+
"schemas": {
|
|
57
|
+
"$ref": "./schemas.schema.json#"
|
|
58
|
+
},
|
|
59
|
+
"environments": {
|
|
60
|
+
"type": "array",
|
|
61
|
+
"description": "Deployment environments or entrypoints for the service.",
|
|
62
|
+
"items": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"required": ["name", "baseUrl"],
|
|
65
|
+
"properties": {
|
|
66
|
+
"name": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"description": "Short environment name (for example, dev, staging, prod, local)."
|
|
69
|
+
},
|
|
70
|
+
"baseUrl": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"format": "uri",
|
|
73
|
+
"description": "Base URL for the environment."
|
|
74
|
+
},
|
|
75
|
+
"region": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"description": "Region identifier (for example, eu-central-1)."
|
|
78
|
+
},
|
|
79
|
+
"labels": {
|
|
80
|
+
"type": "object",
|
|
81
|
+
"description": "Arbitrary string labels for tooling.",
|
|
82
|
+
"additionalProperties": {
|
|
83
|
+
"type": "string"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"isDefault": {
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"description": "Indicates the default environment for interactive tooling."
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"additionalProperties": false
|
|
92
|
+
}
|
|
33
93
|
}
|
|
34
94
|
},
|
|
35
95
|
"additionalProperties": false
|
|
@@ -43,6 +43,18 @@
|
|
|
43
43
|
"items": {
|
|
44
44
|
"$ref": "#/$defs/Message"
|
|
45
45
|
}
|
|
46
|
+
},
|
|
47
|
+
"security": {
|
|
48
|
+
"type": "array",
|
|
49
|
+
"description": "Security requirements for this channel. Each item represents an alternative set of named security schemes.",
|
|
50
|
+
"items": {
|
|
51
|
+
"$ref": "#/$defs/SecurityRequirement"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"extensions": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"description": "Custom vendor-specific extensions (x-*) for this channel.",
|
|
57
|
+
"additionalProperties": true
|
|
46
58
|
}
|
|
47
59
|
},
|
|
48
60
|
"additionalProperties": false
|
|
@@ -55,6 +67,15 @@
|
|
|
55
67
|
"items": {
|
|
56
68
|
"$ref": "#/$defs/Channel"
|
|
57
69
|
}
|
|
70
|
+
},
|
|
71
|
+
"securitySchemes": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"description": "Authentication mechanisms available for this WebSocket surface.",
|
|
74
|
+
"additionalProperties": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"description": "Security scheme definition (shape is intentionally flexible and may evolve).",
|
|
77
|
+
"additionalProperties": true
|
|
78
|
+
}
|
|
58
79
|
}
|
|
59
80
|
},
|
|
60
81
|
"additionalProperties": false
|
|
@@ -0,0 +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
|
+
}
|