@depup/typebox 1.3.27-depup.0 → 1.3.34-depup.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 (150) hide show
  1. package/README.md +2 -2
  2. package/build/compile/code.mjs +1 -2
  3. package/build/compile/validator.mjs +5 -1
  4. package/build/format/iri.mjs +16 -9
  5. package/build/guard/emit.mjs +2 -2
  6. package/build/guard/guard.d.mts +7 -5
  7. package/build/guard/guard.mjs +14 -9
  8. package/build/guard/index.mjs +6 -0
  9. package/build/guard/unicode/unicode.d.mts +6 -0
  10. package/build/guard/unicode/unicode.mjs +35 -0
  11. package/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
  12. package/build/schema/build.mjs +4 -5
  13. package/build/schema/check.mjs +1 -1
  14. package/build/schema/engine/_context.d.mts +5 -1
  15. package/build/schema/engine/_context.mjs +16 -3
  16. package/build/schema/engine/_functions.d.mts +2 -2
  17. package/build/schema/engine/_functions.mjs +1 -1
  18. package/build/schema/engine/_pathing.d.mts +1 -0
  19. package/build/schema/engine/_pathing.mjs +11 -0
  20. package/build/schema/engine/_reducer.d.mts +3 -3
  21. package/build/schema/engine/_refine.d.mts +5 -5
  22. package/build/schema/engine/_refine.mjs +14 -9
  23. package/build/schema/engine/_stack.d.mts +34 -20
  24. package/build/schema/engine/_stack.mjs +143 -202
  25. package/build/schema/engine/additionalItems.d.mts +4 -4
  26. package/build/schema/engine/additionalProperties.d.mts +8 -8
  27. package/build/schema/engine/additionalProperties.mjs +12 -15
  28. package/build/schema/engine/allOf.d.mts +4 -4
  29. package/build/schema/engine/allOf.mjs +1 -1
  30. package/build/schema/engine/anyOf.d.mts +4 -4
  31. package/build/schema/engine/anyOf.mjs +4 -9
  32. package/build/schema/engine/boolean.d.mts +4 -4
  33. package/build/schema/engine/boolean.mjs +2 -6
  34. package/build/schema/engine/const.d.mts +4 -4
  35. package/build/schema/engine/const.mjs +2 -6
  36. package/build/schema/engine/contains.d.mts +4 -4
  37. package/build/schema/engine/contains.mjs +2 -6
  38. package/build/schema/engine/dependencies.d.mts +4 -4
  39. package/build/schema/engine/dependencies.mjs +5 -7
  40. package/build/schema/engine/dependentRequired.d.mts +4 -4
  41. package/build/schema/engine/dependentRequired.mjs +2 -6
  42. package/build/schema/engine/dependentSchemas.d.mts +4 -4
  43. package/build/schema/engine/dependentSchemas.mjs +2 -1
  44. package/build/schema/engine/dynamicRef.d.mts +4 -4
  45. package/build/schema/engine/dynamicRef.mjs +12 -8
  46. package/build/schema/engine/enum.d.mts +4 -4
  47. package/build/schema/engine/enum.mjs +2 -6
  48. package/build/schema/engine/exclusiveMaximum.d.mts +4 -4
  49. package/build/schema/engine/exclusiveMaximum.mjs +2 -6
  50. package/build/schema/engine/exclusiveMinimum.d.mts +4 -4
  51. package/build/schema/engine/exclusiveMinimum.mjs +2 -6
  52. package/build/schema/engine/format.d.mts +4 -4
  53. package/build/schema/engine/format.mjs +11 -8
  54. package/build/schema/engine/if.d.mts +4 -4
  55. package/build/schema/engine/if.mjs +5 -13
  56. package/build/schema/engine/items.d.mts +4 -4
  57. package/build/schema/engine/items.mjs +1 -1
  58. package/build/schema/engine/maxContains.d.mts +4 -4
  59. package/build/schema/engine/maxContains.mjs +2 -6
  60. package/build/schema/engine/maxItems.d.mts +4 -4
  61. package/build/schema/engine/maxItems.mjs +2 -6
  62. package/build/schema/engine/maxLength.d.mts +4 -4
  63. package/build/schema/engine/maxLength.mjs +2 -6
  64. package/build/schema/engine/maxProperties.d.mts +4 -4
  65. package/build/schema/engine/maxProperties.mjs +2 -6
  66. package/build/schema/engine/maximum.d.mts +4 -4
  67. package/build/schema/engine/maximum.mjs +2 -6
  68. package/build/schema/engine/minContains.d.mts +4 -4
  69. package/build/schema/engine/minContains.mjs +2 -6
  70. package/build/schema/engine/minItems.d.mts +5 -5
  71. package/build/schema/engine/minItems.mjs +2 -6
  72. package/build/schema/engine/minLength.d.mts +4 -4
  73. package/build/schema/engine/minLength.mjs +2 -6
  74. package/build/schema/engine/minProperties.d.mts +4 -4
  75. package/build/schema/engine/minProperties.mjs +2 -6
  76. package/build/schema/engine/minimum.d.mts +4 -4
  77. package/build/schema/engine/minimum.mjs +2 -6
  78. package/build/schema/engine/multipleOf.d.mts +4 -4
  79. package/build/schema/engine/multipleOf.mjs +2 -6
  80. package/build/schema/engine/not.d.mts +4 -4
  81. package/build/schema/engine/not.mjs +4 -8
  82. package/build/schema/engine/oneOf.d.mts +4 -4
  83. package/build/schema/engine/oneOf.mjs +5 -10
  84. package/build/schema/engine/pattern.d.mts +4 -4
  85. package/build/schema/engine/pattern.mjs +3 -7
  86. package/build/schema/engine/patternProperties.d.mts +4 -4
  87. package/build/schema/engine/patternProperties.mjs +4 -3
  88. package/build/schema/engine/prefixItems.d.mts +4 -4
  89. package/build/schema/engine/prefixItems.mjs +1 -1
  90. package/build/schema/engine/properties.d.mts +4 -4
  91. package/build/schema/engine/properties.mjs +4 -3
  92. package/build/schema/engine/propertyNames.d.mts +4 -4
  93. package/build/schema/engine/propertyNames.mjs +5 -8
  94. package/build/schema/engine/recursiveRef.d.mts +4 -4
  95. package/build/schema/engine/recursiveRef.mjs +12 -8
  96. package/build/schema/engine/ref.d.mts +4 -4
  97. package/build/schema/engine/ref.mjs +18 -14
  98. package/build/schema/engine/required.d.mts +4 -4
  99. package/build/schema/engine/required.mjs +2 -6
  100. package/build/schema/engine/schema.d.mts +7 -7
  101. package/build/schema/engine/schema.mjs +136 -138
  102. package/build/schema/engine/type.d.mts +4 -4
  103. package/build/schema/engine/type.mjs +2 -6
  104. package/build/schema/engine/unevaluatedItems.d.mts +4 -4
  105. package/build/schema/engine/unevaluatedItems.mjs +3 -7
  106. package/build/schema/engine/unevaluatedProperties.d.mts +4 -4
  107. package/build/schema/engine/unevaluatedProperties.mjs +3 -7
  108. package/build/schema/engine/uniqueItems.d.mts +4 -4
  109. package/build/schema/engine/uniqueItems.mjs +2 -6
  110. package/build/schema/errors.mjs +1 -1
  111. package/build/schema/intern/intern.d.mts +6 -9
  112. package/build/schema/intern/intern.mjs +90 -56
  113. package/build/schema/meta/draft_2019_09.d.mts +2 -0
  114. package/build/schema/meta/draft_2019_09.mjs +288 -0
  115. package/build/schema/meta/draft_2020_12.d.mts +2 -0
  116. package/build/schema/meta/draft_2020_12.mjs +300 -0
  117. package/build/schema/meta/draft_3.d.mts +2 -0
  118. package/build/schema/meta/draft_3.mjs +143 -0
  119. package/build/schema/meta/draft_4.d.mts +2 -0
  120. package/build/schema/meta/draft_4.mjs +149 -0
  121. package/build/schema/meta/draft_6.d.mts +2 -0
  122. package/build/schema/meta/draft_6.mjs +155 -0
  123. package/build/schema/meta/draft_7.d.mts +2 -0
  124. package/build/schema/meta/draft_7.mjs +172 -0
  125. package/build/schema/meta/index.d.mts +2 -0
  126. package/build/schema/meta/index.mjs +2 -0
  127. package/build/schema/meta/meta.d.mts +9 -0
  128. package/build/schema/meta/meta.mjs +15 -0
  129. package/build/schema/meta/schema.d.mts +6 -0
  130. package/build/schema/meta/schema.mjs +1 -0
  131. package/build/schema/parse.mjs +3 -0
  132. package/build/schema/pointer/pointer.d.mts +1 -6
  133. package/build/schema/pointer/pointer.mjs +47 -64
  134. package/build/schema/resolve/resolve.d.mts +6 -32
  135. package/build/schema/resolve/resolve.mjs +231 -227
  136. package/build/schema/schema.d.mts +1 -0
  137. package/build/schema/schema.mjs +1 -0
  138. package/build/system/settings/internal.d.mts +2 -0
  139. package/build/system/settings/internal.mjs +20 -0
  140. package/build/system/settings/settings.d.mts +11 -0
  141. package/build/system/settings/settings.mjs +14 -0
  142. package/build/type/extends/inference.d.mts +1 -1
  143. package/build/type/extends/inference.mjs +15 -2
  144. package/build/type/extends/tuple.d.mts +2 -1
  145. package/build/type/extends/tuple.mjs +21 -1
  146. package/build/value/parse/parse.mjs +10 -4
  147. package/changes.json +1 -1
  148. package/package.json +3 -3
  149. package/readme.md +52 -84
  150. /package/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
