Skip to content

feat(reference): add support for JSON Schema 2020-12 - #5284

Merged
robert-hebel-sb merged 3 commits into
fix/parser-adapter-json-schema-empty-fragmentfrom
feat/json-schema-2020-12/phase-3
Nov 4, 2026
Merged

robert-hebel-sb merged 3 commits into
fix/parser-adapter-json-schema-empty-fragmentfrom
feat/json-schema-2020-12/phase-3

Conversation

@robert-hebel-sb

@robert-hebel-sb robert-hebel-sb commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Phase 3 of 4 for JSON Schema 2020-12 support: apidom-reference.

Stacked on #5286 (the 2020-12 parser adapters accept an empty $schema fragment); its base is that PR's branch until it merges.

Changes

  • apidom-ns-json-schema-2020-12: export keyMap and getNodeType from the index (the README already documented them) and add isBooleanJsonSchemaElement.
  • apidom-reference: parsers json-schema-json-2020-12 / json-schema-yaml-2020-12; resolve, dereference (with selectors/$anchor and selectors/uri) and bundle strategies json-schema-2020-12; registration in saturated.ts; optionalDependencies / devDependencies / exports; README.
  • Dereference is the schema part of the OpenAPI 3.1 strategy: $ref resolves against $id base URIs and $anchor / $dynamicAnchor plain name fragments; $dynamicRef is left in place as in OpenAPI 3.1; continueOnError errors match the OpenAPI 3.1 strategy; a parsed JSON Schema 2020-12 root is accepted without a media type (apidom-ls doDeref). A root schema with $ref stays the parse result's result.
  • Bundle returns the document unchanged, as for OpenAPI 3.1.
  • In the saturated configuration the JSON Schema parsers claim a file only by a 2020-12 media type (detectContent: false): external files referenced from OpenAPI/AsyncAPI documents often declare a root $schema, and those strategies expect generic ApiDOM. Regression tests for OpenAPI 3.1 and 3.2.

Verification

  • build / typescript:check-types / lint / test: pass (apidom-reference 1375 passing, apidom-ns-json-schema-2020-12 74 passing; apidom-ls 669 passing unchanged)
  • dereference coverage: $ref in every schema-valued keyword, Link Description schemas, root $ref, every $dynamicRef unchanged (JSON Schema Test Suite fixtures)
  • verify-urls: only expected findings (README links to the new directories 404 until merge; $id identifiers in test fixtures)

Known gaps

  • Bundling is deferred: bundle() returns the document unchanged (no Compound Schema Document), as for OpenAPI 3.1.
  • $dynamicRef is not dereferenced (left in place), as for OpenAPI 3.1.
  • dereference('schema.json') / parse('schema.json') without a media type don't detect a standalone JSON Schema 2020-12 document and fall back to the ApiDOM strategy, as before; pass a 2020-12 media type or a parsed element.
  • The uri selector (here and in OpenAPI 3.1/3.2) misses a relative $id nested in another relative $id, and the $anchor selector also searches embedded $id resources; both are planned as one follow-up fix for all three selectors.
  • Pre-existing: apidom-ns-arazzo-1 reassigns JSONSchemaElement.refract of the 2020-12 namespace, so with Arazzo loaded a schema using Hyper-Schema links fails to refract through the 2020-12 adapters (fixed separately in fix/ns-arazzo-1-link-description). The new dereference strategy uses the namespace refractor and is not affected.

🤖 Generated with Claude Code

@robert-hebel-sb
robert-hebel-sb force-pushed the feat/json-schema-2020-12/phase-3 branch from f873142 to 9fb2d6a Compare October 28, 2026 13:10
@robert-hebel-sb
robert-hebel-sb removed this pull request from stack #5285 October 28, 2026 13:16
@robert-hebel-sb
robert-hebel-sb changed the base branch from main to fix/parser-adapter-json-schema-empty-fragment October 28, 2026 13:16
@robert-hebel-sb
robert-hebel-sb force-pushed the feat/json-schema-2020-12/phase-3 branch from 9fb2d6a to 7a87d29 Compare October 28, 2026 13:27
@robert-hebel-sb
robert-hebel-sb requested a balanced review from Copilot October 29, 2026 08:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Dereferencing with a precomputed reference set can traverse and return the wrong document, while Boolean-root detection and percent-encoded anchor handling also reject valid schemas or references.

