@hyperjump/json-schema 1.6.6 → 1.7.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.
Files changed (114) hide show
  1. package/README.md +247 -255
  2. package/annotations/annotated-instance.js +3 -3
  3. package/annotations/index.d.ts +7 -1
  4. package/annotations/index.js +3 -3
  5. package/bundle/index.d.ts +1 -5
  6. package/bundle/index.js +125 -121
  7. package/draft-04/additionalItems.js +6 -7
  8. package/draft-04/dependencies.js +5 -5
  9. package/draft-04/index.js +2 -2
  10. package/draft-04/items.js +5 -5
  11. package/draft-04/maximum.js +8 -8
  12. package/draft-04/minimum.js +8 -8
  13. package/draft-06/contains.js +2 -2
  14. package/draft-06/index.js +3 -2
  15. package/draft-07/index.js +3 -2
  16. package/draft-2019-09/index.js +9 -11
  17. package/draft-2020-12/dynamicRef.js +5 -5
  18. package/draft-2020-12/index.js +11 -13
  19. package/lib/common.d.ts +1 -1
  20. package/lib/common.js +44 -60
  21. package/lib/configuration.js +0 -6
  22. package/lib/core.js +32 -30
  23. package/lib/experimental.d.ts +75 -5
  24. package/lib/experimental.js +2 -2
  25. package/lib/index.d.ts +43 -11
  26. package/lib/index.js +11 -11
  27. package/lib/instance.d.ts +1 -17
  28. package/lib/instance.js +3 -3
  29. package/lib/keywords/additionalProperties.js +12 -13
  30. package/lib/keywords/allOf.js +3 -3
  31. package/lib/keywords/anyOf.js +3 -3
  32. package/lib/keywords/conditional.js +6 -7
  33. package/lib/keywords/const.js +2 -2
  34. package/lib/keywords/contains.js +14 -35
  35. package/lib/keywords/contentSchema.js +1 -1
  36. package/lib/keywords/definitions.js +2 -2
  37. package/lib/keywords/dependentRequired.js +4 -4
  38. package/lib/keywords/dependentSchemas.js +5 -5
  39. package/lib/keywords/dynamicRef.js +10 -5
  40. package/lib/keywords/else.js +5 -6
  41. package/lib/keywords/enum.js +4 -4
  42. package/lib/keywords/exclusiveMaximum.js +3 -3
  43. package/lib/keywords/exclusiveMinimum.js +3 -3
  44. package/lib/keywords/if.js +1 -1
  45. package/lib/keywords/itemPattern.js +17 -14
  46. package/lib/keywords/items.js +6 -7
  47. package/lib/keywords/maxItems.js +3 -3
  48. package/lib/keywords/maxLength.js +3 -3
  49. package/lib/keywords/maxProperties.js +3 -3
  50. package/lib/keywords/maximum.js +3 -3
  51. package/lib/keywords/meta-data.js +1 -1
  52. package/lib/keywords/minItems.js +3 -3
  53. package/lib/keywords/minLength.js +3 -3
  54. package/lib/keywords/minProperties.js +3 -3
  55. package/lib/keywords/minimum.js +3 -3
  56. package/lib/keywords/multipleOf.js +3 -3
  57. package/lib/keywords/not.js +1 -1
  58. package/lib/keywords/oneOf.js +3 -3
  59. package/lib/keywords/pattern.js +3 -3
  60. package/lib/keywords/patternProperties.js +5 -5
  61. package/lib/keywords/prefixItems.js +5 -5
  62. package/lib/keywords/properties.js +5 -5
  63. package/lib/keywords/propertyDependencies.js +6 -7
  64. package/lib/keywords/propertyNames.js +2 -2
  65. package/lib/keywords/ref.js +2 -7
  66. package/lib/keywords/requireAllExcept.js +8 -9
  67. package/lib/keywords/required.js +3 -3
  68. package/lib/keywords/then.js +5 -5
  69. package/lib/keywords/type.js +9 -3
  70. package/lib/keywords/unevaluatedItems.js +4 -4
  71. package/lib/keywords/unevaluatedProperties.js +4 -5
  72. package/lib/keywords/uniqueItems.js +3 -3
  73. package/lib/keywords/validation.js +11 -23
  74. package/lib/keywords.js +30 -4
  75. package/lib/openapi.js +19 -6
  76. package/lib/schema.js +235 -233
  77. package/openapi-3-0/index.js +5 -5
  78. package/openapi-3-0/type.js +13 -7
  79. package/openapi-3-1/index.d.ts +1 -1
  80. package/openapi-3-1/index.js +22 -21
  81. package/openapi-3-1/{schema-base/2022-10-07.js → schema-base.js} +12 -2
  82. package/openapi-3-1/schema-draft-04.js +33 -0
  83. package/openapi-3-1/schema-draft-06.js +33 -0
  84. package/openapi-3-1/schema-draft-07.js +33 -0
  85. package/openapi-3-1/schema-draft-2019-09.js +33 -0
  86. package/openapi-3-1/schema-draft-2020-12.js +33 -0
  87. package/package.json +14 -16
  88. package/stable/index.js +10 -10
  89. package/annotations/tests/applicators.json +0 -375
  90. package/annotations/tests/content.json +0 -57
  91. package/annotations/tests/core.json +0 -33
  92. package/annotations/tests/format.json +0 -20
  93. package/annotations/tests/meta-data.json +0 -128
  94. package/annotations/tests/unevaluated.json +0 -557
  95. package/annotations/tests/unknown.json +0 -87
  96. package/annotations/tests/validation.json +0 -328
  97. package/annotations/validation-error.d.ts +0 -8
  98. package/bundle/file.json +0 -57
  99. package/draft-2019-09/contains.js +0 -44
  100. package/lib/configuration.d.ts +0 -9
  101. package/lib/context-uri.browser.js +0 -1
  102. package/lib/context-uri.js +0 -4
  103. package/lib/core.d.ts +0 -48
  104. package/lib/fetch.browser.js +0 -1
  105. package/lib/fetch.js +0 -20
  106. package/lib/invalid-schema-error.d.ts +0 -8
  107. package/lib/keywords.d.ts +0 -19
  108. package/lib/media-types.d.ts +0 -11
  109. package/lib/media-types.js +0 -48
  110. package/lib/reference.d.ts +0 -11
  111. package/lib/reference.js +0 -11
  112. package/lib/schema.d.ts +0 -60
  113. /package/openapi-3-0/{schema/2021-09-28.js → schema.js} +0 -0
  114. /package/openapi-3-1/{schema/2022-10-07.js → schema.js} +0 -0