@@ -1,209 +1,150 @@
1
- // deno-fmt-ignore-file
2
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
- };
7
- var _Stack_instances, _Stack_StackFrame, _Stack_ApplyRefResult, _Stack_BuildBase, _Stack_ResourceBaseURL, _Stack_ReferenceBaseURL, _Stack_LexicalSchema, _Stack_RegisterResourceAnchorArray, _Stack_UnregisterResourceAnchorArray, _Stack_RegisterResourceAnchors, _Stack_UnregisterResourceAnchors, _Stack_RegisterResource, _Stack_UnregisterResource, _Stack_EnterResolvedResource, _Stack_ExitResolvedResource;
8
- import * as Schema from '../types/index.mjs';
9
1
  import { Guard } from '../../guard/index.mjs';
10
- import { Resolve } from '../resolve/index.mjs';
11
- // --------------------------------------------------------------------------
2
+ import * as Schema from '../types/index.mjs';
3
+ // ------------------------------------------------------------------
4
+ // DefaultUri
5
+ // ------------------------------------------------------------------
6
+ export const DefaultUri = 'urn:typebox:root';
7
+ // ------------------------------------------------------------------
8
+ // NextUri
9
+ //
10
+ // Resolves a relative or absolute ref against a base URI or URN.
11
+ // Hierarchical bases (http, https, etc.) resolve using the normal
12
+ // URL rules. URN bases have no path to resolve against, so the ref
13
+ // is appended after the base's last ':' segment instead.
14
+ // ------------------------------------------------------------------
15
+ export function NextUri(ref, base) {
16
+ return (URL.canParse(ref, base)) ? new URL(ref, base) : Guard.IsEqual(base, DefaultUri) ? new URL(`${base}:${ref}`) : new URL(`${base.slice(0, base.lastIndexOf(':'))}:${ref}`);
17
+ }
18
+ // ------------------------------------------------------------------
12
19
  // Stack
13
20
  //
14
- // Tracks traversal state ($ids, $anchors, stack frames) and applies scope
15
- // updates. Reference resolution rules ($ref, $dynamicRef) are delegated to
16
- // the Resolve functions using state snapshots (Resolve.Scope).
17
- // --------------------------------------------------------------------------
18
- export class Stack {
19
- constructor(context, schema) {
20
- _Stack_instances.add(this);
21
- this.context = context;
22
- this.schema = schema;
23
- this.ids = [];
24
- this.resourceIds = [];
25
- this.anchors = [];
26
- this.recursiveAnchors = [];
27
- this.dynamicAnchors = [];
28
- this.retrievedResources = new Map();
29
- this.retrievedFrames = [];
30
- this.resolvedResources = new Map();
31
- this.pendingResource = true;
32
- }
33
- // ----------------------------------------------------------------
34
- // LexicalBaseURL
35
- // ----------------------------------------------------------------
36
- LexicalBaseURL() {
37
- return __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_BuildBase).call(this, this.ids);
38
- }
39
- // ----------------------------------------------------------------
40
- // Push
41
- // ----------------------------------------------------------------
42
- Push(schema) {
43
- if (!Schema.IsSchemaObject(schema))
44
- return;
45
- if (Schema.IsId(schema))
46
- __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_RegisterResource).call(this, schema);
47
- if (Schema.IsAnchor(schema))
48
- this.anchors.push(schema);
49
- if (Schema.IsRecursiveAnchorTrue(schema))
50
- this.recursiveAnchors.push(schema);
51
- if (Schema.IsDynamicAnchor(schema))
52
- this.dynamicAnchors.push(schema);
53
- const retrievedResource = this.retrievedResources.get(schema);
54
- if (retrievedResource) {
55
- this.retrievedFrames.push({
56
- schema: retrievedResource.root,
57
- base: retrievedResource.base,
58
- idDepth: this.ids.length,
59
- resourceDepth: this.resourceIds.length
60
- });
61
- }
62
- }
63
- // ----------------------------------------------------------------
64
- // Pop
65
- // ----------------------------------------------------------------
66
- Pop(schema) {
67
- if (!Schema.IsSchemaObject(schema))
68
- return;
69
- if (Schema.IsId(schema))
70
- __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_UnregisterResource).call(this, schema);
71
- if (Schema.IsAnchor(schema))
72
- this.anchors.pop();
73
- if (Schema.IsRecursiveAnchorTrue(schema))
74
- this.recursiveAnchors.pop();
75
- if (Schema.IsDynamicAnchor(schema))
76
- this.dynamicAnchors.pop();
77
- if (this.retrievedResources.has(schema))
78
- this.retrievedFrames.pop();
79
- __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_ExitResolvedResource).call(this, schema);
80
- }
81
- // ----------------------------------------------------------------
82
- // Ref
83
- // ----------------------------------------------------------------
84
- Ref(ref) {
85
- const result = Resolve.ResolveRef(__classPrivateFieldGet(this, _Stack_instances, "m", _Stack_StackFrame).call(this), ref);
86
- __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_ApplyRefResult).call(this, result);
87
- return result.schema;
88
- }
89
- // ----------------------------------------------------------------
90
- // RecursiveRef
91
- // ----------------------------------------------------------------
92
- RecursiveRef(recursiveRef) {
93
- const result = Resolve.ResolveRecursiveRef(__classPrivateFieldGet(this, _Stack_instances, "m", _Stack_StackFrame).call(this), recursiveRef);
94
- if (result)
95
- this.pendingResource = true;
96
- return result;
97
- }
98
- // ----------------------------------------------------------------
99
- // DynamicRef
100
- // ----------------------------------------------------------------
101
- DynamicRef(dynamicRef) {
102
- const result = Resolve.ResolveDynamicRef(__classPrivateFieldGet(this, _Stack_instances, "m", _Stack_StackFrame).call(this), dynamicRef);
103
- if (result)
104
- this.pendingResource = true;
105
- return result;
106
- }
107
- }
108
- _Stack_instances = new WeakSet(), _Stack_StackFrame = function _Stack_StackFrame() {
21
+ // Creates the root frame a schema traversal starts from.
22
+ // ------------------------------------------------------------------
23
+ export function Stack(context, schema) {
24
+ const base = Schema.IsSchemaObject(schema) && Schema.IsId(schema) ? NextUri(schema.$id, DefaultUri).href : DefaultUri;
109
25
  return {
110
- context: this.context,
111
- root: this.schema,
112
- ids: this.ids,
113
- lexicalSchema: __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_LexicalSchema).call(this),
114
- lexicalBase: this.LexicalBaseURL(),
115
- referenceBase: __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_ReferenceBaseURL).call(this),
116
- resourceBase: __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_ResourceBaseURL).call(this),
117
- recursiveAnchors: this.recursiveAnchors,
118
- dynamicAnchors: this.dynamicAnchors,
119
- inRetrievedFrame: this.retrievedFrames.length > 0
26
+ context,
27
+ schema,
28
+ lexicalSchema: schema,
29
+ lexicalBase: base,
30
+ resourceBase: base,
31
+ referenceBase: base,
32
+ ids: [],
33
+ useResourceBaseForReference: true,
34
+ recursiveAnchor: undefined,
35
+ dynamicAnchors: [],
36
+ resourceEntries: new Map(),
37
+ pendingResource: true,
38
+ enteredResource: false
120
39
  };
121
- }, _Stack_ApplyRefResult = function _Stack_ApplyRefResult(result) {
122
- if (!Guard.IsUndefined(result.schema))
123
- this.pendingResource = true;
124
- if (!Guard.IsUndefined(result.resolvedResource)) {
125
- __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_EnterResolvedResource).call(this, result.resolvedResource.target, result.resolvedResource.resource);
126
- }
127
- if (!Guard.IsUndefined(result.retrievedResource)) {
128
- this.retrievedResources.set(result.retrievedResource.target, {
129
- base: result.retrievedResource.base,
130
- root: result.retrievedResource.root
131
- });
132
- }
133
- }, _Stack_BuildBase = function _Stack_BuildBase(stack) {
134
- const frame = this.retrievedFrames[this.retrievedFrames.length - 1];
135
- const base = frame ? new URL(frame.base) : new URL(Resolve.DefaultBase);
136
- const scoped = frame ? stack.slice(frame.idDepth) : stack;
137
- return scoped.reduce((result, schema) => new URL(schema.$id, result), base).href;
138
- }, _Stack_ResourceBaseURL = function _Stack_ResourceBaseURL() {
139
- const frame = this.retrievedFrames[this.retrievedFrames.length - 1];
140
- if (!frame)
141
- return __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_BuildBase).call(this, this.resourceIds);
142
- return this.resourceIds.slice(frame.resourceDepth).reduce((result, schema) => new URL(schema.$id, result), new URL(frame.base)).href;
143
- }, _Stack_ReferenceBaseURL = function _Stack_ReferenceBaseURL() {
144
- if (this.retrievedFrames.length > 0)
145
- return __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_ResourceBaseURL).call(this);
146
- const lexical = this.ids[this.ids.length - 1];
147
- if (lexical && !/^[A-Za-z][A-Za-z0-9+.-]*:/.test(lexical.$id))
148
- return this.LexicalBaseURL();
149
- return __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_ResourceBaseURL).call(this);
150
- }, _Stack_LexicalSchema = function _Stack_LexicalSchema() {
151
- const frame = this.retrievedFrames[this.retrievedFrames.length - 1];
152
- if (frame)
153
- return this.ids.length > frame.idDepth ? this.ids[this.ids.length - 1] : frame.schema;
154
- return this.ids.length > 0 ? this.ids[this.ids.length - 1] : this.schema;
155
- }, _Stack_RegisterResourceAnchorArray = function _Stack_RegisterResourceAnchorArray(schema) {
156
- schema.forEach((schema) => __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_RegisterResourceAnchors).call(this, schema, false));
157
- }, _Stack_UnregisterResourceAnchorArray = function _Stack_UnregisterResourceAnchorArray(schema) {
158
- schema.forEach((schema) => __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_UnregisterResourceAnchors).call(this, schema, false));
159
- }, _Stack_RegisterResourceAnchors = function _Stack_RegisterResourceAnchors(schema, isRoot = true) {
160
- if (Schema.IsSchemaBoolean(schema))
161
- return;
162
- if (Guard.IsArray(schema))
163
- return __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_RegisterResourceAnchorArray).call(this, schema);
164
- if (!Schema.IsSchemaObject(schema))
165
- return;
166
- const current = schema;
167
- if (!isRoot && Schema.IsId(current))
168
- return;
169
- if (!isRoot && Schema.IsDynamicAnchor(current))
170
- this.dynamicAnchors.push(current);
171
- for (const key of Guard.Keys(current))
172
- __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_RegisterResourceAnchors).call(this, current[key], false);
173
- }, _Stack_UnregisterResourceAnchors = function _Stack_UnregisterResourceAnchors(schema, isRoot = true) {
40
+ }
41
+ // ------------------------------------------------------------------
42
+ // RegisterResourceAnchors
43
+ //
44
+ // Collects $dynamicAnchor schemas reachable from a resource root,
45
+ // stopping at nested $id boundaries which own their own anchors.
46
+ // ------------------------------------------------------------------
47
+ function RegisterResourceAnchors(anchors, schema, isRoot = true) {
174
48
  if (Schema.IsSchemaBoolean(schema))
175
- return;
176
- if (Guard.IsArray(schema))
177
- return __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_UnregisterResourceAnchorArray).call(this, schema);
49
+ return anchors;
50
+ if (Array.isArray(schema))
51
+ return schema.reduce((result, item) => RegisterResourceAnchors(result, item, false), anchors);
178
52
  if (!Schema.IsSchemaObject(schema))
179
- return;
180
- const current = schema;
181
- if (!isRoot && Schema.IsId(current))
182
- return;
183
- if (!isRoot && Schema.IsDynamicAnchor(current))
184
- this.dynamicAnchors.pop();
185
- for (const key of Guard.Keys(current))
186
- __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_UnregisterResourceAnchors).call(this, current[key], false);
187
- }, _Stack_RegisterResource = function _Stack_RegisterResource(schema) {
188
- this.ids.push(schema);
189
- const isResource = this.pendingResource;
190
- this.pendingResource = false;
191
- if (isResource)
192
- this.resourceIds.push(schema);
193
- __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_RegisterResourceAnchors).call(this, schema, true);
194
- }, _Stack_UnregisterResource = function _Stack_UnregisterResource(schema) {
195
- this.ids.pop();
196
- const isResource = this.resourceIds.length > 0 && Guard.IsEqual(this.resourceIds[this.resourceIds.length - 1], schema);
197
- if (isResource)
198
- this.resourceIds.pop();
199
- __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_UnregisterResourceAnchors).call(this, schema, true);
200
- }, _Stack_EnterResolvedResource = function _Stack_EnterResolvedResource(target, resource) {
201
- __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_RegisterResource).call(this, resource);
202
- this.resolvedResources.set(target, resource);
203
- }, _Stack_ExitResolvedResource = function _Stack_ExitResolvedResource(target) {
204
- if (!this.resolvedResources.has(target))
205
- return;
206
- const resource = this.resolvedResources.get(target);
207
- __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_UnregisterResource).call(this, resource);
208
- this.resolvedResources.delete(target);
209
- };
53
+ return anchors;
54
+ if (!isRoot && Schema.IsId(schema))
55
+ return anchors;
56
+ const next = !isRoot && Schema.IsDynamicAnchor(schema) ? [...anchors, schema] : anchors;
57
+ return Object.keys(schema).reduce((result, key) => RegisterResourceAnchors(result, schema[key], false), next);
58
+ }
59
+ // ------------------------------------------------------------------
60
+ // ResourceEntry
61
+ //
62
+ // A ref crossing (Resolve.Ref) may have marked `schema` as the entry
63
+ // point of a retrieved/legacy resource. If so the frame resets to
64
+ // that resource's base/root instead of chaining onto the parent.
65
+ // ------------------------------------------------------------------
66
+ function ResourceEntry(stack, schema) {
67
+ return stack.resourceEntries.get(schema);
68
+ }
69
+ function NextEnteredResource(stack, schema) {
70
+ return stack.enteredResource || ResourceEntry(stack, schema) !== undefined;
71
+ }
72
+ // ------------------------------------------------------------------
73
+ // NextStack
74
+ //
75
+ // Each Next* helper below computes one XStack field in isolation from
76
+ // the previous frame and the schema being pushed.
77
+ // ------------------------------------------------------------------
78
+ function IsRelativeId(schema) {
79
+ return !/^[A-Za-z][A-Za-z0-9+.-]*:/.test(schema.$id);
80
+ }
81
+ function NextIds(stack, schema) {
82
+ return Schema.IsId(schema) ? [...stack.ids, schema] : stack.ids;
83
+ }
84
+ function NextRecursiveAnchor(stack, schema) {
85
+ return stack.recursiveAnchor ?? (Schema.IsRecursiveAnchorTrue(schema) ? schema : undefined);
86
+ }
87
+ function NextDynamicAnchors(stack, schema) {
88
+ const registered = Schema.IsId(schema) ? RegisterResourceAnchors(stack.dynamicAnchors, schema) : stack.dynamicAnchors;
89
+ return Schema.IsDynamicAnchor(schema) ? [...registered, schema] : registered;
90
+ }
91
+ function NextPendingResource(stack, schema) {
92
+ return Schema.IsId(schema) ? false : stack.pendingResource;
93
+ }
94
+ function NextLexicalBase(stack, schema) {
95
+ const entry = ResourceEntry(stack, schema);
96
+ if (entry)
97
+ return entry.base;
98
+ return Schema.IsId(schema) ? NextUri(schema.$id, stack.lexicalBase).href : stack.lexicalBase;
99
+ }
100
+ function NextResourceBase(stack, schema) {
101
+ const entry = ResourceEntry(stack, schema);
102
+ if (entry)
103
+ return entry.base;
104
+ return (Schema.IsId(schema) && stack.pendingResource) ? NextUri(schema.$id, stack.resourceBase).href : stack.resourceBase;
105
+ }
106
+ function NextUseResourceBaseForReference(stack, schema) {
107
+ return Schema.IsId(schema) ? !IsRelativeId(schema) : stack.useResourceBaseForReference;
108
+ }
109
+ function NextReferenceBase(stack, schema) {
110
+ const isRetrieved = NextEnteredResource(stack, schema);
111
+ const useResourceBaseForReference = NextUseResourceBaseForReference(stack, schema);
112
+ return (isRetrieved || useResourceBaseForReference) ? NextResourceBase(stack, schema) : NextLexicalBase(stack, schema);
113
+ }
114
+ function NextLexicalSchema(stack, schema) {
115
+ const entry = ResourceEntry(stack, schema);
116
+ if (entry)
117
+ return entry.root;
118
+ return Schema.IsId(schema) ? schema : stack.lexicalSchema;
119
+ }
120
+ // ------------------------------------------------------------------
121
+ // NextStack | HasStackKeywords (Optimization)
122
+ //
123
+ // HasStackKeywords narrows schema to an object and checks whether it
124
+ // carries $id, $dynamicAnchor, a first-seen $recursiveAnchor, or a
125
+ // resource-entry point. When none apply, NextStack skips the frame
126
+ // rebuild and returns the parent stack as-is.
127
+ // ------------------------------------------------------------------
128
+ function HasStackKeywords(stack, schema) {
129
+ return Schema.IsSchemaObject(schema) && (Schema.IsId(schema) ||
130
+ Schema.IsDynamicAnchor(schema) ||
131
+ (Guard.IsUndefined(stack.recursiveAnchor) && Schema.IsRecursiveAnchorTrue(schema)) ||
132
+ !Guard.IsUndefined(ResourceEntry(stack, schema)));
133
+ }
134
+ export function NextStack(stack, schema) {
135
+ return HasStackKeywords(stack, schema)
136
+ ? {
137
+ ...stack,
138
+ ids: NextIds(stack, schema),
139
+ dynamicAnchors: NextDynamicAnchors(stack, schema),
140
+ recursiveAnchor: NextRecursiveAnchor(stack, schema),
141
+ pendingResource: NextPendingResource(stack, schema),
142
+ lexicalBase: NextLexicalBase(stack, schema),
143
+ resourceBase: NextResourceBase(stack, schema),
144
+ useResourceBaseForReference: NextUseResourceBaseForReference(stack, schema),
145
+ referenceBase: NextReferenceBase(stack, schema),
146
+ lexicalSchema: NextLexicalSchema(stack, schema),
147
+ enteredResource: NextEnteredResource(stack, schema)
148
+ }
149
+ : stack;
150
+ }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import { Stack } from './_stack.mjs';
2
+ import * as Stack from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildAdditionalItems(stack: Stack, context: BuildContext, schema: Schema.XAdditionalItems, value: string): string;
5
- export declare function CheckAdditionalItems(stack: Stack, context: CheckContext, schema: Schema.XAdditionalItems, value: unknown[]): boolean;
6
- export declare function ErrorAdditionalItems(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAdditionalItems, value: unknown[]): boolean;
4
+ export declare function BuildAdditionalItems(stack: Stack.XStack, context: BuildContext, schema: Schema.XAdditionalItems, value: string): string;
5
+ export declare function CheckAdditionalItems(stack: Stack.XStack, context: CheckContext, schema: Schema.XAdditionalItems, value: unknown[]): boolean;
6
+ export declare function ErrorAdditionalItems(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAdditionalItems, value: unknown[]): boolean;
@@ -1,9 +1,9 @@
1
- import * as S from '../types/index.mjs';
2
- import { Stack } from './_stack.mjs';
1
+ import * as Schema from '../types/index.mjs';
2
+ import * as Stack from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function CanAdditionalPropertiesFast(_context: BuildContext, schema: S.XAdditionalProperties, _value: string): schema is S.XAdditionalProperties & S.XRequired;
5
- export declare function BuildAdditionalPropertiesFast(_context: BuildContext, schema: S.XAdditionalProperties & S.XRequired, value: string): string;
6
- export declare function BuildAdditionalPropertiesStandard(stack: Stack, context: BuildContext, schema: S.XAdditionalProperties, value: string): string;
7
- export declare function BuildAdditionalProperties(stack: Stack, context: BuildContext, schema: S.XAdditionalProperties, value: string): string;
8
- export declare function CheckAdditionalProperties(stack: Stack, context: CheckContext, schema: S.XAdditionalProperties, value: Record<PropertyKey, unknown>): boolean;
9
- export declare function ErrorAdditionalProperties(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: S.XAdditionalProperties, value: Record<PropertyKey, unknown>): boolean;
4
+ export declare function CanAdditionalPropertiesFast(_context: BuildContext, schema: Schema.XAdditionalProperties, _value: string): schema is Schema.XAdditionalProperties & Schema.XRequired;
5
+ export declare function BuildAdditionalPropertiesFast(_context: BuildContext, schema: Schema.XAdditionalProperties & Schema.XRequired, value: string): string;
6
+ export declare function BuildAdditionalPropertiesStandard(stack: Stack.XStack, context: BuildContext, schema: Schema.XAdditionalProperties, value: string): string;
7
+ export declare function BuildAdditionalProperties(stack: Stack.XStack, context: BuildContext, schema: Schema.XAdditionalProperties, value: string): string;
8
+ export declare function CheckAdditionalProperties(stack: Stack.XStack, context: CheckContext, schema: Schema.XAdditionalProperties, value: Record<PropertyKey, unknown>): boolean;
9
+ export declare function ErrorAdditionalProperties(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAdditionalProperties, value: Record<PropertyKey, unknown>): boolean;
@@ -1,6 +1,7 @@
1
1
  // deno-fmt-ignore-file
