@takeshape/json-schema 11.73.0 → 11.76.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 +3 -3
- package/dist/__tests__/schema-validator.test.d.ts +0 -1
- package/dist/__tests__/schema-validator.test.js +0 -323
- package/dist/converters/__tests__/schema-converter.test.d.ts +0 -1
- package/dist/converters/__tests__/schema-converter.test.js +0 -1134
- package/dist/converters/__tests__/search-shape-schema.json +0 -495
- package/dist/utils/__tests__/references.test.d.ts +0 -1
- package/dist/utils/__tests__/references.test.js +0 -121
- package/dist/utils/__tests__/type-utils.test.d.ts +0 -1
- package/dist/utils/__tests__/type-utils.test.js +0 -143
|
@@ -1,495 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "object",
|
|
3
|
-
"properties": {
|
|
4
|
-
"terms": {
|
|
5
|
-
"type": "string"
|
|
6
|
-
},
|
|
7
|
-
"from": {
|
|
8
|
-
"type": "integer",
|
|
9
|
-
"description": "The offset from the first result you want to fetch."
|
|
10
|
-
},
|
|
11
|
-
"size": {
|
|
12
|
-
"type": "integer",
|
|
13
|
-
"description": "The maximum number of items to return."
|
|
14
|
-
},
|
|
15
|
-
"filter": {
|
|
16
|
-
"type": "object",
|
|
17
|
-
"description": "An elasticsearch style filter. Overrides onlyEnabled."
|
|
18
|
-
},
|
|
19
|
-
"sort": {
|
|
20
|
-
"type": "array",
|
|
21
|
-
"description": "An list of fields to sort by.",
|
|
22
|
-
"items": {
|
|
23
|
-
"$ref": "#/definitions/TSSearchSortInput"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"locale": {
|
|
27
|
-
"type": "string"
|
|
28
|
-
},
|
|
29
|
-
"enableLocaleFallback": {
|
|
30
|
-
"type": "boolean",
|
|
31
|
-
"default": true
|
|
32
|
-
},
|
|
33
|
-
"onlyEnabled": {
|
|
34
|
-
"type": "boolean",
|
|
35
|
-
"default": true,
|
|
36
|
-
"description": "Filter out content that is not enabled. Defaults to true."
|
|
37
|
-
},
|
|
38
|
-
"where": {
|
|
39
|
-
"description": "The where clause uses the boolean AND, OR, and NOT parameters to construct complex filters based on the values of your fields. It applies an implicit AND to all the top-level keys. To avoid this, use a single OR or NOT key as the only top-level key.",
|
|
40
|
-
"$ref": "#/definitions/TSWhereBookInput"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"title": "Args",
|
|
44
|
-
"definitions": {
|
|
45
|
-
"TSSearchSortInput": {
|
|
46
|
-
"type": "object",
|
|
47
|
-
"properties": {
|
|
48
|
-
"field": {
|
|
49
|
-
"type": "string"
|
|
50
|
-
},
|
|
51
|
-
"order": {
|
|
52
|
-
"type": "string",
|
|
53
|
-
"description": "asc for ascending or desc for descending"
|
|
54
|
-
},
|
|
55
|
-
"_shapeId": {
|
|
56
|
-
"type": "string",
|
|
57
|
-
"enum": ["TSSearchSortInput"]
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"required": ["field", "order"],
|
|
61
|
-
"title": "TSSearchSortInput"
|
|
62
|
-
},
|
|
63
|
-
"TSWhereString": {
|
|
64
|
-
"type": "object",
|
|
65
|
-
"properties": {
|
|
66
|
-
"eq": {
|
|
67
|
-
"description": "Exact match",
|
|
68
|
-
"type": "string"
|
|
69
|
-
},
|
|
70
|
-
"in": {
|
|
71
|
-
"type": "array",
|
|
72
|
-
"items": {
|
|
73
|
-
"type": "string"
|
|
74
|
-
},
|
|
75
|
-
"description": "Array of possible exact match values."
|
|
76
|
-
},
|
|
77
|
-
"match": {
|
|
78
|
-
"description": "Full text searching with fuzzy matching.",
|
|
79
|
-
"type": "string"
|
|
80
|
-
},
|
|
81
|
-
"regexp": {
|
|
82
|
-
"description": "Regular expression string matching. Use of * wildcards could degrade performance.",
|
|
83
|
-
"type": "string"
|
|
84
|
-
},
|
|
85
|
-
"_shapeId": {
|
|
86
|
-
"type": "string",
|
|
87
|
-
"enum": ["TSWhereString"]
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
"title": "TSWhereString"
|
|
91
|
-
},
|
|
92
|
-
"TSWhereDraftjs": {
|
|
93
|
-
"type": "object",
|
|
94
|
-
"properties": {
|
|
95
|
-
"match": {
|
|
96
|
-
"description": "Full text searching with fuzzy matching.",
|
|
97
|
-
"type": "string"
|
|
98
|
-
},
|
|
99
|
-
"_shapeId": {
|
|
100
|
-
"type": "string",
|
|
101
|
-
"enum": ["TSWhereDraftjs"]
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
"title": "TSWhereDraftjs"
|
|
105
|
-
},
|
|
106
|
-
"TSWhereID": {
|
|
107
|
-
"type": "object",
|
|
108
|
-
"properties": {
|
|
109
|
-
"eq": {
|
|
110
|
-
"description": "Exact match",
|
|
111
|
-
"type": "string"
|
|
112
|
-
},
|
|
113
|
-
"in": {
|
|
114
|
-
"type": "array",
|
|
115
|
-
"items": {
|
|
116
|
-
"type": "string"
|
|
117
|
-
},
|
|
118
|
-
"description": "Array of possible exact match values."
|
|
119
|
-
},
|
|
120
|
-
"_shapeId": {
|
|
121
|
-
"type": "string",
|
|
122
|
-
"enum": ["TSWhereID"]
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
"title": "TSWhereID"
|
|
126
|
-
},
|
|
127
|
-
"TSWhereInteger": {
|
|
128
|
-
"type": "object",
|
|
129
|
-
"properties": {
|
|
130
|
-
"eq": {
|
|
131
|
-
"description": "Exact match",
|
|
132
|
-
"type": "integer"
|
|
133
|
-
},
|
|
134
|
-
"lt": {
|
|
135
|
-
"description": "Less than",
|
|
136
|
-
"type": "integer"
|
|
137
|
-
},
|
|
138
|
-
"lte": {
|
|
139
|
-
"description": "Less than or equal",
|
|
140
|
-
"type": "integer"
|
|
141
|
-
},
|
|
142
|
-
"gt": {
|
|
143
|
-
"description": "Greater than",
|
|
144
|
-
"type": "integer"
|
|
145
|
-
},
|
|
146
|
-
"gte": {
|
|
147
|
-
"description": "Greater than or equal",
|
|
148
|
-
"type": "integer"
|
|
149
|
-
},
|
|
150
|
-
"in": {
|
|
151
|
-
"type": "array",
|
|
152
|
-
"items": {
|
|
153
|
-
"type": "integer"
|
|
154
|
-
},
|
|
155
|
-
"description": "Array of possible exact match values."
|
|
156
|
-
},
|
|
157
|
-
"_shapeId": {
|
|
158
|
-
"type": "string",
|
|
159
|
-
"enum": ["TSWhereInteger"]
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
"title": "TSWhereInteger"
|
|
163
|
-
},
|
|
164
|
-
"TSWhereDate": {
|
|
165
|
-
"type": "object",
|
|
166
|
-
"properties": {
|
|
167
|
-
"eq": {
|
|
168
|
-
"description": "Exact match",
|
|
169
|
-
"type": "string"
|
|
170
|
-
},
|
|
171
|
-
"lt": {
|
|
172
|
-
"description": "Less than",
|
|
173
|
-
"type": "string"
|
|
174
|
-
},
|
|
175
|
-
"lte": {
|
|
176
|
-
"description": "Less than or equal",
|
|
177
|
-
"type": "string"
|
|
178
|
-
},
|
|
179
|
-
"gt": {
|
|
180
|
-
"description": "Greater than",
|
|
181
|
-
"type": "string"
|
|
182
|
-
},
|
|
183
|
-
"gte": {
|
|
184
|
-
"description": "Greater than or equal",
|
|
185
|
-
"type": "string"
|
|
186
|
-
},
|
|
187
|
-
"_shapeId": {
|
|
188
|
-
"type": "string",
|
|
189
|
-
"enum": ["TSWhereDate"]
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
"title": "TSWhereDate"
|
|
193
|
-
},
|
|
194
|
-
"TSWhereNumber": {
|
|
195
|
-
"type": "object",
|
|
196
|
-
"properties": {
|
|
197
|
-
"eq": {
|
|
198
|
-
"description": "Exact match",
|
|
199
|
-
"type": "number"
|
|
200
|
-
},
|
|
201
|
-
"lt": {
|
|
202
|
-
"description": "Less than",
|
|
203
|
-
"type": "number"
|
|
204
|
-
},
|
|
205
|
-
"lte": {
|
|
206
|
-
"description": "Less than or equal",
|
|
207
|
-
"type": "number"
|
|
208
|
-
},
|
|
209
|
-
"gt": {
|
|
210
|
-
"description": "Greater than",
|
|
211
|
-
"type": "number"
|
|
212
|
-
},
|
|
213
|
-
"gte": {
|
|
214
|
-
"description": "Greater than or equal",
|
|
215
|
-
"type": "number"
|
|
216
|
-
},
|
|
217
|
-
"in": {
|
|
218
|
-
"type": "array",
|
|
219
|
-
"items": {
|
|
220
|
-
"type": "number"
|
|
221
|
-
},
|
|
222
|
-
"description": "Array of possible exact match values."
|
|
223
|
-
},
|
|
224
|
-
"_shapeId": {
|
|
225
|
-
"type": "string",
|
|
226
|
-
"enum": ["TSWhereNumber"]
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
"title": "TSWhereNumber"
|
|
230
|
-
},
|
|
231
|
-
"TSWhereWorkflow": {
|
|
232
|
-
"type": "object",
|
|
233
|
-
"properties": {
|
|
234
|
-
"eq": {
|
|
235
|
-
"description": "Exact match",
|
|
236
|
-
"type": "string"
|
|
237
|
-
},
|
|
238
|
-
"lt": {
|
|
239
|
-
"description": "Less than",
|
|
240
|
-
"type": "string"
|
|
241
|
-
},
|
|
242
|
-
"lte": {
|
|
243
|
-
"description": "Less than or equal",
|
|
244
|
-
"type": "string"
|
|
245
|
-
},
|
|
246
|
-
"gt": {
|
|
247
|
-
"description": "Greater than",
|
|
248
|
-
"type": "string"
|
|
249
|
-
},
|
|
250
|
-
"gte": {
|
|
251
|
-
"description": "Greater than or equal",
|
|
252
|
-
"type": "string"
|
|
253
|
-
},
|
|
254
|
-
"in": {
|
|
255
|
-
"type": "array",
|
|
256
|
-
"items": {
|
|
257
|
-
"type": "string"
|
|
258
|
-
},
|
|
259
|
-
"description": "Array of possible exact match values."
|
|
260
|
-
},
|
|
261
|
-
"_shapeId": {
|
|
262
|
-
"type": "string",
|
|
263
|
-
"enum": ["TSWhereWorkflow"]
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
"title": "TSWhereWorkflow"
|
|
267
|
-
},
|
|
268
|
-
"TSWhereAuthorRelationship": {
|
|
269
|
-
"type": "object",
|
|
270
|
-
"properties": {
|
|
271
|
-
"name": {
|
|
272
|
-
"$ref": "#/definitions/TSWhereString"
|
|
273
|
-
},
|
|
274
|
-
"biography": {
|
|
275
|
-
"$ref": "#/definitions/TSWhereDraftjs"
|
|
276
|
-
},
|
|
277
|
-
"_id": {
|
|
278
|
-
"$ref": "#/definitions/TSWhereID"
|
|
279
|
-
},
|
|
280
|
-
"_shapeId": {
|
|
281
|
-
"type": "string",
|
|
282
|
-
"enum": ["TSWhereAuthorRelationship"]
|
|
283
|
-
},
|
|
284
|
-
"_version": {
|
|
285
|
-
"$ref": "#/definitions/TSWhereInteger"
|
|
286
|
-
},
|
|
287
|
-
"_shapeName": {
|
|
288
|
-
"$ref": "#/definitions/TSWhereString"
|
|
289
|
-
},
|
|
290
|
-
"_createdAt": {
|
|
291
|
-
"$ref": "#/definitions/TSWhereDate"
|
|
292
|
-
},
|
|
293
|
-
"_updatedAt": {
|
|
294
|
-
"$ref": "#/definitions/TSWhereDate"
|
|
295
|
-
},
|
|
296
|
-
"_schemaVersion": {
|
|
297
|
-
"$ref": "#/definitions/TSWhereNumber"
|
|
298
|
-
},
|
|
299
|
-
"_status": {
|
|
300
|
-
"$ref": "#/definitions/TSWhereWorkflow"
|
|
301
|
-
},
|
|
302
|
-
"_contentTypeId": {
|
|
303
|
-
"$ref": "#/definitions/TSWhereID"
|
|
304
|
-
},
|
|
305
|
-
"_contentTypeName": {
|
|
306
|
-
"$ref": "#/definitions/TSWhereString"
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
"title": "TSWhereAuthorRelationship"
|
|
310
|
-
},
|
|
311
|
-
"TSWhereAssetRelationship": {
|
|
312
|
-
"type": "object",
|
|
313
|
-
"properties": {
|
|
314
|
-
"path": {
|
|
315
|
-
"$ref": "#/definitions/TSWhereString"
|
|
316
|
-
},
|
|
317
|
-
"filename": {
|
|
318
|
-
"$ref": "#/definitions/TSWhereString"
|
|
319
|
-
},
|
|
320
|
-
"description": {
|
|
321
|
-
"$ref": "#/definitions/TSWhereString"
|
|
322
|
-
},
|
|
323
|
-
"caption": {
|
|
324
|
-
"$ref": "#/definitions/TSWhereDraftjs"
|
|
325
|
-
},
|
|
326
|
-
"uploadStatus": {
|
|
327
|
-
"$ref": "#/definitions/TSWhereString"
|
|
328
|
-
},
|
|
329
|
-
"mimeType": {
|
|
330
|
-
"$ref": "#/definitions/TSWhereString"
|
|
331
|
-
},
|
|
332
|
-
"title": {
|
|
333
|
-
"$ref": "#/definitions/TSWhereString"
|
|
334
|
-
},
|
|
335
|
-
"credit": {
|
|
336
|
-
"$ref": "#/definitions/TSWhereDraftjs"
|
|
337
|
-
},
|
|
338
|
-
"sourceUrl": {
|
|
339
|
-
"$ref": "#/definitions/TSWhereString"
|
|
340
|
-
},
|
|
341
|
-
"_id": {
|
|
342
|
-
"$ref": "#/definitions/TSWhereID"
|
|
343
|
-
},
|
|
344
|
-
"_shapeId": {
|
|
345
|
-
"type": "string",
|
|
346
|
-
"enum": ["TSWhereAssetRelationship"]
|
|
347
|
-
},
|
|
348
|
-
"_version": {
|
|
349
|
-
"$ref": "#/definitions/TSWhereInteger"
|
|
350
|
-
},
|
|
351
|
-
"_shapeName": {
|
|
352
|
-
"$ref": "#/definitions/TSWhereString"
|
|
353
|
-
},
|
|
354
|
-
"_createdAt": {
|
|
355
|
-
"$ref": "#/definitions/TSWhereDate"
|
|
356
|
-
},
|
|
357
|
-
"_updatedAt": {
|
|
358
|
-
"$ref": "#/definitions/TSWhereDate"
|
|
359
|
-
},
|
|
360
|
-
"_schemaVersion": {
|
|
361
|
-
"$ref": "#/definitions/TSWhereNumber"
|
|
362
|
-
},
|
|
363
|
-
"_status": {
|
|
364
|
-
"$ref": "#/definitions/TSWhereWorkflow"
|
|
365
|
-
},
|
|
366
|
-
"_contentTypeId": {
|
|
367
|
-
"$ref": "#/definitions/TSWhereID"
|
|
368
|
-
},
|
|
369
|
-
"_contentTypeName": {
|
|
370
|
-
"$ref": "#/definitions/TSWhereString"
|
|
371
|
-
},
|
|
372
|
-
"s3Key": {
|
|
373
|
-
"$ref": "#/definitions/TSWhereString"
|
|
374
|
-
}
|
|
375
|
-
},
|
|
376
|
-
"title": "TSWhereAssetRelationship"
|
|
377
|
-
},
|
|
378
|
-
"TSWhereGenreRelationship": {
|
|
379
|
-
"type": "object",
|
|
380
|
-
"properties": {
|
|
381
|
-
"title": {
|
|
382
|
-
"$ref": "#/definitions/TSWhereString"
|
|
383
|
-
},
|
|
384
|
-
"_id": {
|
|
385
|
-
"$ref": "#/definitions/TSWhereID"
|
|
386
|
-
},
|
|
387
|
-
"_shapeId": {
|
|
388
|
-
"type": "string",
|
|
389
|
-
"enum": ["TSWhereGenreRelationship"]
|
|
390
|
-
},
|
|
391
|
-
"_version": {
|
|
392
|
-
"$ref": "#/definitions/TSWhereInteger"
|
|
393
|
-
},
|
|
394
|
-
"_shapeName": {
|
|
395
|
-
"$ref": "#/definitions/TSWhereString"
|
|
396
|
-
},
|
|
397
|
-
"_createdAt": {
|
|
398
|
-
"$ref": "#/definitions/TSWhereDate"
|
|
399
|
-
},
|
|
400
|
-
"_updatedAt": {
|
|
401
|
-
"$ref": "#/definitions/TSWhereDate"
|
|
402
|
-
},
|
|
403
|
-
"_schemaVersion": {
|
|
404
|
-
"$ref": "#/definitions/TSWhereNumber"
|
|
405
|
-
},
|
|
406
|
-
"_status": {
|
|
407
|
-
"$ref": "#/definitions/TSWhereWorkflow"
|
|
408
|
-
},
|
|
409
|
-
"_contentTypeId": {
|
|
410
|
-
"$ref": "#/definitions/TSWhereID"
|
|
411
|
-
},
|
|
412
|
-
"_contentTypeName": {
|
|
413
|
-
"$ref": "#/definitions/TSWhereString"
|
|
414
|
-
}
|
|
415
|
-
},
|
|
416
|
-
"title": "TSWhereGenreRelationship"
|
|
417
|
-
},
|
|
418
|
-
"TSWhereBookInput": {
|
|
419
|
-
"type": "object",
|
|
420
|
-
"properties": {
|
|
421
|
-
"author": {
|
|
422
|
-
"$ref": "#/definitions/TSWhereAuthorRelationship"
|
|
423
|
-
},
|
|
424
|
-
"coverImage": {
|
|
425
|
-
"$ref": "#/definitions/TSWhereAssetRelationship"
|
|
426
|
-
},
|
|
427
|
-
"genre": {
|
|
428
|
-
"$ref": "#/definitions/TSWhereGenreRelationship"
|
|
429
|
-
},
|
|
430
|
-
"publishDate": {
|
|
431
|
-
"$ref": "#/definitions/TSWhereDate"
|
|
432
|
-
},
|
|
433
|
-
"totalPages": {
|
|
434
|
-
"$ref": "#/definitions/TSWhereInteger"
|
|
435
|
-
},
|
|
436
|
-
"title": {
|
|
437
|
-
"$ref": "#/definitions/TSWhereString"
|
|
438
|
-
},
|
|
439
|
-
"type": {
|
|
440
|
-
"$ref": "#/definitions/TSWhereString"
|
|
441
|
-
},
|
|
442
|
-
"body": {
|
|
443
|
-
"$ref": "#/definitions/TSWhereDraftjs"
|
|
444
|
-
},
|
|
445
|
-
"_id": {
|
|
446
|
-
"$ref": "#/definitions/TSWhereID"
|
|
447
|
-
},
|
|
448
|
-
"_shapeId": {
|
|
449
|
-
"type": "string",
|
|
450
|
-
"enum": ["TSWhereBookInput"]
|
|
451
|
-
},
|
|
452
|
-
"_version": {
|
|
453
|
-
"$ref": "#/definitions/TSWhereInteger"
|
|
454
|
-
},
|
|
455
|
-
"_shapeName": {
|
|
456
|
-
"$ref": "#/definitions/TSWhereString"
|
|
457
|
-
},
|
|
458
|
-
"_createdAt": {
|
|
459
|
-
"$ref": "#/definitions/TSWhereDate"
|
|
460
|
-
},
|
|
461
|
-
"_updatedAt": {
|
|
462
|
-
"$ref": "#/definitions/TSWhereDate"
|
|
463
|
-
},
|
|
464
|
-
"_schemaVersion": {
|
|
465
|
-
"$ref": "#/definitions/TSWhereNumber"
|
|
466
|
-
},
|
|
467
|
-
"_status": {
|
|
468
|
-
"$ref": "#/definitions/TSWhereWorkflow"
|
|
469
|
-
},
|
|
470
|
-
"_contentTypeId": {
|
|
471
|
-
"$ref": "#/definitions/TSWhereID"
|
|
472
|
-
},
|
|
473
|
-
"_contentTypeName": {
|
|
474
|
-
"$ref": "#/definitions/TSWhereString"
|
|
475
|
-
},
|
|
476
|
-
"AND": {
|
|
477
|
-
"type": "array",
|
|
478
|
-
"items": {
|
|
479
|
-
"$ref": "#/definitions/TSWhereBookInput"
|
|
480
|
-
}
|
|
481
|
-
},
|
|
482
|
-
"OR": {
|
|
483
|
-
"type": "array",
|
|
484
|
-
"items": {
|
|
485
|
-
"$ref": "#/definitions/TSWhereBookInput"
|
|
486
|
-
}
|
|
487
|
-
},
|
|
488
|
-
"NOT": {
|
|
489
|
-
"$ref": "#/definitions/TSWhereBookInput"
|
|
490
|
-
}
|
|
491
|
-
},
|
|
492
|
-
"title": "TSWhereBookInput"
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { getReferenceMap } from "../references.js";
|
|
3
|
-
describe('getReferenceMap', () => {
|
|
4
|
-
it('should return an empty map when no definitions are provided', () => {
|
|
5
|
-
const definitions = {};
|
|
6
|
-
const result = getReferenceMap(definitions);
|
|
7
|
-
expect(result.size).toBe(0);
|
|
8
|
-
});
|
|
9
|
-
it('should collect references from property schemas', () => {
|
|
10
|
-
const definitions = {
|
|
11
|
-
A: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
b: { $ref: '#/definitions/B' }
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
B: {
|
|
18
|
-
type: 'object',
|
|
19
|
-
properties: {}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const result = getReferenceMap(definitions);
|
|
23
|
-
expect(result.get('A')).toEqual(new Set(['B']));
|
|
24
|
-
});
|
|
25
|
-
it('should collect references from allOf schemas', () => {
|
|
26
|
-
const definitions = {
|
|
27
|
-
A: {
|
|
28
|
-
allOf: [{ $ref: '#/definitions/B' }]
|
|
29
|
-
},
|
|
30
|
-
B: {
|
|
31
|
-
type: 'object',
|
|
32
|
-
properties: {}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const result = getReferenceMap(definitions);
|
|
36
|
-
expect(result.get('A')).toEqual(new Set(['B']));
|
|
37
|
-
});
|
|
38
|
-
it('should collect references from anyOf schemas', () => {
|
|
39
|
-
const definitions = {
|
|
40
|
-
A: {
|
|
41
|
-
anyOf: [{ $ref: '#/definitions/B' }]
|
|
42
|
-
},
|
|
43
|
-
B: {
|
|
44
|
-
type: 'object',
|
|
45
|
-
properties: {}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const result = getReferenceMap(definitions);
|
|
49
|
-
expect(result.get('A')).toEqual(new Set(['B']));
|
|
50
|
-
});
|
|
51
|
-
it('should collect references from oneOf schemas', () => {
|
|
52
|
-
const definitions = {
|
|
53
|
-
A: {
|
|
54
|
-
oneOf: [{ $ref: '#/definitions/B' }]
|
|
55
|
-
},
|
|
56
|
-
B: {
|
|
57
|
-
type: 'object',
|
|
58
|
-
properties: {}
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const result = getReferenceMap(definitions);
|
|
62
|
-
expect(result.get('A')).toEqual(new Set(['B']));
|
|
63
|
-
});
|
|
64
|
-
it('should collect references from items schemas', () => {
|
|
65
|
-
const definitions = {
|
|
66
|
-
A: {
|
|
67
|
-
type: 'array',
|
|
68
|
-
items: { $ref: '#/definitions/B' }
|
|
69
|
-
},
|
|
70
|
-
B: {
|
|
71
|
-
type: 'object',
|
|
72
|
-
properties: {}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
const result = getReferenceMap(definitions);
|
|
76
|
-
expect(result.get('A')).toEqual(new Set(['B']));
|
|
77
|
-
});
|
|
78
|
-
it('should handle circular references', () => {
|
|
79
|
-
const definitions = {
|
|
80
|
-
A: {
|
|
81
|
-
$ref: '#/definitions/B'
|
|
82
|
-
},
|
|
83
|
-
B: {
|
|
84
|
-
$ref: '#/definitions/A'
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
const result = getReferenceMap(definitions);
|
|
88
|
-
expect(result.get('A')).toEqual(new Set(['B']));
|
|
89
|
-
expect(result.get('B')).toEqual(new Set(['A']));
|
|
90
|
-
});
|
|
91
|
-
it('should handle deeply nested references', () => {
|
|
92
|
-
const definitions = {
|
|
93
|
-
Z: {
|
|
94
|
-
type: 'string'
|
|
95
|
-
},
|
|
96
|
-
A: {
|
|
97
|
-
type: 'object',
|
|
98
|
-
properties: {
|
|
99
|
-
Z: {
|
|
100
|
-
$ref: '#/definitions/Z'
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
B: {
|
|
105
|
-
type: 'object',
|
|
106
|
-
properties: {
|
|
107
|
-
C: {
|
|
108
|
-
type: 'object',
|
|
109
|
-
properties: {
|
|
110
|
-
D: {
|
|
111
|
-
$ref: '#/definitions/A'
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
const result = getReferenceMap(definitions);
|
|
119
|
-
expect(result.get('B')).toEqual(new Set(['A', 'Z']));
|
|
120
|
-
});
|
|
121
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|