4 open issues
What changed in this PR

Adds standalone JSON Schema 2020-12 support to apidom-reference, building on the parser adapters from #5286.

Changes:

  • Adds JSON/YAML parsers and resolve, dereference, and no-op bundle strategies.
  • Registers the integrations, exposes package entry points, and documents supported behavior.
  • Adds namespace helpers and fixtures covering references, schema keywords, errors, cycles, and OpenAPI interoperability.

Paths below use these abbreviations:

  • R: packages/apidom-reference; N: packages/apidom-ns-json-schema-2020-12.
  • RF / DF: R/test/{resolve|dereference}/strategies/json-schema-2020-12/json-schema/fixtures.
  • BF: R/test/bundle/strategies/json-schema-2020-12/json-schema/fixtures.
  • O31 / O32: R/test/dereference/strategies/openapi-{3-1|3-2}/schema-object.
File Description
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​unresolvable-reference/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​unresolvable-reference/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​max-depth/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​max-depth/​ex3.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​max-depth/​ex2.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​max-depth/​ex1.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​invalid-pointer/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​invalid-pointer/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​internal-only/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​internal-external/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​internal-external/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​infinite-recursion/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-internal-circular/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-external-circular/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-external-circular/​ex3.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-external-circular/​ex2.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-external-circular/​ex1.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​ignore-external/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​ignore-external/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-only/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-only/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-indirections/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-indirections/​ex3.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-indirections/​ex2.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-indirections/​ex1.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-circular-dependency/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-circular-dependency/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​direct-internal-circular/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​direct-external-circular/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​direct-external-circular/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​cycle-internal/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​cycle-internal-external/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​cycle-internal-external/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​cycle-external/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​cycle-external/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-urn/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-urn-pointer/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-urn-$anchor/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-resolvable/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-resolvable/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-resolvable/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-external/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-external/​nested/​nested/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-external/​nested/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-enclosing/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-enclosing/​nested/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-direct/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-direct/​nested/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-unresolvable/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$anchor-not-found/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$anchor-not-found/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$anchor-internal/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$anchor-external/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​resolve/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$anchor-external/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​parse/​parsers/​json-schema-yaml-2020-12/​fixtures/​sample-schema.yaml Updated as part of this pull request.
packages/​apidom-reference/​test/​parse/​parsers/​json-schema-json-2020-12/​fixtures/​sample-schema.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​openapi-3-2/​schema-object/​index.ts Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​openapi-3-2/​schema-object/​fixtures/​external-json-schema-2020-12-documents/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​openapi-3-2/​schema-object/​fixtures/​external-json-schema-2020-12-documents/​ex.yaml Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​openapi-3-2/​schema-object/​fixtures/​external-json-schema-2020-12-documents/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​openapi-3-2/​schema-object/​fixtures/​external-json-schema-2020-12-documents/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​openapi-3-1/​schema-object/​index.ts Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​openapi-3-1/​schema-object/​fixtures/​external-json-schema-2020-12-documents/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​openapi-3-1/​schema-object/​fixtures/​external-json-schema-2020-12-documents/​ex.yaml Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​openapi-3-1/​schema-object/​fixtures/​external-json-schema-2020-12-documents/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​openapi-3-1/​schema-object/​fixtures/​external-json-schema-2020-12-documents/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​yaml/​root.yaml Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​yaml/​ex.yaml Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​yaml/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​unresolvable-reference/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​root-ref/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​root-ref/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​root-ref-boolean/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​reference-errors/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​reference-errors/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​reference-errors/​broken.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​reference-errors-none/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​reference-errors-none/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​merging-keywords/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​merging-keywords/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​merging-keywords/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​max-depth/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​max-depth/​ex3.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​max-depth/​ex2.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​max-depth/​ex1.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​keywords/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​keywords/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​invalid-pointer/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​internal-only/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​internal-only/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​internal-external/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​internal-external/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​internal-external/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​infinite-recursion/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​infinite-recursion/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-internal/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-internal/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-internal-circular/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-internal-circular/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-external-circular/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-external-circular/​ex3.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-external-circular/​ex2.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-external-circular/​ex1.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​indirect-external-circular/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​ignore-external/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​ignore-external/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​ignore-external/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-only/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-only/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-only/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-indirections/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-indirections/​ex3.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-indirections/​ex2.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-indirections/​ex1.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-indirections/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-circular-dependency/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-circular-dependency/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​external-circular-dependency/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​direct-internal-circular/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​direct-external-circular/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​direct-external-circular/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​direct-external-circular/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​cycle-internal/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​cycle-internal-in-array/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​cycle-internal-external/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​cycle-internal-external/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​cycle-internal-advanced/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​cycle-external/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​cycle-external/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​boolean-json-schema/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​boolean-json-schema/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-urn/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-urn/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-urn-unresolvable/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-urn-pointer/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-urn-pointer/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-urn-$anchor/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-urn-$anchor/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-unresolvable/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-resolvable/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-resolvable/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-resolvable/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-relative-reference/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-relative-reference/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-pointer/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-pointer/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-path-override/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-path-override/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-$anchor/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-url-$anchor/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-$dynamicAnchor/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$ref-$dynamicAnchor/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-external/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-external/​nested/​nested/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-external/​nested/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-external/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-external-circular-structures/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-external-circular-structures/​nested/​nested/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-external-circular-structures/​nested/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-external-circular-structures/​dereferenced.txt Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-enclosing/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-enclosing/​nested/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-enclosing/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-direct/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-direct/​nested/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-uri-direct/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$id-unresolvable/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$dynamicRef-json-pointer/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$dynamicRef-json-pointer/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$dynamicRef-boolean-schema/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$dynamicRef-boolean-schema/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$dynamicRef-$dynamicAnchor/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$dynamicRef-$dynamicAnchor/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$dynamicRef-$anchor/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$dynamicRef-$anchor/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$anchor-not-found/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$anchor-internal/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$anchor-internal/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$anchor-internal-no-embedding/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$anchor-internal-no-embedding/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$anchor-external/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$anchor-external/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​test/​dereference/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​$anchor-external/​dereferenced.json Updated as part of this pull request.
packages/​apidom-reference/​test/​bundle/​strategies/​json-schema-2020-12/​json-schema/​index.ts Updated as part of this pull request.
packages/​apidom-reference/​test/​bundle/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​internal-external/​root.json Updated as part of this pull request.
packages/​apidom-reference/​test/​bundle/​strategies/​json-schema-2020-12/​json-schema/​fixtures/​internal-external/​ex.json Updated as part of this pull request.
packages/​apidom-reference/​src/​resolve/​strategies/​json-schema-2020-12/​index.ts Updated as part of this pull request.
packages/​apidom-reference/​src/​parse/​parsers/​json-schema-yaml-2020-12/​index.ts Updated as part of this pull request.
packages/​apidom-reference/​src/​parse/​parsers/​json-schema-json-2020-12/​index.ts Updated as part of this pull request.
packages/​apidom-reference/​src/​dereference/​strategies/​json-schema-2020-12/​util.ts Updated as part of this pull request.
packages/​apidom-reference/​src/​dereference/​strategies/​json-schema-2020-12/​selectors/​uri.ts Updated as part of this pull request.
packages/​apidom-reference/​src/​dereference/​strategies/​json-schema-2020-12/​selectors/​$anchor.ts Updated as part of this pull request.
packages/​apidom-reference/​src/​dereference/​strategies/​json-schema-2020-12/​index.ts Updated as part of this pull request.
packages/​apidom-reference/​src/​configuration/​saturated.ts Updated as part of this pull request.
packages/​apidom-reference/​src/​bundle/​strategies/​json-schema-2020-12/​index.ts Updated as part of this pull request.
packages/​apidom-reference/​README.md Updated as part of this pull request.
packages/​apidom-reference/​package.json Updated as part of this pull request.
packages/​apidom-ns-json-schema-2020-12/​test/​traversal.ts Updated as part of this pull request.
packages/​apidom-ns-json-schema-2020-12/​test/​predicates.ts Updated as part of this pull request.
packages/​apidom-ns-json-schema-2020-12/​src/​predicates.ts Updated as part of this pull request.
packages/​apidom-ns-json-schema-2020-12/​src/​index.ts Updated as part of this pull request.
packages/​apidom-ns-json-schema-2020-12/​README.md Updated as part of this pull request.
package-lock.json Updated as part of this pull request.