2
- import * as S from '../types/index.mjs';
3
- import * as V from './_externals.mjs';
2
+ import * as Schema from '../types/index.mjs';
3
+ import * as Externals from './_externals.mjs';
4
+ import * as Pathing from './_pathing.mjs';
4
5
  import { Unique } from './_unique.mjs';
5
6
  import { UnicodeRegExp } from './_regexp.mjs';
6
7
  import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
@@ -34,9 +35,9 @@ function GetPropertyKeyAsPattern(key) {
34
35
  }
35
36
  function GetPropertiesPattern(schema) {
36
37
  const patterns = [];
37
- if (S.IsPatternProperties(schema))
38
+ if (Schema.IsPatternProperties(schema))
38
39
  patterns.push(...G.Keys(schema.patternProperties));
39
- if (S.IsProperties(schema))
40
+ if (Schema.IsProperties(schema))
40
41
  patterns.push(...G.Keys(schema.properties).map(GetPropertyKeyAsPattern));
41
42
  return G.IsEqual(patterns.length, 0) ? '(?!)' : `(${patterns.join('|')})`;
42
43
  }
@@ -56,9 +57,9 @@ function GetPropertiesPattern(schema) {
56
57
  //
57
58
  // ------------------------------------------------------------------
58
59
  export function CanAdditionalPropertiesFast(_context, schema, _value) {
59
- return S.IsRequired(schema)
60
- && S.IsProperties(schema)
61
- && !S.IsPatternProperties(schema)
60
+ return Schema.IsRequired(schema)
61
+ && Schema.IsProperties(schema)
62
+ && !Schema.IsPatternProperties(schema)
62
63
  && G.IsEqual(schema.additionalProperties, false)
63
64
  && G.IsEqual(G.Keys(schema.properties).length, schema.required.length);
64
65
  }
@@ -70,7 +71,7 @@ export function BuildAdditionalPropertiesFast(_context, schema, value) {
70
71
  // ------------------------------------------------------------------
71
72
  export function BuildAdditionalPropertiesStandard(stack, context, schema, value) {
72
73
  const [key, _index] = [Unique(), Unique()];
73
- const regexp = V.CreateVariable(UnicodeRegExp(GetPropertiesPattern(schema)));
74
+ const regexp = Externals.CreateVariable(UnicodeRegExp(GetPropertiesPattern(schema)));
74
75
  const isSchema = BuildSchemaPushStack(stack, context, schema.additionalProperties, `${value}[${key}]`);
75
76
  const isKey = E.Call(E.Member(regexp, 'test'), [key]);
76
77
  const addKey = context.AddKey(key);
@@ -107,17 +108,13 @@ export function ErrorAdditionalProperties(stack, context, schemaPath, instancePa
107
108
  const additionalProperties = [];
108
109
  const isAdditionalProperties = G.EveryAll(G.Keys(value), 0, (key, _index) => {
109
110
  const nextSchemaPath = `${schemaPath}/additionalProperties`;
110
- const nextInstancePath = `${instancePath}/${key}`;
111
+ const nextInstancePath = `${instancePath}/${Pathing.EncodeFragment(key)}`;
111
112
  const isAdditionalProperty = regexp.test(key) ||
112
113
  (ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema.additionalProperties, value[key]) && context.AddKey(key));
113
114
  if (!isAdditionalProperty)
114
115
  additionalProperties.push(key);
115
116
  return isAdditionalProperty;
116
117
  });
117
- return isAdditionalProperties || context.AddError({
118
- keyword: 'additionalProperties',
119
- schemaPath,
120
- instancePath,
121
- params: { additionalProperties },
122
- });
118
+ return isAdditionalProperties ||
119
+ context.AddError('additionalProperties', schemaPath, instancePath, { additionalProperties });
123
120
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import { Stack } from './_stack.mjs';
2
+ import * as Stack from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildAllOf(stack: Stack, context: BuildContext, schema: Schema.XAllOf, value: string): string;
5
- export declare function CheckAllOf(stack: Stack, context: CheckContext, schema: Schema.XAllOf, value: unknown): boolean;
6
- export declare function ErrorAllOf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAllOf, value: unknown): boolean;
4
+ export declare function BuildAllOf(stack: Stack.XStack, context: BuildContext, schema: Schema.XAllOf, value: string): string;
5
+ export declare function CheckAllOf(stack: Stack.XStack, context: CheckContext, schema: Schema.XAllOf, value: unknown): boolean;
6
+ export declare function ErrorAllOf(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAllOf, value: unknown): boolean;
@@ -42,6 +42,6 @@ export function ErrorAllOf(stack, context, schemaPath, instancePath, schema, val
42
42
  }, []);
43
43
  const isAllOf = G.IsEqual(results.length, schema.allOf.length) && context.Merge(results);
44
44
  if (!isAllOf)
45
- failedContexts.forEach(failed => failed.GetErrors().forEach(error => context.AddError(error)));
45
+ failedContexts.forEach(failed => context.AddErrors(failed.GetErrors()));
46
46
  return isAllOf;
47
47
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import { Stack } from './_stack.mjs';
2
+ import * as Stack from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildAnyOf(stack: Stack, context: BuildContext, schema: Schema.XAnyOf, value: string): string;
5
- export declare function CheckAnyOf(stack: Stack, context: CheckContext, schema: Schema.XAnyOf, value: unknown): boolean;
6
- export declare function ErrorAnyOf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAnyOf, value: unknown): boolean;
4
+ export declare function BuildAnyOf(stack: Stack.XStack, context: BuildContext, schema: Schema.XAnyOf, value: string): string;
5
+ export declare function CheckAnyOf(stack: Stack.XStack, context: CheckContext, schema: Schema.XAnyOf, value: unknown): boolean;
6
+ export declare function ErrorAnyOf(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAnyOf, value: unknown): boolean;
@@ -1,8 +1,8 @@
1
1
  // deno-fmt-ignore-file