@@ -1,557 +0,0 @@
1
- [
2
- {
3
- "title": "`unevaluatedProperties` alone",
4
- "schema": {
5
- "unevaluatedProperties": { "title": "Unevaluated" }
6
- },
7
- "subjects": [
8
- {
9
- "instance": { "foo": 42, "bar": 24 },
10
- "assertions": [
11
- {
12
- "location": "#/foo",
13
- "keyword": "title",
14
- "expected": ["Unevaluated"]
15
- },
16
- {
17
- "location": "#/bar",
18
- "keyword": "title",
19
- "expected": ["Unevaluated"]
20
- }
21
- ]
22
- }
23
- ]
24
- },
25
- {
26
- "title": "`unevaluatedProperties` with `properties`",
27
- "schema": {
28
- "properties": {
29
- "foo": { "title": "Evaluated" }
30
- },
31
- "unevaluatedProperties": { "title": "Unevaluated" }
32
- },
33
- "subjects": [
34
- {
35
- "instance": { "foo": 42, "bar": 24 },
36
- "assertions": [
37
- {
38
- "location": "#/foo",
39
- "keyword": "title",
40
- "expected": ["Evaluated"]
41
- },
42
- {
43
- "location": "#/bar",
44
- "keyword": "title",
45
- "expected": ["Unevaluated"]
46
- }
47
- ]
48
- }
49
- ]
50
- },
51
- {
52
- "title": "`unevaluatedProperties` with `patternProperties`",
53
- "schema": {
54
- "patternProperties": {
55
- "^a": { "title": "Evaluated" }
56
- },
57
- "unevaluatedProperties": { "title": "Unevaluated" }
58
- },
59
- "subjects": [
60
- {
61
- "instance": { "apple": 42, "bar": 24 },
62
- "assertions": [
63
- {
64
- "location": "#/apple",
65
- "keyword": "title",
66
- "expected": ["Evaluated"]
67
- },
68
- {
69
- "location": "#/bar",
70
- "keyword": "title",
71
- "expected": ["Unevaluated"]
72
- }
73
- ]
74
- }
75
- ]
76
- },
77
- {
78
- "title": "`unevaluatedProperties` with `additionalProperties`",
79
- "schema": {
80
- "additionalProperties": { "title": "Evaluated" },
81
- "unevaluatedProperties": { "title": "Unevaluated" }
82
- },
83
- "subjects": [
84
- {
85
- "instance": { "foo": 42, "bar": 24 },
86
- "assertions": [
87
- {
88
- "location": "#/foo",
89
- "keyword": "title",
90
- "expected": ["Evaluated"]
91
- },
92
- {
93
- "location": "#/bar",
94
- "keyword": "title",
95
- "expected": ["Evaluated"]
96
- }
97
- ]
98
- }
99
- ]
100
- },
101
- {
102
- "title": "`unevaluatedProperties` with `dependentSchemas`",
103
- "schema": {
104
- "dependentSchemas": {
105
- "foo": {
106
- "properties": {
107
- "bar": { "title": "Evaluated" }
108
- }
109
- }
110
- },
111
- "unevaluatedProperties": { "title": "Unevaluated" }
112
- },
113
- "subjects": [
114
- {
115
- "instance": { "foo": 42, "bar": 24 },
116
- "assertions": [
117
- {
118
- "location": "#/foo",
119
- "keyword": "title",
120
- "expected": ["Unevaluated"]
121
- },
122
- {
123
- "location": "#/bar",
124
- "keyword": "title",
125
- "expected": ["Evaluated"]
126
- }
127
- ]
128
- }
129
- ]
130
- },
131
- {
132
- "title": "`unevaluatedProperties` with `if`, `then`, and `else`",
133
- "schema": {
134
- "if": {
135
- "properties": {
136
- "foo": {
137
- "type": "string",
138
- "title": "If"
139
- }
140
- }
141
- },
142
- "then": {
143
- "properties": {
144
- "foo": { "title": "Then" }
145
- }
146
- },
147
- "else": {
148
- "properties": {
149
- "foo": { "title": "Else" }
150
- }
151
- },
152
- "unevaluatedProperties": { "title": "Unevaluated" }
153
- },
154
- "subjects": [
155
- {
156
- "instance": { "foo": "", "bar": 42 },
157
- "assertions": [
158
- {
159
- "location": "#/foo",
160
- "keyword": "title",
161
- "expected": ["Then", "If"]
162
- },
163
- {
164
- "location": "#/bar",
165
- "keyword": "title",
166
- "expected": ["Unevaluated"]
167
- }
168
- ]
169
- },
170
- {
171
- "instance": { "foo": 42, "bar": "" },
172
- "assertions": [
173
- {
174
- "location": "#/foo",
175
- "keyword": "title",
176
- "expected": ["Else"]
177
- },
178
- {
179
- "location": "#/bar",
180
- "keyword": "title",
181
- "expected": ["Unevaluated"]
182
- }
183
- ]
184
- }
185
- ]
186
- },
187
- {
188
- "title": "`unevaluatedProperties` with `allOf`",
189
- "schema": {
190
- "allOf": [
191
- {
192
- "properties": {
193
- "foo": { "title": "Evaluated" }
194
- }
195
- }
196
- ],
197
- "unevaluatedProperties": { "title": "Unevaluated" }
198
- },
199
- "subjects": [
200
- {
201
- "instance": { "foo": 42, "bar": 24 },
202
- "assertions": [
203
- {
204
- "location": "#/foo",
205
- "keyword": "title",
206
- "expected": ["Evaluated"]
207
- },
208
- {
209
- "location": "#/bar",
210
- "keyword": "title",
211
- "expected": ["Unevaluated"]
212
- }
213
- ]
214
- }
215
- ]
216
- },
217
- {
218
- "title": "`unevaluatedProperties` with `anyOf`",
219
- "schema": {
220
- "anyOf": [
221
- {
222
- "properties": {
223
- "foo": { "title": "Evaluated" }
224
- }
225
- }
226
- ],
227
- "unevaluatedProperties": { "title": "Unevaluated" }
228
- },
229
- "subjects": [
230
- {
231
- "instance": { "foo": 42, "bar": 24 },
232
- "assertions": [
233
- {
234
- "location": "#/foo",
235
- "keyword": "title",
236
- "expected": ["Evaluated"]
237
- },
238
- {
239
- "location": "#/bar",
240
- "keyword": "title",
241
- "expected": ["Unevaluated"]
242
- }
243
- ]
244
- }
245
- ]
246
- },
247
- {
248
- "title": "`unevaluatedProperties` with `oneOf`",
249
- "schema": {
250
- "oneOf": [
251
- {
252
- "properties": {
253
- "foo": { "title": "Evaluated" }
254
- }
255
- }
256
- ],
257
- "unevaluatedProperties": { "title": "Unevaluated" }
258
- },
259
- "subjects": [
260
- {
261
- "instance": { "foo": 42, "bar": 24 },
262
- "assertions": [
263
- {
264
- "location": "#/foo",
265
- "keyword": "title",
266
- "expected": ["Evaluated"]
267
- },
268
- {
269
- "location": "#/bar",
270
- "keyword": "title",
271
- "expected": ["Unevaluated"]
272
- }
273
- ]
274
- }
275
- ]
276
- },
277
- {
278
- "title": "`unevaluatedProperties` with `not`",
279
- "schema": {
280
- "not": {
281
- "not": {
282
- "properties": {
283
- "foo": { "title": "Evaluated" }
284
- }
285
- }
286
- },
287
- "unevaluatedProperties": { "title": "Unevaluated" }
288
- },
289
- "subjects": [
290
- {
291
- "instance": { "foo": 42, "bar": 24 },
292
- "assertions": [
293
- {
294
- "location": "#/foo",
295
- "keyword": "title",
296
- "expected": ["Unevaluated"]
297
- },
298
- {
299
- "location": "#/bar",
300
- "keyword": "title",
301
- "expected": ["Unevaluated"]
302
- }
303
- ]
304
- }
305
- ]
306
- },
307
- {
308
- "title": "`unevaluatedItems` alone",
309
- "schema": {
310
- "unevaluatedItems": { "title": "Unevaluated" }
311
- },
312
- "subjects": [
313
- {
314
- "instance": [42, 24],
315
- "assertions": [
316
- {
317
- "location": "#/0",
318
- "keyword": "title",
319
- "expected": ["Unevaluated"]
320
- },
321
- {
322
- "location": "#/1",
323
- "keyword": "title",
324
- "expected": ["Unevaluated"]
325
- }
326
- ]
327
- }
328
- ]
329
- },
330
- {
331
- "title": "`unevaluatedItems` with `prefixItems`",
332
- "schema": {
333
- "prefixItems": [{ "title": "Evaluated" }],
334
- "unevaluatedItems": { "title": "Unevaluated" }
335
- },
336
- "subjects": [
337
- {
338
- "instance": [42, 24],
339
- "assertions": [
340
- {
341
- "location": "#/0",
342
- "keyword": "title",
343
- "expected": ["Evaluated"]
344
- },
345
- {
346
- "location": "#/1",
347
- "keyword": "title",
348
- "expected": ["Unevaluated"]
349
- }
350
- ]
351
- }
352
- ]
353
- },
354
- {
355
- "title": "`unevaluatedItems` with `contains`",
356
- "schema": {
357
- "contains": {
358
- "type": "string",
359
- "title": "Evaluated"
360
- },
361
- "unevaluatedItems": { "title": "Unevaluated" }
362
- },
363
- "subjects": [
364
- {
365
- "instance": ["foo", 42],
366
- "assertions": [
367
- {
368
- "location": "#/0",
369
- "keyword": "title",
370
- "expected": ["Evaluated"]
371
- },
372
- {
373
- "location": "#/1",
374
- "keyword": "title",
375
- "expected": ["Unevaluated"]
376
- }
377
- ]
378
- }
379
- ]
380
- },
381
- {
382
- "title": "`unevaluatedItems` with `if`, `then`, and `else`",
383
- "schema": {
384
- "if": {
385
- "prefixItems": [
386
- {
387
- "type": "string",
388
- "title": "If"
389
- }
390
- ]
391
- },
392
- "then": {
393
- "prefixItems": [
394
- { "title": "Then" }
395
- ]
396
- },
397
- "else": {
398
- "prefixItems": [
399
- { "title": "Else" }
400
- ]
401
- },
402
- "unevaluatedItems": { "title": "Unevaluated" }
403
- },
404
- "subjects": [
405
- {
406
- "instance": ["", 42],
407
- "assertions": [
408
- {
409
- "location": "#/0",
410
- "keyword": "title",
411
- "expected": ["Then", "If"]
412
- },
413
- {
414
- "location": "#/1",
415
- "keyword": "title",
416
- "expected": ["Unevaluated"]
417
- }
418
- ]
419
- },
420
- {
421
- "instance": [42, ""],
422
- "assertions": [
423
- {
424
- "location": "#/0",
425
- "keyword": "title",
426
- "expected": ["Else"]
427
- },
428
- {
429
- "location": "#/1",
430
- "keyword": "title",
431
- "expected": ["Unevaluated"]
432
- }
433
- ]
434
- }
435
- ]
436
- },
437
- {
438
- "title": "`unevaluatedItems` with `allOf`",
439
- "schema": {
440
- "allOf": [
441
- {
442
- "prefixItems": [
443
- { "title": "Evaluated" }
444
- ]
445
- }
446
- ],
447
- "unevaluatedItems": { "title": "Unevaluated" }
448
- },
449
- "subjects": [
450
- {
451
- "instance": [42, 24],
452
- "assertions": [
453
- {
454
- "location": "#/0",
455
- "keyword": "title",
456
- "expected": ["Evaluated"]
457
- },
458
- {
459
- "location": "#/1",
460
- "keyword": "title",
461
- "expected": ["Unevaluated"]
462
- }
463
- ]
464
- }
465
- ]
466
- },
467
- {
468
- "title": "`unevaluatedItems` with `anyOf`",
469
- "schema": {
470
- "anyOf": [
471
- {
472
- "prefixItems": [
473
- { "title": "Evaluated" }
474
- ]
475
- }
476
- ],
477
- "unevaluatedItems": { "title": "Unevaluated" }
478
- },
479
- "subjects": [
480
- {
481
- "instance": [42, 24],
482
- "assertions": [
483
- {
484
- "location": "#/0",
485
- "keyword": "title",
486
- "expected": ["Evaluated"]
487
- },
488
- {
489
- "location": "#/1",
490
- "keyword": "title",
491
- "expected": ["Unevaluated"]
492
- }
493
- ]
494
- }
495
- ]
496
- },
497
- {
498
- "title": "`unevaluatedItems` with `oneOf`",
499
- "schema": {
500
- "oneOf": [
501
- {
502
- "prefixItems": [
503
- { "title": "Evaluated" }
504
- ]
505
- }
506
- ],
507
- "unevaluatedItems": { "title": "Unevaluated" }
508
- },
509
- "subjects": [
510
- {
511
- "instance": [42, 24],
512
- "assertions": [
513
- {
514
- "location": "#/0",
515
- "keyword": "title",
516
- "expected": ["Evaluated"]
517
- },
518
- {
519
- "location": "#/1",
520
- "keyword": "title",
521
- "expected": ["Unevaluated"]
522
- }
523
- ]
524
- }
525
- ]
526
- },
527
- {
528
- "title": "`unevaluatedItems` with `not`",
529
- "schema": {
530
- "not": {
531
- "not": {
532
- "prefixItems": [
533
- { "title": "Evaluated" }
534
- ]
535
- }
536
- },
537
- "unevaluatedItems": { "title": "Unevaluated" }
538
- },
539
- "subjects": [
540
- {
541
- "instance": [42, 24],
542
- "assertions": [
543
- {
544
- "location": "#/0",
545
- "keyword": "title",
546
- "expected": ["Unevaluated"]
547
- },
548
- {
549
- "location": "#/1",
550
- "keyword": "title",
551
- "expected": ["Unevaluated"]
552
- }
553
- ]
554
- }
555
- ]
556
- }
557
- ]
@@ -1,87 +0,0 @@
1
- [
2
- {
3
- "title": "Unknown keywords are not annotations in draft-04",
4
- "schema": {
5
- "$schema": "http://json-schema.org/draft-04/schema#",
6
- "unknown": "Foo"
7
- },
8
- "subjects": [
9
- {
10
- "instance": 42,
11
- "assertions": [
12
- {
13
- "location": "#",
14
- "keyword": "unknown",
15
- "expected": []
16
- }
17
- ]
18
- }
19
- ]
20
- },
21
- {
22
- "title": "Unknown keywords are not annotations in draft-06",
23
- "schema": {
24
- "$schema": "http://json-schema.org/draft-06/schema#",
25
- "unknown": "Foo"
26
- },
27
- "subjects": [
28
- {
29
- "instance": 42,
30
- "assertions": [
31
- {
32
- "location": "#",
33
- "keyword": "unknown",
34
- "expected": []
35
- }
36
- ]
37
- }
38
- ]
39
- },
40
- {
41
- "title": "Unknown keywords are not annotations in draft-07",
42
- "schema": {
43
- "$schema": "http://json-schema.org/draft-07/schema#",
44
- "unknown": "Foo"
45
- },
46
- "subjects": [
47
- {
48
- "instance": 42,
49
- "assertions": [
50
- {
51
- "location": "#",
52
- "keyword": "unknown",
53
- "expected": []
54
- }
55
- ]
56
- }
57
- ]
58
- },
59
- {
60
- "title": "Unknown keywords may or may not be annotations in 2019-09",
61
- "schema": {
62
- "$schema": "https://json-schema.org/draft/2019-09/schema",
63
- "unknown": "Foo"
64
- },
65
- "$comment": "'subjects' is intentionally left empty",
66
- "subjects": []
67
- },
68
- {
69
- "title": "Unknown keywords are annotations in 2020-12",
70
- "schema": {
71
- "$schema": "https://json-schema.org/draft/2020-12/schema",
72
- "unknown": "Foo"
73
- },
74
- "subjects": [
75
- {
76
- "instance": 42,
77
- "assertions": [
78
- {
79
- "location": "#",
80
- "keyword": "unknown",
81
- "expected": ["Foo"]
82
- }
83
- ]
84
- }
85
- ]
86
- }
87
- ]