@hyperjump/json-schema 1.6.7 → 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 (104) 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 +112 -156
  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 +27 -14
  75. package/lib/openapi.js +19 -6
  76. package/lib/schema.js +236 -227
  77. package/openapi-3-0/index.js +5 -5
  78. package/openapi-3-0/type.js +13 -7
  79. package/openapi-3-1/index.js +22 -21
  80. package/openapi-3-1/{schema-base/2022-10-07.js → schema-base.js} +12 -2
  81. package/openapi-3-1/schema-draft-04.js +33 -0
  82. package/openapi-3-1/schema-draft-06.js +33 -0
  83. package/openapi-3-1/schema-draft-07.js +33 -0
  84. package/openapi-3-1/schema-draft-2019-09.js +33 -0
  85. package/openapi-3-1/schema-draft-2020-12.js +33 -0
  86. package/package.json +11 -11
  87. package/stable/index.js +10 -10
  88. package/annotations/validation-error.d.ts +0 -8
  89. package/draft-2019-09/contains.js +0 -44
  90. package/lib/configuration.d.ts +0 -9
  91. package/lib/context-uri.browser.js +0 -1
  92. package/lib/context-uri.js +0 -4
  93. package/lib/core.d.ts +0 -48
  94. package/lib/fetch.browser.js +0 -1
  95. package/lib/fetch.js +0 -20
  96. package/lib/invalid-schema-error.d.ts +0 -8
  97. package/lib/keywords.d.ts +0 -19
  98. package/lib/media-types.d.ts +0 -11
  99. package/lib/media-types.js +0 -48
  100. package/lib/reference.d.ts +0 -11
  101. package/lib/reference.js +0 -11
  102. package/lib/schema.d.ts +0 -60
  103. /package/openapi-3-0/{schema/2021-09-28.js → schema.js} +0 -0
  104. /package/openapi-3-1/{schema/2022-10-07.js → schema.js} +0 -0
package/lib/schema.d.ts DELETED
@@ -1,60 +0,0 @@
1
- import type { JsonType } from "./common.js";
2
-
3
-
4
- export const add: <A extends SchemaObject | boolean>(schema: A, retrievalUri?: string, defaultSchemaVersion?: string) => string;
5
- export const get: (url: string, context?: SchemaDocument) => Promise<SchemaDocument>;
6
- export const markValidated: (id: string) => void;
7
- export const uri: (doc: SchemaDocument) => string;
8
- export const value: <A extends SchemaFragment>(doc: SchemaDocument<A>) => A;
9
- export const typeOf: (
10
- (doc: SchemaDocument, type: "null") => doc is SchemaDocument<null>
11
- ) & (
12
- (doc: SchemaDocument, type: "boolean") => doc is SchemaDocument<boolean>
13
- ) & (
14
- (doc: SchemaDocument, type: "object") => doc is SchemaDocument<SchemaObject>
15
- ) & (
16
- (doc: SchemaDocument, type: "array") => doc is SchemaDocument<SchemaFragment[]>
17
- ) & (
18
- (doc: SchemaDocument, type: "number" | "integer") => doc is SchemaDocument<number>
19
- ) & (
20
- (doc: SchemaDocument, type: "string") => doc is SchemaDocument<string>
21
- ) & (
22
- (doc: SchemaDocument, type: JsonType) => boolean
23
- ) & (
24
- (doc: SchemaDocument) => (type: JsonType) => boolean
25
- );
26
- export const has: (key: string, doc: SchemaDocument) => boolean;
27
- export const step: (key: string, doc: SchemaDocument) => Promise<SchemaDocument>;
28
- export const iter: (doc: SchemaDocument) => AsyncGenerator<SchemaDocument>;
29
- export const keys: (doc: SchemaDocument) => Generator<string>;
30
- export const values: (doc: SchemaDocument) => AsyncGenerator<string>;
31
- export const entries: (doc: SchemaDocument) => AsyncGenerator<[string, SchemaDocument]>;
32
- export const length: (doc: SchemaDocument) => number;
33
- export const toSchema: (doc: SchemaDocument, options: ToSchemaOptions) => SchemaObject;
34
-
35
- type MapFn<A> = (element: SchemaDocument, index: number) => A;
36
-
37
- export type ToSchemaOptions = {
38
- parentId?: string;
39
- parentDialect?: string;
40
- includeEmbedded?: boolean;
41
- };
42
-
43
- export type SchemaDocument<A extends SchemaFragment = SchemaFragment> = {
44
- id: string;
45
- dialectId: string;
46
- pointer: string;
47
- schema: SchemaObject;
48
- value: A;
49
- anchors: Anchors;
50
- dynamicAnchors: Anchors;
51
- vocabulary: Record<string, boolean>;
52
- validated: boolean;
53
- };
54
-
55
- export type SchemaFragment = string | number | boolean | null | SchemaObject | SchemaFragment[];
56
- export type SchemaObject = { // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
57
- [keyword: string]: SchemaFragment;
58
- };
59
-
60
- export type Anchors = Record<string, string>;
File without changes
File without changes