2
- import { CheckContext, ErrorContext } from './_context.mjs';
3
2
  import { Reducer } from './_reducer.mjs';
4
- import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
3
+ import { CheckContext, ErrorContext } from './_context.mjs';
5
4
  import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
5
+ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
6
6
  // ------------------------------------------------------------------
7
7
  // Build
8
8
  // ------------------------------------------------------------------
@@ -42,11 +42,6 @@ export function ErrorAnyOf(stack, context, schemaPath, instancePath, schema, val
42
42
  }, []);
43
43
  const isAnyOf = G.IsGreaterThan(results.length, 0) && context.Merge(results);
44
44
  if (!isAnyOf)
45
- failedContexts.forEach(failed => failed.GetErrors().forEach(error => context.AddError(error)));
46
- return isAnyOf || context.AddError({
47
- keyword: 'anyOf',
48
- schemaPath,
49
- instancePath,
50
- params: {}
51
- });
45
+ failedContexts.forEach(failed => context.AddErrors(failed.GetErrors()));
46
+ return isAnyOf || context.AddError('anyOf', schemaPath, instancePath, {});
52
47
  }
@@ -1,5 +1,5 @@
1
- import { Stack } from './_stack.mjs';
1
+ import * as Stack from './_stack.mjs';
2
2
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
3
- export declare function BuildSchemaBoolean(_stack: Stack, _context: BuildContext, schema: boolean, _value: string): string;
4
- export declare function CheckSchemaBoolean(_stack: Stack, _context: CheckContext, schema: boolean, _value: unknown): boolean;
5
- export declare function ErrorSchemaBoolean(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: boolean, value: unknown): boolean;
3
+ export declare function BuildSchemaBoolean(_stack: Stack.XStack, _context: BuildContext, schema: boolean, _value: string): string;
4
+ export declare function CheckSchemaBoolean(_stack: Stack.XStack, _context: CheckContext, schema: boolean, _value: unknown): boolean;
5
+ export declare function ErrorSchemaBoolean(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: boolean, value: unknown): boolean;
@@ -16,10 +16,6 @@ export function CheckSchemaBoolean(_stack, _context, schema, _value) {
16
16
  // Error
17
17
  // ------------------------------------------------------------------
18
18
  export function ErrorSchemaBoolean(stack, context, schemaPath, instancePath, schema, value) {
19
- return CheckSchemaBoolean(stack, context, schema, value) || context.AddError({
20
- keyword: 'boolean',
21
- schemaPath,
22
- instancePath,
23
- params: {}
24
- });
19
+ return CheckSchemaBoolean(stack, context, schema, value) ||
20
+ context.AddError('boolean', schemaPath, instancePath, {});
25
21
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import { Stack } from './_stack.mjs';
2
+ import * as Stack from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildConst(_stack: Stack, _context: BuildContext, schema: Schema.XConst, value: string): string;
5
- export declare function CheckConst(_stack: Stack, _context: CheckContext, schema: Schema.XConst, value: unknown): boolean;
6
- export declare function ErrorConst(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XConst, value: unknown): boolean;
4
+ export declare function BuildConst(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XConst, value: string): string;
5
+ export declare function CheckConst(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XConst, value: unknown): boolean;
6
+ export declare function ErrorConst(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XConst, value: unknown): boolean;
@@ -21,10 +21,6 @@ export function CheckConst(_stack, _context, schema, value) {
21
21
  // Check
22
22
  // ------------------------------------------------------------------
23
23
  export function ErrorConst(stack, context, schemaPath, instancePath, schema, value) {
24
- return CheckConst(stack, context, schema, value) || context.AddError({
25
- keyword: 'const',
26
- schemaPath,
27
- instancePath,
28
- params: { allowedValue: schema.const },
29
- });
24
+ return CheckConst(stack, context, schema, value) ||
25
+ context.AddError('const', schemaPath, instancePath, { allowedValue: schema.const });
30
26
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import { Stack } from './_stack.mjs';
2
+ import * as Stack from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildContains(stack: Stack, context: BuildContext, schema: Schema.XContains, value: string): string;
5
- export declare function CheckContains(stack: Stack, context: CheckContext, schema: Schema.XContains, value: unknown[]): boolean;
6
- export declare function ErrorContains(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XContains, value: unknown[]): boolean;
4
+ export declare function BuildContains(stack: Stack.XStack, context: BuildContext, schema: Schema.XContains, value: string): string;
5
+ export declare function CheckContains(stack: Stack.XStack, context: CheckContext, schema: Schema.XContains, value: unknown[]): boolean;
6
+ export declare function ErrorContains(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XContains, value: unknown[]): boolean;
@@ -45,10 +45,6 @@ export function CheckContains(stack, context, schema, value) {
45
45
  // Error
46
46
  // ------------------------------------------------------------------
47
47
  export function ErrorContains(stack, context, schemaPath, instancePath, schema, value) {
48
- return CheckContains(stack, context, schema, value) || context.AddError({
49
- keyword: 'contains',
50
- schemaPath,
51
- instancePath,
52
- params: { minContains: 1 },
53
- });
48
+ return CheckContains(stack, context, schema, value) ||
49
+ context.AddError('contains', schemaPath, instancePath, { minContains: 1 });
54
50
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import { Stack } from './_stack.mjs';
2
+ import * as Stack from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildDependencies(stack: Stack, context: BuildContext, schema: Schema.XDependencies, value: string): string;
5
- export declare function CheckDependencies(stack: Stack, context: CheckContext, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
6
- export declare function ErrorDependencies(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
4
+ export declare function BuildDependencies(stack: Stack.XStack, context: BuildContext, schema: Schema.XDependencies, value: string): string;
5
+ export declare function CheckDependencies(stack: Stack.XStack, context: CheckContext, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
6
+ export declare function ErrorDependencies(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
@@ -1,4 +1,5 @@
1
1
  // deno-fmt-ignore-file
2
+ import * as Pathing from './_pathing.mjs';
2
3
  import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
3
4
  import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
4
5
  // ------------------------------------------------------------------
@@ -32,14 +33,11 @@ export function CheckDependencies(stack, context, schema, value) {
32
33
  export function ErrorDependencies(stack, context, schemaPath, instancePath, schema, value) {
33
34
  const isLength = G.IsEqual(G.Keys(value).length, 0);
34
35
  const isEvery = G.EveryAll(G.Entries(schema.dependencies), 0, ([key, schema]) => {
35
- const nextSchemaPath = `${schemaPath}/dependencies/${key}`;
36
+ const nextSchemaPath = `${schemaPath}/dependencies/${Pathing.EncodeFragment(key)}`;
36
37
  return !G.HasPropertyKey(value, key) || (G.IsArray(schema)
37
- ? schema.every((dependency) => G.HasPropertyKey(value, dependency) || context.AddError({
38
- keyword: 'dependencies',
39
- schemaPath,
40
- instancePath,
41
- params: { property: key, dependencies: schema },
42
- })) : ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value));
38
+ ? schema.every((dependency) => G.HasPropertyKey(value, dependency) ||
39
+ context.AddError('dependencies', schemaPath, instancePath, { property: key, dependencies: schema }))
40
+ : ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value));
43
41
  });
44
42
  return isLength || isEvery;
45
43
  }