@texaryn/schema-json 0.6.3 → 0.7.1

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 (43) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +34 -2
  3. package/dist/adapter.d.ts +2 -0
  4. package/dist/adapter.d.ts.map +1 -1
  5. package/dist/adapter.js +42 -25
  6. package/dist/adapter.js.map +1 -1
  7. package/dist/bare-maps.d.ts +3 -0
  8. package/dist/bare-maps.d.ts.map +1 -0
  9. package/dist/bare-maps.js +44 -0
  10. package/dist/bare-maps.js.map +1 -0
  11. package/dist/identity.d.ts +26 -0
  12. package/dist/identity.d.ts.map +1 -0
  13. package/dist/identity.js +280 -0
  14. package/dist/identity.js.map +1 -0
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/instance-pointer.d.ts +9 -0
  20. package/dist/instance-pointer.d.ts.map +1 -0
  21. package/dist/instance-pointer.js +115 -0
  22. package/dist/instance-pointer.js.map +1 -0
  23. package/dist/normalize.d.ts +3 -0
  24. package/dist/normalize.d.ts.map +1 -0
  25. package/dist/normalize.js +118 -0
  26. package/dist/normalize.js.map +1 -0
  27. package/dist/projection-shape.d.ts +25 -0
  28. package/dist/projection-shape.d.ts.map +1 -0
  29. package/dist/projection-shape.js +74 -0
  30. package/dist/projection-shape.js.map +1 -0
  31. package/dist/projection.d.ts +7 -1
  32. package/dist/projection.d.ts.map +1 -1
  33. package/dist/projection.js +202 -111
  34. package/dist/projection.js.map +1 -1
  35. package/dist/root-reference.d.ts +4 -0
  36. package/dist/root-reference.d.ts.map +1 -0
  37. package/dist/root-reference.js +86 -0
  38. package/dist/root-reference.js.map +1 -0
  39. package/dist/schema-graph.d.ts +29 -0
  40. package/dist/schema-graph.d.ts.map +1 -0
  41. package/dist/schema-graph.js +365 -0
  42. package/dist/schema-graph.js.map +1 -0
  43. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,69 @@
1
1
  # @texaryn/schema-json
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 3af1cf7: Projecting a schema whose `items` is the boolean `false` no longer throws in 2020-12. A tuple closed with `prefixItems` and `items: false` projects as an array.
8
+ - d959520: Validation and projection no longer throw for a data key named like an `Object.prototype` member, such as `__proto__`, `constructor` or `toString`. The key is validated like any other key.
9
+ - eab920a: Validation errors report RFC 6901 pointers for property names that contain `/` or `~`. A missing required field named `a/b` is reported at `/a~1b`, so `validateAt` and the association of an error with its field find it.
10
+
11
+ ## 0.7.0
12
+
13
+ ### Minor Changes
14
+
15
+ - eae5f41: A recursive local `$ref` projects, validates and initializes, closing #119. The
16
+ projection expands it once past the data, marks the objects above what it
17
+ withheld with `recursion` or `budget` boundaries, and projects at most 16
18
+ objects and 512 nodes that exist because of the recursion, never cutting a
19
+ member of a location that holds data. Each `$ref` site resolves to one compiled
20
+ target per adapter, which bounds the cost of a large object behind one `$ref`:
21
+ 500 string fields project in 5 ms on an Apple M1 Max.
22
+
23
+ `createJsonSchemaAdapter` rejects a schema that applies itself at one instance
24
+ location with `SameLocationCycleError`, which names the position and the path.
25
+ That includes a self-application under an `if`, which constructed before and
26
+ validated only while its condition was false.
27
+
28
+ In Draft 7, `"$ref": "#"` resolves to the document root, so validation of a
29
+ recursive Draft 7 schema is correct, and the draft-07 metaschema renders the
30
+ root fields that reference the root. The fix pins an internal of
31
+ json-schema-library 11.6.2, so the dependency range is `~11.6.2`, and adapter
32
+ creation fails with an error naming that release if the internal changes.
33
+
34
+ A field behind a chain of `$ref`s, a reference to a definition that is itself a
35
+ `$ref`, now projects, where it was dropped with an `unresolved-projection-shape`
36
+ diagnostic. In Draft 7, the fields under a `oneOf` or `anyOf` wrapper around a
37
+ `$ref`, nested or not, stay projected once they hold data, where the subtree
38
+ disappeared.
39
+
40
+ Fields declared only under a branch the specification never evaluates (a `then`
41
+ or `else` without `if`, a `then` under `if: false`, an `else` under `if: true`)
42
+ are not projected unless a reference points into the branch or a schema inside
43
+ it declares an `$id`, `$anchor` or `$dynamicAnchor`. Validation runs on the
44
+ schema as written, so an error only such a branch declares attaches to no field,
45
+ and `validate` returns the same result before and after a projection.
46
+
47
+ A schema with no recursive position projects its nodes in the same order as
48
+ before, so `schema-defaults` writes the same keys in the same order. In Draft 7,
49
+ the siblings of a `$ref` take no part in schema identity, and every registry
50
+ entry json-schema-library files for its own location is pinned, so a projection
51
+ cannot replace a definition with a reduced copy that a later reference resolves
52
+ to. A `$ref` chain is followed only through sites that add nothing but
53
+ annotations, so a `type`, `format` or `enum` beside a 2019-09 or 2020-12 `$ref`
54
+ still applies. An `$anchor`, `$dynamicAnchor` or Draft 7 fragment `$id` inside
55
+ such a kept branch is a reference target, so a cycle through it is rejected and
56
+ recursion through it is bounded. An `$id` declared under both `$defs` and
57
+ `definitions` resolves as json-schema-library resolves it, a reference with a
58
+ malformed percent escape such as `#/properties/50%off` keeps its raw spelling,
59
+ and only an own property of the data counts as holding data, so a member named
60
+ `constructor` is absent at `{}`.
61
+
62
+ ### Patch Changes
63
+
64
+ - Updated dependencies [eae5f41]
65
+ - @texaryn/core@0.13.0
66
+
3
67
  ## 0.6.3
4
68
 
5
69
  ### Patch Changes
package/README.md CHANGED
@@ -84,7 +84,7 @@ The adapter currently handles the schema features required by Texaryn's runtime
84
84
  - objects and primitive fields
85
85
  - arrays
86
86
  - enums
87
- - local `$ref`
87
+ - local `$ref`, including recursive references
88
88
  - `if` / `then` / `else`
89
89
  - `oneOf`
90
90
  - `anyOf`
@@ -93,7 +93,21 @@ The adapter currently handles the schema features required by Texaryn's runtime
93
93
  - Draft 7 `dependencies`
94
94
  - annotations and field constraints
95
95
 
96
- Inactive conditional fields remain represented in the projection with `active: false`, allowing the runtime and renderer to preserve a deterministic UI structure across branch changes.
96
+ Inactive conditional fields remain represented in the projection with `active: false`, allowing the runtime and renderer to preserve a deterministic UI structure across branch changes. A branch the specification never evaluates (a `then` or `else` without `if`, a `then` under `if: false`, an `else` under `if: true`) contributes no fields unless a reference points into it or a schema inside it declares an `$id`, `$anchor` or `$dynamicAnchor`.
97
+
98
+ ## Recursive schemas
99
+
100
+ A local `$ref` may point back to a schema that contains it, such as `{ properties: { child: { $ref: '#' } } }` or a definition that refers to itself. The projection expands such a schema once past the data: below the last location that holds data, a path never applies the same schemas twice. At `{}` the example above projects `/child`, and once `/child` holds an object it projects `/child/child`. Each level the user fills exposes the next.
101
+
102
+ `boundaries` on an object's `NodeProjection` says why the projection withheld something beneath it: `recursion` when a descendant would repeat the object's schemas, `budget` when a fixed per-projection limit withheld members. The limits are 16 objects and 512 nodes, counted only over locations that exist because of the recursion, two or more levels below the data; they never cut a member of a location that holds data. A node the projection reached only by expanding the recursion carries `recursiveExpansion`, and `schema-defaults` initialization never writes there.
103
+
104
+ A schema that applies itself at one instance location without crossing into a property or item, such as `{ allOf: [{ $ref: '#' }] }`, makes the evaluator recurse without end, so `createJsonSchemaAdapter` rejects it with `SameLocationCycleError`. Its `positions` field lists the schema positions of each cycle, and the message names one of them and the path through the cycle. The check reads the schema, not the data: a cycle behind an `if` is rejected even while the `if` does not hold, except the branches the specification never evaluates. It is conservative for dynamic references, treating a `$dynamicRef` to a `$dynamicAnchor` as reaching every `$dynamicAnchor` of that name and a `$recursiveRef` as reaching every schema that declares `$recursiveAnchor: true`, so a schema whose dynamic references could close such a cycle is rejected even when no evaluation selects it.
105
+
106
+ The [JSON Schema support guide](https://texaryn.github.io/texaryn/guides/json-schema-support/#recursive-references) has the details, and ADR-007 records the decision.
107
+
108
+ ## json-schema-library version
109
+
110
+ The dependency is pinned to exactly `11.6.2`. In Draft 7, json-schema-library 11.6.2 overwrites the registry entry that `"$ref": "#"` resolves through, so without a fix the reference reaches another node and validation is wrong. The adapter pins that entry to the document root, and every other entry the library files for its own location to the node compiled there, so a reduction during projection cannot replace a definition with a reduced copy. Because the fix depends on the library's internal registry, adapter creation throws an error naming json-schema-library 11.6.2 when the registry is shaped differently, or when a self-test on two probe schemas shows the fix no longer repairs validation. A newer json-schema-library release is not installed until a Texaryn release raises the pin after the registry fix and its self-test pass against it.
97
111
 
98
112
  ## Validation
99
113
 
@@ -120,6 +134,10 @@ interface ValidationError {
120
134
 
121
135
  Required-property errors are located at the missing property pointer rather than only at the parent object.
122
136
 
137
+ `instancePointer` is an RFC 6901 pointer: a property named `a/b` is `/a~1b`, and `a~b` is `/a~0b`. json-schema-library joins property names into its own error pointers without escaping, so the adapter recovers the real keys from the validated data. Two locations whose keys read the same once joined, such as `a/b` holding `c` next to `a` holding `b/c`, are told apart by the value the error reports. When both hold equal values and only one fails, the error is located at the first of them in key order, until json-schema-library escapes at the source (sagold/json-schema-library#130). `params` is json-schema-library's raw error data, and its pointers are not escaped.
138
+
139
+ A data key named like an `Object.prototype` member (`__proto__`, `constructor`, `toString`) validates and projects like any other key. The one exception is a schema that combines `patternProperties` with `additionalProperties: false`: json-schema-library reads that schema's plain `properties` object, so it treats such an undeclared key as declared.
140
+
123
141
  ## Scoped validation
124
142
 
125
143
  This adapter also implements the optional `validateAt()` port method:
@@ -135,6 +153,7 @@ The result contains validation errors at that pointer or below it.
135
153
  ```ts
136
154
  import {
137
155
  createJsonSchemaAdapter,
156
+ SameLocationCycleError,
138
157
  type AdapterConfig,
139
158
  type Dialect,
140
159
  } from '@texaryn/schema-json'
@@ -166,6 +185,19 @@ The union of dialect identifiers the adapter recognizes:
166
185
  type Dialect = 'draft-07' | '2019-09' | '2020-12'
167
186
  ```
168
187
 
188
+ ### `SameLocationCycleError`
189
+
190
+ Thrown by `createJsonSchemaAdapter` for a schema that applies itself at one instance location. A host that loads authored schemas can tell a broken schema from a failed load with `instanceof`:
191
+
192
+ ```ts
193
+ try {
194
+ await createJsonSchemaAdapter(schema)
195
+ } catch (error) {
196
+ if (error instanceof SameLocationCycleError) console.log(error.positions, error.message)
197
+ else throw error
198
+ }
199
+ ```
200
+
169
201
  ## Architecture
170
202
 
171
203
  The adapter is deliberately separate from `@texaryn/core`:
package/dist/adapter.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { type ProjectionLimits } from './projection.js';
1
2
  import type { AdapterConfig, JsonSchemaAdapter } from './types.js';
2
3
  export declare function createJsonSchemaAdapter(schema: unknown, config?: AdapterConfig): Promise<JsonSchemaAdapter>;
4
+ export declare function createAdapter(schema: unknown, config: AdapterConfig | undefined, limits: ProjectionLimits): Promise<JsonSchemaAdapter>;
3
5
  //# sourceMappingURL=adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAElE,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,OAAO,EACf,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,iBAAiB,CAAC,CAoB5B"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAmC,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAMxF,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAElE,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,OAAO,EACf,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,iBAAiB,CAAC,CAE5B;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,aAAa,GAAG,SAAS,EACjC,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,iBAAiB,CAAC,CA8B5B"}
package/dist/adapter.js CHANGED
@@ -1,21 +1,40 @@
1
1
  import { compileSchema, } from 'json-schema-library';
2
2
  import { detectDialect } from './dialect.js';
3
3
  import { loadMetaschemas, referencedDialects } from './metaschemas/index.js';
4
- import { buildProjection } from './projection.js';
4
+ import { newProjectionCache } from './identity.js';
5
+ import { buildProjection, DEFAULT_LIMITS } from './projection.js';
6
+ import { withoutUnreachableBranches } from './normalize.js';
7
+ import { DRAFTS } from './bare-maps.js';
8
+ import { fixRootReference } from './root-reference.js';
9
+ import { buildSchemaGraph, rejectSameLocationCycles, cyclicPositions, markPositions } from './schema-graph.js';
10
+ import { pointerResolver } from './instance-pointer.js';
5
11
  export async function createJsonSchemaAdapter(schema, config) {
12
+ return createAdapter(schema, config, DEFAULT_LIMITS);
13
+ }
14
+ export async function createAdapter(schema, config, limits) {
6
15
  const dialect = detectDialect(schema, {
7
16
  defaultDialect: config?.defaultDialect ?? 'draft-07',
8
17
  });
9
- const prepared = await prepareSchema(schema, dialect);
18
+ // json-schema-library carries no metaschema documents, so a schema referencing its own fails closed.
19
+ const referenced = referencedDialects(schema);
20
+ const remotes = referenced.length > 0 ? await loadMetaschemas(referenced) : undefined;
21
+ // json-schema-library evaluates some branches the specification never does, so only the projection drops them.
22
+ const document = withoutUnreachableBranches(schema);
23
+ const graph = buildSchemaGraph(document, dialect, remotes ?? []);
24
+ rejectSameLocationCycles(graph);
25
+ const marked = markPositions(graph, document, remotes ?? []);
26
+ const validated = await prepareSchema(schema, dialect, remotes);
27
+ const projected = await prepareSchema(marked.document, dialect, remotes && marked.remotes);
28
+ const cache = newProjectionCache(dialect, cyclicPositions(graph), marked.at);
10
29
  return {
11
30
  project(data) {
12
- return buildProjection(prepared, data);
31
+ return buildProjection(projected, data, cache, limits);
13
32
  },
14
33
  validate(data) {
15
- return runValidation(prepared, data);
34
+ return runValidation(validated, data);
16
35
  },
17
36
  validateAt(data, pointer) {
18
- return runValidationAt(prepared, data, pointer);
37
+ return runValidationAt(validated, data, pointer);
19
38
  },
20
39
  };
21
40
  }
@@ -27,29 +46,21 @@ function toDraftOption(dialect) {
27
46
  // compileSchema() is synchronous for schemas with only local $ref (Phase 1's scope); it is
28
47
  // wrapped in a Promise so the factory signature stays uniform with libraries whose
29
48
  // preparation step is genuinely async (e.g. hyperjump's annotate()).
30
- async function prepareSchema(schema, dialect) {
31
- // A schema may reference its dialect's metaschema to assert that it is
32
- // itself a valid schema. json-schema-library carries the draft definitions
33
- // but not the metaschema documents, and an unresolved reference fails
34
- // closed, so without these a valid schema is reported invalid.
35
- const referenced = referencedDialects(schema);
36
- const remotes = referenced.length > 0 ? await loadMetaschemas(referenced) : undefined;
49
+ async function prepareSchema(schema, dialect, remotes) {
37
50
  // json-schema-library asserts `format` in every dialect. Draft 7 permits that:
38
51
  // assertion is the conventional behaviour there and the specification only asks
39
52
  // that it can be disabled. From 2019-09 the default inverted, and `format` is an
40
53
  // annotation unless the format-assertion vocabulary is declared, so asserting it
41
54
  // is a deviation rather than a stricter setting.
42
55
  const formatAssertion = dialect === 'draft-07' ? undefined : false;
43
- return compileSchema(schema, {
56
+ const root = compileSchema(schema, {
57
+ drafts: DRAFTS,
44
58
  draft: toDraftOption(dialect),
45
59
  formatAssertion,
46
60
  remotes,
47
61
  });
48
- }
49
- // json-schema-library reports data pointers as "#"-prefixed URI fragments (e.g. "#/age");
50
- // ValidationError.instancePointer expects an RFC 6901 JSON Pointer (e.g. "/age").
51
- function toInstancePointer(jslPointer) {
52
- return jslPointer === '#' ? '' : jslPointer.replace(/^#/, '');
62
+ fixRootReference(root, dialect);
63
+ return root;
53
64
  }
54
65
  // jsl error codes are kebab-case ("min-length-error"); ValidationError.keyword is expected
55
66
  // to be the JSON Schema keyword itself ("minLength"). Unrecognized codes fall back to a
@@ -112,16 +123,21 @@ function toKeyword(code) {
112
123
  const withoutSuffix = code.replace(/-(error|warning)$/, '');
113
124
  return withoutSuffix.replace(/-([a-z0-9])/g, (_, char) => char.toUpperCase());
114
125
  }
115
- function mapValidationError(error) {
126
+ function mapValidationError(error, resolve) {
116
127
  const code = typeof error.code === 'string' ? error.code : String(error.code);
117
- const basePointer = typeof error.data?.pointer === 'string' ? error.data.pointer : '#';
128
+ const data = (error.data ?? {});
129
+ const basePointer = typeof data.pointer === 'string' ? data.pointer : '#';
118
130
  // required-property-error reports the *parent* object's pointer with the missing property
119
131
  // name in data.key; consumers expect the error located at the missing property itself.
120
- const key = error.data?.key;
121
- const missingKey = code === 'required-property-error' && typeof key === 'string' ? key : undefined;
122
- const pointer = missingKey ? `${basePointer}/${missingKey}` : basePointer;
132
+ const missingKey = code === 'required-property-error' && typeof data.key === 'string' ? data.key : undefined;
133
+ // These two report the parent as data.value; the child's own key says which child failed.
134
+ const lastKey = code === 'no-additional-properties-error' && typeof data.property === 'string'
135
+ ? data.property
136
+ : code === 'additional-items-error' && data.key !== undefined
137
+ ? String(data.key)
138
+ : undefined;
123
139
  return {
124
- instancePointer: toInstancePointer(pointer),
140
+ instancePointer: resolve(basePointer, { code, value: data.value, missingKey, lastKey }),
125
141
  keyword: toKeyword(code),
126
142
  message: error.message,
127
143
  params: (error.data ?? {}),
@@ -129,9 +145,10 @@ function mapValidationError(error) {
129
145
  }
130
146
  function runValidation(prepared, data) {
131
147
  const result = prepared.validate(data);
148
+ const resolve = pointerResolver(data);
132
149
  return {
133
150
  valid: result.valid,
134
- errors: result.errors.map(mapValidationError),
151
+ errors: result.errors.map((error) => mapValidationError(error, resolve)),
135
152
  };
136
153
  }
137
154
  function runValidationAt(prepared, data, pointer) {
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GAKd,MAAM,qBAAqB,CAAA;AAQ5B,OAAO,EAAE,aAAa,EAAgB,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGjD,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAAe,EACf,MAAsB;IAEtB,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,EAAE;QACpC,cAAc,EAAE,MAAM,EAAE,cAAc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AACH,CAAC;AAED,SAAS,eAAe,CACtB,QAAoB,EACpB,IAAa,EACb,OAAoB;IAEpB,MAAM,MAAM,GAAG,OAAiB,CAAA;IAChC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACvD,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;IAE3C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAC1B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,eAAe,KAAK,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,GAAG,MAAM,GAAG,CAAC,CAC9F,CAAA;IACD,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AACvD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Draft } from 'json-schema-library';
2
+ export declare const DRAFTS: Draft[];
3
+ //# sourceMappingURL=bare-maps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bare-maps.d.ts","sourceRoot":"","sources":["../src/bare-maps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgE,KAAK,KAAK,EAAmB,MAAM,qBAAqB,CAAA;AAyC/H,eAAO,MAAM,MAAM,EAAE,KAAK,EAAwE,CAAA"}
@@ -0,0 +1,44 @@
1
+ import { draft04, draft06, draft07, draft2019, draft2020, extendDraft } from 'json-schema-library';
2
+ const MAPS_BY_KEYWORD = {
3
+ properties: ['properties'],
4
+ dependentSchemas: ['dependentSchemas'],
5
+ dependentRequired: ['dependentRequired'],
6
+ dependencies: ['dependentSchemas', 'dependentRequired'],
7
+ propertyDependencies: ['propertyDependencies'],
8
+ };
9
+ // A plain map answers a lookup of "__proto__" with Object.prototype, which json-schema-library then runs as a schema.
10
+ function bare(node, field) {
11
+ const record = node;
12
+ const map = record[field];
13
+ if (typeof map !== 'object' || map === null || Array.isArray(map))
14
+ return;
15
+ const declared = Object.getPrototypeOf(map);
16
+ if (declared === null)
17
+ return;
18
+ const copy = Object.assign(Object.create(null), map);
19
+ if (declared !== Object.prototype)
20
+ copy['__proto__'] = declared;
21
+ record[field] = copy;
22
+ }
23
+ function withBareMaps(draft) {
24
+ const keywords = draft.keywords.flatMap((keyword) => {
25
+ const fields = MAPS_BY_KEYWORD[keyword.keyword];
26
+ const parse = keyword.parse;
27
+ if (!fields || !parse)
28
+ return [];
29
+ return [
30
+ {
31
+ ...keyword,
32
+ parse: (node) => {
33
+ const result = parse(node);
34
+ for (const field of fields)
35
+ bare(node, field);
36
+ return result;
37
+ },
38
+ },
39
+ ];
40
+ });
41
+ return extendDraft(draft, { keywords });
42
+ }
43
+ export const DRAFTS = [draft04, draft06, draft07, draft2019, draft2020].map(withBareMaps);
44
+ //# sourceMappingURL=bare-maps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bare-maps.js","sourceRoot":"","sources":["../src/bare-maps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAA+B,MAAM,qBAAqB,CAAA;AAE/H,MAAM,eAAe,GAA6B;IAChD,UAAU,EAAE,CAAC,YAAY,CAAC;IAC1B,gBAAgB,EAAE,CAAC,kBAAkB,CAAC;IACtC,iBAAiB,EAAE,CAAC,mBAAmB,CAAC;IACxC,YAAY,EAAE,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;IACvD,oBAAoB,EAAE,CAAC,sBAAsB,CAAC;CAC/C,CAAA;AAED,sHAAsH;AACtH,SAAS,IAAI,CAAC,IAAgB,EAAE,KAAa;IAC3C,MAAM,MAAM,GAAG,IAA0C,CAAA;IACzD,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IACzB,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI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,CAAC,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { type SchemaNode } from 'json-schema-library';
2
+ import type { Dialect } from './dialect.js';
3
+ export interface LocationInfo {
4
+ readonly key: string;
5
+ readonly cycle: boolean;
6
+ readonly cyclic: boolean;
7
+ readonly expanded: readonly SchemaNode[];
8
+ readonly dead: ReadonlySet<SchemaNode>;
9
+ readonly children: Map<string, readonly SchemaNode[]>;
10
+ items?: readonly SchemaNode[];
11
+ }
12
+ export interface ProjectionCache {
13
+ readonly dialect: Dialect;
14
+ readonly schemaAt: (position: string) => unknown;
15
+ readonly closure: Map<string, readonly string[]>;
16
+ readonly info: Map<string, LocationInfo>;
17
+ readonly cyclic: ReadonlySet<string>;
18
+ }
19
+ export declare function newProjectionCache(dialect: Dialect, cyclic: ReadonlySet<string>, schemaAt: (position: string) => unknown): ProjectionCache;
20
+ export declare function onlyPoints(node: SchemaNode): boolean;
21
+ export declare function positionOf(node: SchemaNode): string;
22
+ export declare function followRef(node: SchemaNode): SchemaNode | undefined;
23
+ export declare function locationInfo(declaring: readonly SchemaNode[], cache: ProjectionCache): LocationInfo;
24
+ export declare function childDeclaring(info: LocationInfo, key: string): readonly SchemaNode[];
25
+ export declare function itemDeclaring(info: LocationInfo): readonly SchemaNode[];
26
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAG3C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAA;IACxC,QAA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