@unispechq/unispec-core 0.2.10 → 0.2.11
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/dist/cjs/diff/index.js +18 -5
- package/dist/cjs/loader/index.js +61 -6
- package/dist/cjs/normalizer/index.js +16 -2
- package/dist/cjs/validator/generated-schemas.js +819 -0
- package/dist/cjs/validator/index.js +5 -82
- package/dist/diff/index.d.ts +18 -5
- package/dist/diff/index.js +18 -5
- package/dist/loader/index.d.ts +3 -4
- package/dist/loader/index.js +28 -6
- package/dist/normalizer/index.d.ts +16 -2
- package/dist/normalizer/index.js +16 -2
- package/dist/validator/generated-schemas.d.ts +832 -0
- package/dist/validator/generated-schemas.js +816 -0
- package/dist/validator/index.js +5 -49
- package/package.json +7 -2
|
@@ -0,0 +1,819 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Auto-generated schemas for validator
|
|
3
|
+
// This file is generated during build time
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.SCHEMA_IDS = exports.GENERATED_SCHEMAS = void 0;
|
|
6
|
+
exports.GENERATED_SCHEMAS = {
|
|
7
|
+
unispec: {
|
|
8
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
9
|
+
"$id": "https://unispec.dev/schema/unispec.schema.json",
|
|
10
|
+
"title": "UniSpec document",
|
|
11
|
+
"description": "Top-level UniSpec document describing a multi-protocol API service.",
|
|
12
|
+
"type": "object",
|
|
13
|
+
"required": [
|
|
14
|
+
"unispecVersion",
|
|
15
|
+
"service"
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"unispecVersion": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "UniSpec format version (SemVer)."
|
|
21
|
+
},
|
|
22
|
+
"service": {
|
|
23
|
+
"$ref": "./types/service.schema.json#"
|
|
24
|
+
},
|
|
25
|
+
"extensions": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"description": "Custom vendor-specific extensions (x-*) at the document root.",
|
|
28
|
+
"additionalProperties": true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"additionalProperties": false
|
|
32
|
+
},
|
|
33
|
+
unispecTests: {
|
|
34
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
35
|
+
"$id": "https://unispec.dev/schema/unispec-tests.schema.json",
|
|
36
|
+
"title": "UniSpec Tests document",
|
|
37
|
+
"description": "Executable test cases targeting UniSpec-described services.",
|
|
38
|
+
"type": "object",
|
|
39
|
+
"required": [
|
|
40
|
+
"uniSpecTestsVersion",
|
|
41
|
+
"target",
|
|
42
|
+
"tests"
|
|
43
|
+
],
|
|
44
|
+
"properties": {
|
|
45
|
+
"uniSpecTestsVersion": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "UniSpec Tests format version (SemVer)."
|
|
48
|
+
},
|
|
49
|
+
"target": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"description": "Service and environment that this test document targets.",
|
|
52
|
+
"required": [
|
|
53
|
+
"serviceName"
|
|
54
|
+
],
|
|
55
|
+
"properties": {
|
|
56
|
+
"serviceName": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"description": "Identifier of the service, matching service.name from UniSpec."
|
|
59
|
+
},
|
|
60
|
+
"serviceVersion": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "Optional service contract version, matching service.version when provided."
|
|
63
|
+
},
|
|
64
|
+
"environment": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "Optional environment name, matching service.environments[].name when provided."
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"additionalProperties": false
|
|
70
|
+
},
|
|
71
|
+
"tests": {
|
|
72
|
+
"type": "array",
|
|
73
|
+
"description": "List of test cases.",
|
|
74
|
+
"items": {
|
|
75
|
+
"$ref": "#/$defs/TestCase"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"extensions": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"description": "Custom vendor-specific extensions (x-*) at the document root.",
|
|
81
|
+
"additionalProperties": true
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"$defs": {
|
|
85
|
+
"TestCase": {
|
|
86
|
+
"type": "object",
|
|
87
|
+
"required": [
|
|
88
|
+
"name",
|
|
89
|
+
"target",
|
|
90
|
+
"request",
|
|
91
|
+
"expect"
|
|
92
|
+
],
|
|
93
|
+
"properties": {
|
|
94
|
+
"name": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "Test identifier, unique within this document."
|
|
97
|
+
},
|
|
98
|
+
"description": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"description": "Human-readable description of the test case."
|
|
101
|
+
},
|
|
102
|
+
"target": {
|
|
103
|
+
"$ref": "#/$defs/TestTarget"
|
|
104
|
+
},
|
|
105
|
+
"request": {
|
|
106
|
+
"$ref": "#/$defs/TestRequest"
|
|
107
|
+
},
|
|
108
|
+
"expect": {
|
|
109
|
+
"$ref": "#/$defs/TestExpect"
|
|
110
|
+
},
|
|
111
|
+
"tags": {
|
|
112
|
+
"type": "array",
|
|
113
|
+
"description": "Tags for grouping and filtering tests.",
|
|
114
|
+
"items": {
|
|
115
|
+
"type": "string"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"extensions": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"description": "Custom vendor-specific extensions (x-*) for this test.",
|
|
121
|
+
"additionalProperties": true
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"additionalProperties": false
|
|
125
|
+
},
|
|
126
|
+
"TestTarget": {
|
|
127
|
+
"type": "object",
|
|
128
|
+
"required": [
|
|
129
|
+
"protocol",
|
|
130
|
+
"operationId"
|
|
131
|
+
],
|
|
132
|
+
"properties": {
|
|
133
|
+
"protocol": {
|
|
134
|
+
"type": "string",
|
|
135
|
+
"description": "Protocol of the operation under test.",
|
|
136
|
+
"enum": [
|
|
137
|
+
"rest",
|
|
138
|
+
"graphql",
|
|
139
|
+
"websocket"
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
"operationId": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"description": "Operation identifier within the service (for example, REST route name)."
|
|
145
|
+
},
|
|
146
|
+
"environment": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"description": "Optional environment name overriding the document-level target.environment."
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"additionalProperties": false
|
|
152
|
+
},
|
|
153
|
+
"TestRequest": {
|
|
154
|
+
"type": "object",
|
|
155
|
+
"description": "Protocol-specific request definition.",
|
|
156
|
+
"properties": {
|
|
157
|
+
"rest": {
|
|
158
|
+
"$ref": "#/$defs/RestRequest"
|
|
159
|
+
},
|
|
160
|
+
"graphql": {
|
|
161
|
+
"$ref": "#/$defs/GraphQLRequest"
|
|
162
|
+
},
|
|
163
|
+
"websocket": {
|
|
164
|
+
"$ref": "#/$defs/WebSocketRequest"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"additionalProperties": false
|
|
168
|
+
},
|
|
169
|
+
"TestExpect": {
|
|
170
|
+
"type": "object",
|
|
171
|
+
"description": "Protocol-specific expectations.",
|
|
172
|
+
"properties": {
|
|
173
|
+
"rest": {
|
|
174
|
+
"$ref": "#/$defs/RestExpect"
|
|
175
|
+
},
|
|
176
|
+
"graphql": {
|
|
177
|
+
"$ref": "#/$defs/GraphQLExpect"
|
|
178
|
+
},
|
|
179
|
+
"websocket": {
|
|
180
|
+
"$ref": "#/$defs/WebSocketExpect"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"additionalProperties": false
|
|
184
|
+
},
|
|
185
|
+
"RestRequest": {
|
|
186
|
+
"type": "object",
|
|
187
|
+
"properties": {
|
|
188
|
+
"params": {
|
|
189
|
+
"type": "object",
|
|
190
|
+
"properties": {
|
|
191
|
+
"path": {
|
|
192
|
+
"type": "object",
|
|
193
|
+
"additionalProperties": true
|
|
194
|
+
},
|
|
195
|
+
"query": {
|
|
196
|
+
"type": "object",
|
|
197
|
+
"additionalProperties": true
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"additionalProperties": false
|
|
201
|
+
},
|
|
202
|
+
"headers": {
|
|
203
|
+
"type": "object",
|
|
204
|
+
"additionalProperties": true
|
|
205
|
+
},
|
|
206
|
+
"body": {
|
|
207
|
+
"description": "Request body (arbitrary JSON value)."
|
|
208
|
+
},
|
|
209
|
+
"authProfile": {
|
|
210
|
+
"type": "string",
|
|
211
|
+
"description": "Identifier of an authentication profile configured in tooling."
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"additionalProperties": false
|
|
215
|
+
},
|
|
216
|
+
"RestExpect": {
|
|
217
|
+
"type": "object",
|
|
218
|
+
"required": [
|
|
219
|
+
"status"
|
|
220
|
+
],
|
|
221
|
+
"properties": {
|
|
222
|
+
"status": {
|
|
223
|
+
"description": "Expected HTTP status code or list of acceptable codes.",
|
|
224
|
+
"oneOf": [
|
|
225
|
+
{
|
|
226
|
+
"type": "integer"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"type": "array",
|
|
230
|
+
"items": {
|
|
231
|
+
"type": "integer"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
"headers": {
|
|
237
|
+
"type": "object",
|
|
238
|
+
"description": "Expected headers (usually partial match).",
|
|
239
|
+
"additionalProperties": true
|
|
240
|
+
},
|
|
241
|
+
"body": {
|
|
242
|
+
"$ref": "#/$defs/BodyExpectation"
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"additionalProperties": false
|
|
246
|
+
},
|
|
247
|
+
"BodyExpectation": {
|
|
248
|
+
"type": "object",
|
|
249
|
+
"properties": {
|
|
250
|
+
"mode": {
|
|
251
|
+
"type": "string",
|
|
252
|
+
"enum": [
|
|
253
|
+
"exact",
|
|
254
|
+
"contains",
|
|
255
|
+
"schemaOnly",
|
|
256
|
+
"snapshot"
|
|
257
|
+
],
|
|
258
|
+
"description": "Assertion mode for the response body."
|
|
259
|
+
},
|
|
260
|
+
"json": {
|
|
261
|
+
"description": "JSON value used for exact or contains mode."
|
|
262
|
+
},
|
|
263
|
+
"schemaRef": {
|
|
264
|
+
"type": "string",
|
|
265
|
+
"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>."
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
"additionalProperties": false
|
|
269
|
+
},
|
|
270
|
+
"GraphQLRequest": {
|
|
271
|
+
"type": "object",
|
|
272
|
+
"properties": {
|
|
273
|
+
"operationName": {
|
|
274
|
+
"type": "string"
|
|
275
|
+
},
|
|
276
|
+
"query": {
|
|
277
|
+
"type": "string"
|
|
278
|
+
},
|
|
279
|
+
"variables": {
|
|
280
|
+
"type": "object",
|
|
281
|
+
"additionalProperties": true
|
|
282
|
+
},
|
|
283
|
+
"headers": {
|
|
284
|
+
"type": "object",
|
|
285
|
+
"additionalProperties": true
|
|
286
|
+
},
|
|
287
|
+
"authProfile": {
|
|
288
|
+
"type": "string",
|
|
289
|
+
"description": "Identifier of an authentication profile configured in tooling."
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
"required": [
|
|
293
|
+
"query"
|
|
294
|
+
],
|
|
295
|
+
"additionalProperties": false
|
|
296
|
+
},
|
|
297
|
+
"GraphQLExpect": {
|
|
298
|
+
"type": "object",
|
|
299
|
+
"properties": {
|
|
300
|
+
"data": {
|
|
301
|
+
"description": "Expectations on the data field (exact or partial match)."
|
|
302
|
+
},
|
|
303
|
+
"errors": {
|
|
304
|
+
"description": "Expectations on the errors field."
|
|
305
|
+
},
|
|
306
|
+
"bodyMode": {
|
|
307
|
+
"type": "string",
|
|
308
|
+
"description": "Optional control over how strictly data and errors are matched."
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
"additionalProperties": false
|
|
312
|
+
},
|
|
313
|
+
"WebSocketRequest": {
|
|
314
|
+
"type": "object",
|
|
315
|
+
"properties": {
|
|
316
|
+
"channel": {
|
|
317
|
+
"type": "string",
|
|
318
|
+
"description": "Channel identifier, matching protocols.websocket.channels[].name."
|
|
319
|
+
},
|
|
320
|
+
"direction": {
|
|
321
|
+
"type": "string",
|
|
322
|
+
"enum": [
|
|
323
|
+
"publish",
|
|
324
|
+
"subscribe",
|
|
325
|
+
"both"
|
|
326
|
+
]
|
|
327
|
+
},
|
|
328
|
+
"messages": {
|
|
329
|
+
"type": "array",
|
|
330
|
+
"description": "Message actions (send/expect) forming a small interaction script.",
|
|
331
|
+
"items": {
|
|
332
|
+
"$ref": "#/$defs/WebSocketMessageAction"
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
"authProfile": {
|
|
336
|
+
"type": "string",
|
|
337
|
+
"description": "Identifier of an authentication profile configured in tooling."
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
"required": [
|
|
341
|
+
"channel"
|
|
342
|
+
],
|
|
343
|
+
"additionalProperties": false
|
|
344
|
+
},
|
|
345
|
+
"WebSocketMessageAction": {
|
|
346
|
+
"type": "object",
|
|
347
|
+
"required": [
|
|
348
|
+
"type",
|
|
349
|
+
"messageName"
|
|
350
|
+
],
|
|
351
|
+
"properties": {
|
|
352
|
+
"type": {
|
|
353
|
+
"type": "string",
|
|
354
|
+
"enum": [
|
|
355
|
+
"send",
|
|
356
|
+
"expect"
|
|
357
|
+
],
|
|
358
|
+
"description": "Whether this action sends or expects a message."
|
|
359
|
+
},
|
|
360
|
+
"messageName": {
|
|
361
|
+
"type": "string",
|
|
362
|
+
"description": "Name of the message, matching protocols.websocket.channels[].messages[].name."
|
|
363
|
+
},
|
|
364
|
+
"payload": {
|
|
365
|
+
"description": "Payload to send or expected payload structure."
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
"additionalProperties": false
|
|
369
|
+
},
|
|
370
|
+
"WebSocketExpect": {
|
|
371
|
+
"type": "object",
|
|
372
|
+
"properties": {
|
|
373
|
+
"messages": {
|
|
374
|
+
"type": "array",
|
|
375
|
+
"description": "Expected messages to be observed on the channel.",
|
|
376
|
+
"items": {
|
|
377
|
+
"$ref": "#/$defs/WebSocketMessageAction"
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
"timeoutMs": {
|
|
381
|
+
"type": "integer",
|
|
382
|
+
"description": "Timeout for the WebSocket interaction in milliseconds."
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
"additionalProperties": false
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
"additionalProperties": false
|
|
389
|
+
},
|
|
390
|
+
subschemas: [
|
|
391
|
+
{
|
|
392
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
393
|
+
"$id": "https://unispec.dev/schema/types/common.schema.json",
|
|
394
|
+
"title": "Common UniSpec definitions",
|
|
395
|
+
"$defs": {
|
|
396
|
+
"Identifier": {
|
|
397
|
+
"type": "string",
|
|
398
|
+
"description": "Identifier for services, operations, channels, etc.",
|
|
399
|
+
"pattern": "^[A-Za-z_][A-Za-z0-9_.-]*$"
|
|
400
|
+
},
|
|
401
|
+
"Description": {
|
|
402
|
+
"type": "string",
|
|
403
|
+
"description": "Human-readable description text."
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
409
|
+
"$id": "https://unispec.dev/schema/types/graphql.schema.json",
|
|
410
|
+
"title": "GraphQL API surface",
|
|
411
|
+
"type": "object",
|
|
412
|
+
"$defs": {
|
|
413
|
+
"Operation": {
|
|
414
|
+
"type": "object",
|
|
415
|
+
"required": [
|
|
416
|
+
"name"
|
|
417
|
+
],
|
|
418
|
+
"properties": {
|
|
419
|
+
"name": {
|
|
420
|
+
"$ref": "./common.schema.json#/$defs/Identifier"
|
|
421
|
+
},
|
|
422
|
+
"description": {
|
|
423
|
+
"$ref": "./common.schema.json#/$defs/Description"
|
|
424
|
+
},
|
|
425
|
+
"deprecated": {
|
|
426
|
+
"type": "boolean",
|
|
427
|
+
"description": "Marks the operation as deprecated.",
|
|
428
|
+
"default": false
|
|
429
|
+
},
|
|
430
|
+
"deprecationReason": {
|
|
431
|
+
"type": "string",
|
|
432
|
+
"description": "Human-readable reason for deprecation."
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
"additionalProperties": false
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
"properties": {
|
|
439
|
+
"schema": {
|
|
440
|
+
"type": "string",
|
|
441
|
+
"description": "GraphQL schema SDL as a string. Canonical source of type definitions."
|
|
442
|
+
},
|
|
443
|
+
"queries": {
|
|
444
|
+
"type": "array",
|
|
445
|
+
"description": "Query operations exposed by the GraphQL API.",
|
|
446
|
+
"items": {
|
|
447
|
+
"$ref": "#/$defs/Operation"
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
"mutations": {
|
|
451
|
+
"type": "array",
|
|
452
|
+
"description": "Mutation operations exposed by the GraphQL API.",
|
|
453
|
+
"items": {
|
|
454
|
+
"$ref": "#/$defs/Operation"
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
"subscriptions": {
|
|
458
|
+
"type": "array",
|
|
459
|
+
"description": "Subscription operations exposed by the GraphQL API.",
|
|
460
|
+
"items": {
|
|
461
|
+
"$ref": "#/$defs/Operation"
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
"additionalProperties": false
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
469
|
+
"$id": "https://unispec.dev/schema/types/rest.schema.json",
|
|
470
|
+
"title": "REST API surface",
|
|
471
|
+
"type": "object",
|
|
472
|
+
"$defs": {
|
|
473
|
+
"Route": {
|
|
474
|
+
"type": "object",
|
|
475
|
+
"required": [
|
|
476
|
+
"path",
|
|
477
|
+
"method"
|
|
478
|
+
],
|
|
479
|
+
"properties": {
|
|
480
|
+
"name": {
|
|
481
|
+
"$ref": "./common.schema.json#/$defs/Identifier"
|
|
482
|
+
},
|
|
483
|
+
"summary": {
|
|
484
|
+
"type": "string",
|
|
485
|
+
"description": "Short, human-readable summary of the route."
|
|
486
|
+
},
|
|
487
|
+
"description": {
|
|
488
|
+
"$ref": "./common.schema.json#/$defs/Description"
|
|
489
|
+
},
|
|
490
|
+
"path": {
|
|
491
|
+
"type": "string",
|
|
492
|
+
"description": "URL path template, e.g. /users/{id}."
|
|
493
|
+
},
|
|
494
|
+
"method": {
|
|
495
|
+
"type": "string",
|
|
496
|
+
"description": "HTTP method in upper-case.",
|
|
497
|
+
"enum": [
|
|
498
|
+
"GET",
|
|
499
|
+
"POST",
|
|
500
|
+
"PUT",
|
|
501
|
+
"PATCH",
|
|
502
|
+
"DELETE"
|
|
503
|
+
]
|
|
504
|
+
},
|
|
505
|
+
"pathParams": {
|
|
506
|
+
"type": "array",
|
|
507
|
+
"description": "Path parameters bound from the URL template.",
|
|
508
|
+
"items": {
|
|
509
|
+
"$ref": "#/$defs/Parameter"
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
"queryParams": {
|
|
513
|
+
"type": "array",
|
|
514
|
+
"description": "Query string parameters.",
|
|
515
|
+
"items": {
|
|
516
|
+
"$ref": "#/$defs/Parameter"
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
"headers": {
|
|
520
|
+
"type": "array",
|
|
521
|
+
"description": "HTTP headers relevant for this route.",
|
|
522
|
+
"items": {
|
|
523
|
+
"$ref": "#/$defs/Parameter"
|
|
524
|
+
}
|
|
525
|
+
},
|
|
526
|
+
"requestBody": {
|
|
527
|
+
"$ref": "#/$defs/RequestBody"
|
|
528
|
+
},
|
|
529
|
+
"responses": {
|
|
530
|
+
"type": "object",
|
|
531
|
+
"description": "HTTP responses keyed by status code (e.g. '200', '404').",
|
|
532
|
+
"additionalProperties": {
|
|
533
|
+
"$ref": "#/$defs/Response"
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
"security": {
|
|
537
|
+
"type": "array",
|
|
538
|
+
"description": "Security requirements for this route. Each item represents an alternative set of named security schemes.",
|
|
539
|
+
"items": {
|
|
540
|
+
"$ref": "#/$defs/SecurityRequirement"
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
"additionalProperties": false
|
|
545
|
+
},
|
|
546
|
+
"SecurityRequirement": {
|
|
547
|
+
"type": "array",
|
|
548
|
+
"description": "Alternative set of named security schemes applied to an operation.",
|
|
549
|
+
"items": {
|
|
550
|
+
"$ref": "./common.schema.json#/$defs/Identifier"
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
"Parameter": {
|
|
554
|
+
"type": "object",
|
|
555
|
+
"required": [
|
|
556
|
+
"name"
|
|
557
|
+
],
|
|
558
|
+
"properties": {
|
|
559
|
+
"name": {
|
|
560
|
+
"type": "string",
|
|
561
|
+
"description": "Parameter name as it appears in the API."
|
|
562
|
+
},
|
|
563
|
+
"description": {
|
|
564
|
+
"$ref": "./common.schema.json#/$defs/Description"
|
|
565
|
+
},
|
|
566
|
+
"required": {
|
|
567
|
+
"type": "boolean",
|
|
568
|
+
"description": "Whether this parameter is required.",
|
|
569
|
+
"default": false
|
|
570
|
+
},
|
|
571
|
+
"schemaRef": {
|
|
572
|
+
"type": "string",
|
|
573
|
+
"description": "Reference to a reusable schema defined in service.schemas. Recommended format: <SchemaName> (where SchemaName is a key in service.schemas). Tools may also accept a JSON Pointer in the form #/service/schemas/<SchemaName>."
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
"additionalProperties": false
|
|
577
|
+
},
|
|
578
|
+
"MediaType": {
|
|
579
|
+
"type": "object",
|
|
580
|
+
"properties": {
|
|
581
|
+
"schemaRef": {
|
|
582
|
+
"type": "string",
|
|
583
|
+
"description": "Reference to a reusable schema defined in service.schemas used as the content payload. Recommended format: <SchemaName> (where SchemaName is a key in service.schemas). Tools may also accept a JSON Pointer in the form #/service/schemas/<SchemaName>."
|
|
584
|
+
}
|
|
585
|
+
},
|
|
586
|
+
"additionalProperties": false
|
|
587
|
+
},
|
|
588
|
+
"Content": {
|
|
589
|
+
"type": "object",
|
|
590
|
+
"description": "Content keyed by media type, e.g. 'application/json'.",
|
|
591
|
+
"additionalProperties": {
|
|
592
|
+
"$ref": "#/$defs/MediaType"
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
"RequestBody": {
|
|
596
|
+
"type": "object",
|
|
597
|
+
"properties": {
|
|
598
|
+
"description": {
|
|
599
|
+
"$ref": "./common.schema.json#/$defs/Description"
|
|
600
|
+
},
|
|
601
|
+
"required": {
|
|
602
|
+
"type": "boolean",
|
|
603
|
+
"description": "Whether a request body is required.",
|
|
604
|
+
"default": false
|
|
605
|
+
},
|
|
606
|
+
"content": {
|
|
607
|
+
"$ref": "#/$defs/Content"
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
"additionalProperties": false
|
|
611
|
+
},
|
|
612
|
+
"Response": {
|
|
613
|
+
"type": "object",
|
|
614
|
+
"properties": {
|
|
615
|
+
"description": {
|
|
616
|
+
"$ref": "./common.schema.json#/$defs/Description"
|
|
617
|
+
},
|
|
618
|
+
"content": {
|
|
619
|
+
"$ref": "#/$defs/Content"
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
"additionalProperties": false
|
|
623
|
+
}
|
|
624
|
+
},
|
|
625
|
+
"properties": {
|
|
626
|
+
"routes": {
|
|
627
|
+
"type": "array",
|
|
628
|
+
"description": "List of REST routes exposed by the service.",
|
|
629
|
+
"items": {
|
|
630
|
+
"$ref": "#/$defs/Route"
|
|
631
|
+
}
|
|
632
|
+
},
|
|
633
|
+
"securitySchemes": {
|
|
634
|
+
"type": "object",
|
|
635
|
+
"description": "Authentication mechanisms available for this REST surface.",
|
|
636
|
+
"additionalProperties": {
|
|
637
|
+
"type": "object",
|
|
638
|
+
"description": "Security scheme definition (shape is intentionally flexible and may evolve).",
|
|
639
|
+
"additionalProperties": true
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
},
|
|
643
|
+
"additionalProperties": false
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
647
|
+
"$id": "https://unispec.dev/schema/types/schemas.schema.json",
|
|
648
|
+
"title": "Reusable data schemas",
|
|
649
|
+
"description": "Container for reusable data model definitions (request/response bodies, messages, etc.).",
|
|
650
|
+
"type": "object",
|
|
651
|
+
"additionalProperties": {
|
|
652
|
+
"$ref": "#/$defs/SchemaDefinition"
|
|
653
|
+
},
|
|
654
|
+
"$defs": {
|
|
655
|
+
"SchemaDefinition": {
|
|
656
|
+
"type": "object",
|
|
657
|
+
"description": "Named reusable data schema definition.",
|
|
658
|
+
"properties": {
|
|
659
|
+
"jsonSchema": {
|
|
660
|
+
"type": "object",
|
|
661
|
+
"description": "Embedded JSON Schema Draft 2020-12 definition for this type.",
|
|
662
|
+
"additionalProperties": true
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
"required": [
|
|
666
|
+
"jsonSchema"
|
|
667
|
+
],
|
|
668
|
+
"additionalProperties": false
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
674
|
+
"$id": "https://unispec.dev/schema/types/service.schema.json",
|
|
675
|
+
"title": "UniSpec Service",
|
|
676
|
+
"type": "object",
|
|
677
|
+
"required": [
|
|
678
|
+
"name"
|
|
679
|
+
],
|
|
680
|
+
"properties": {
|
|
681
|
+
"name": {
|
|
682
|
+
"$ref": "./common.schema.json#/$defs/Identifier"
|
|
683
|
+
},
|
|
684
|
+
"description": {
|
|
685
|
+
"$ref": "./common.schema.json#/$defs/Description"
|
|
686
|
+
},
|
|
687
|
+
"version": {
|
|
688
|
+
"type": "string",
|
|
689
|
+
"description": "Service contract version (SemVer)."
|
|
690
|
+
},
|
|
691
|
+
"protocols": {
|
|
692
|
+
"type": "object",
|
|
693
|
+
"description": "Protocol-specific API surfaces exposed by this service.",
|
|
694
|
+
"properties": {
|
|
695
|
+
"rest": {
|
|
696
|
+
"$ref": "./rest.schema.json#"
|
|
697
|
+
},
|
|
698
|
+
"graphql": {
|
|
699
|
+
"$ref": "./graphql.schema.json#"
|
|
700
|
+
},
|
|
701
|
+
"websocket": {
|
|
702
|
+
"$ref": "./websocket.schema.json#"
|
|
703
|
+
}
|
|
704
|
+
},
|
|
705
|
+
"additionalProperties": false
|
|
706
|
+
},
|
|
707
|
+
"schemas": {
|
|
708
|
+
"$ref": "./schemas.schema.json#"
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
"additionalProperties": false
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
715
|
+
"$id": "https://unispec.dev/schema/types/websocket.schema.json",
|
|
716
|
+
"title": "WebSocket API surface",
|
|
717
|
+
"type": "object",
|
|
718
|
+
"$defs": {
|
|
719
|
+
"Message": {
|
|
720
|
+
"type": "object",
|
|
721
|
+
"required": [
|
|
722
|
+
"name"
|
|
723
|
+
],
|
|
724
|
+
"properties": {
|
|
725
|
+
"name": {
|
|
726
|
+
"$ref": "./common.schema.json#/$defs/Identifier"
|
|
727
|
+
},
|
|
728
|
+
"description": {
|
|
729
|
+
"$ref": "./common.schema.json#/$defs/Description"
|
|
730
|
+
},
|
|
731
|
+
"schemaRef": {
|
|
732
|
+
"type": "string",
|
|
733
|
+
"description": "Reference to a reusable schema describing the message payload. Recommended format: <SchemaName> (where SchemaName is a key in service.schemas). Tools may also accept a JSON Pointer in the form #/service/schemas/<SchemaName>."
|
|
734
|
+
}
|
|
735
|
+
},
|
|
736
|
+
"additionalProperties": false
|
|
737
|
+
},
|
|
738
|
+
"SecurityRequirement": {
|
|
739
|
+
"type": "array",
|
|
740
|
+
"description": "Alternative set of named security schemes applied to a WebSocket channel.",
|
|
741
|
+
"items": {
|
|
742
|
+
"$ref": "./common.schema.json#/$defs/Identifier"
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
"Channel": {
|
|
746
|
+
"type": "object",
|
|
747
|
+
"required": [
|
|
748
|
+
"name"
|
|
749
|
+
],
|
|
750
|
+
"properties": {
|
|
751
|
+
"name": {
|
|
752
|
+
"$ref": "./common.schema.json#/$defs/Identifier"
|
|
753
|
+
},
|
|
754
|
+
"description": {
|
|
755
|
+
"$ref": "./common.schema.json#/$defs/Description"
|
|
756
|
+
},
|
|
757
|
+
"direction": {
|
|
758
|
+
"type": "string",
|
|
759
|
+
"description": "Direction of message flow on this channel.",
|
|
760
|
+
"enum": [
|
|
761
|
+
"publish",
|
|
762
|
+
"subscribe",
|
|
763
|
+
"both"
|
|
764
|
+
],
|
|
765
|
+
"default": "both"
|
|
766
|
+
},
|
|
767
|
+
"messages": {
|
|
768
|
+
"type": "array",
|
|
769
|
+
"description": "Messages that may be sent or received on this channel.",
|
|
770
|
+
"items": {
|
|
771
|
+
"$ref": "#/$defs/Message"
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
"security": {
|
|
775
|
+
"type": "array",
|
|
776
|
+
"description": "Security requirements for this channel. Each item represents an alternative set of named security schemes.",
|
|
777
|
+
"items": {
|
|
778
|
+
"$ref": "#/$defs/SecurityRequirement"
|
|
779
|
+
}
|
|
780
|
+
},
|
|
781
|
+
"extensions": {
|
|
782
|
+
"type": "object",
|
|
783
|
+
"description": "Custom vendor-specific extensions (x-*) for this channel.",
|
|
784
|
+
"additionalProperties": true
|
|
785
|
+
}
|
|
786
|
+
},
|
|
787
|
+
"additionalProperties": false
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
"properties": {
|
|
791
|
+
"channels": {
|
|
792
|
+
"type": "array",
|
|
793
|
+
"description": "WebSocket channels/topics exposed by the service.",
|
|
794
|
+
"items": {
|
|
795
|
+
"$ref": "#/$defs/Channel"
|
|
796
|
+
}
|
|
797
|
+
},
|
|
798
|
+
"securitySchemes": {
|
|
799
|
+
"type": "object",
|
|
800
|
+
"description": "Authentication mechanisms available for this WebSocket surface.",
|
|
801
|
+
"additionalProperties": {
|
|
802
|
+
"type": "object",
|
|
803
|
+
"description": "Security scheme definition (shape is intentionally flexible and may evolve).",
|
|
804
|
+
"additionalProperties": true
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
},
|
|
808
|
+
"additionalProperties": false
|
|
809
|
+
}
|
|
810
|
+
]
|
|
811
|
+
};
|
|
812
|
+
exports.SCHEMA_IDS = [
|
|
813
|
+
"https://unispec.dev/schema/types/common.schema.json",
|
|
814
|
+
"https://unispec.dev/schema/types/graphql.schema.json",
|
|
815
|
+
"https://unispec.dev/schema/types/rest.schema.json",
|
|
816
|
+
"https://unispec.dev/schema/types/schemas.schema.json",
|
|
817
|
+
"https://unispec.dev/schema/types/service.schema.json",
|
|
818
|
+
"https://unispec.dev/schema/types/websocket.schema.json"
|
|
819
|
+
];
|