Review effort: Balanced


// assert by inspecting ApiDOM
const result = file.parseResult?.result;
return isJSONSchemaElement(result) && result.element === 'JSONSchema202012';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 32f7c16: canBundle also accepts isBooleanJsonSchemaElement roots. Added a test bundling a pre-computed refSet with a true root and no media type.


// assert by inspecting ApiDOM
const result = file.parseResult?.result;
return isJSONSchemaElement(result) && result.element === 'JSONSchema202012';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 32f7c16: canDereference also accepts isBooleanJsonSchemaElement roots (resolve delegates to it, so it's covered too). Added tests for a Boolean parse result and for the Boolean result of root-$ref dereferencing passed to dereferenceApiDOM without a media type, plus canDereference unit tests (tagged vs. generic boolean).

*/
export const uriToAnchor = (uri: string): string => {
const hash = getHash(uri);
return trimCharsStart('#', hash);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 32f7c16: uriToAnchor now percent-decodes the fragment (malformed encoding is returned as is and rejected by isAnchor). Added a fixture with internal #%75ser-profile → $anchor and external ./ex.json#%75ser-name → $dynamicAnchor.

@robert-hebel-sb
robert-hebel-sb force-pushed the feat/json-schema-2020-12/phase-3 branch from 32f7c16 to afce959 Compare October 29, 2026 09:41
RobertHebel and others added 3 commits November 2, 2026 09:33
Export keyMap and getNodeType from the package index: the README already
documented them, the JSON Schema 2020-12 dereference strategy traverses
with them, and swagger-client's JSON Schema strategy imports them from the
published package.

Add isBooleanJsonSchemaElement, so that dereferencing can recognize Boolean
JSON Schemas without depending on an OpenAPI namespace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add parse parsers, and resolve, dereference and bundle strategies named
json-schema-2020-12 for standalone JSON Schema 2020-12 documents, register
them in the saturated configuration and export them, the dereference
selectors included.

The dereference strategy is the schema part of the OpenAPI 3.1 strategy:
$ref resolves against $id base URIs and against $anchor and $dynamicAnchor
plain name fragments, $dynamicRef is left in place as in OpenAPI 3.1, and
errors collected with continueOnError are propagated once the document has
been traversed. It accepts a parsed JSON Schema 2020-12 root without a media
type, which apidom-ls doDeref relies on. When the root schema itself has a
$ref, its replacement stays the result of the parse result.

The bundle strategy returns the document unchanged, as for OpenAPI 3.1;
compound-document bundling is deferred.

In the saturated configuration the parsers claim a file only by a 2020-12
media type (detectContent: false). External files referenced from OpenAPI
and AsyncAPI documents often declare a root $schema, and those strategies
expect them as generic ApiDOM; tests prove that OpenAPI 3.1 and 3.2
documents referencing such files dereference as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- traverse the reference matching the dereferenced file instead of the refSet's root, so a
  pre-computed refSet with several documents dereferences the requested one
- accept Boolean JSON Schema roots in the dereference and bundle strategies when no media type
  is given, so tagged `true`/`false` parse results no longer throw Unmatched*StrategyError
- percent-decode plain name fragments so `$ref: '#%6Eode'` resolves `$anchor`/`$dynamicAnchor`

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@robert-hebel-sb
robert-hebel-sb force-pushed the feat/json-schema-2020-12/phase-3 branch from afce959 to 6ec900a Compare November 2, 2026 08:33
@robert-hebel-sb
robert-hebel-sb merged commit 135f6c7 into main Nov 4, 2026
9 checks passed
@robert-hebel-sb
robert-hebel-sb deleted the feat/json-schema-2020-12/phase-3 branch November 4, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants