@speclynx/apidom-reference 5.2.4 → 5.2.5

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 (51) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +30 -11
  3. package/dist/apidom-reference.browser.js +1121 -514
  4. package/dist/apidom-reference.browser.min.js +1 -1
  5. package/package.json +28 -28
  6. package/src/bundle/strategies/arazzo-1/visitor.cjs +105 -22
  7. package/src/bundle/strategies/arazzo-1/visitor.mjs +107 -24
  8. package/src/bundle/strategies/openapi-3-1/visitor.cjs +197 -47
  9. package/src/bundle/strategies/openapi-3-1/visitor.mjs +200 -50
  10. package/src/bundle/util.cjs +57 -2
  11. package/src/bundle/util.mjs +52 -0
  12. package/src/dereference/strategies/arazzo-1/index.cjs +9 -7
  13. package/src/dereference/strategies/arazzo-1/index.mjs +3 -1
  14. package/src/dereference/strategies/arazzo-1/selectors/$anchor.cjs +6 -0
  15. package/src/dereference/strategies/arazzo-1/selectors/$anchor.mjs +1 -1
  16. package/src/dereference/strategies/arazzo-1/selectors/uri.cjs +6 -0
  17. package/src/dereference/strategies/arazzo-1/selectors/uri.mjs +1 -1
  18. package/src/dereference/strategies/arazzo-1/util.cjs +6 -0
  19. package/src/dereference/strategies/arazzo-1/util.mjs +1 -1
  20. package/src/dereference/strategies/arazzo-1/visitor.cjs +67 -9
  21. package/src/dereference/strategies/arazzo-1/visitor.mjs +71 -13
  22. package/src/dereference/strategies/openapi-3-1/index.cjs +2 -1
  23. package/src/dereference/strategies/openapi-3-1/index.mjs +3 -1
  24. package/src/dereference/strategies/openapi-3-1/selectors/$anchor.cjs +16 -4
  25. package/src/dereference/strategies/openapi-3-1/selectors/$anchor.mjs +14 -3
  26. package/src/dereference/strategies/openapi-3-1/selectors/json-pointer.cjs +29 -0
  27. package/src/dereference/strategies/openapi-3-1/selectors/json-pointer.mjs +22 -0
  28. package/src/dereference/strategies/openapi-3-1/selectors/uri.cjs +54 -27
  29. package/src/dereference/strategies/openapi-3-1/selectors/uri.mjs +51 -27
  30. package/src/dereference/strategies/openapi-3-1/util.cjs +75 -14
  31. package/src/dereference/strategies/openapi-3-1/util.mjs +68 -14
  32. package/src/dereference/strategies/openapi-3-1/visitor.cjs +85 -9
  33. package/src/dereference/strategies/openapi-3-1/visitor.mjs +89 -13
  34. package/src/util/url.cjs +35 -2
  35. package/src/util/url.mjs +32 -0
  36. package/types/apidom-reference.d.ts +12 -0
  37. package/types/bundle/strategies/arazzo-1/index.d.ts +1 -1
  38. package/types/bundle/strategies/arazzo-1/visitor.d.ts +51 -6
  39. package/types/bundle/strategies/openapi-3-1/index.d.ts +1 -1
  40. package/types/bundle/strategies/openapi-3-1/visitor.d.ts +59 -3
  41. package/types/bundle/util.d.ts +39 -0
  42. package/types/dereference/strategies/arazzo-1/selectors/$anchor.d.ts +1 -1
  43. package/types/dereference/strategies/arazzo-1/selectors/uri.d.ts +1 -1
  44. package/types/dereference/strategies/arazzo-1/util.d.ts +1 -1
  45. package/types/dereference/strategies/arazzo-1/visitor.d.ts +17 -1
  46. package/types/dereference/strategies/openapi-3-1/selectors/$anchor.d.ts +8 -0
  47. package/types/dereference/strategies/openapi-3-1/selectors/json-pointer.d.ts +9 -0
  48. package/types/dereference/strategies/openapi-3-1/selectors/uri.d.ts +37 -4
  49. package/types/dereference/strategies/openapi-3-1/util.d.ts +53 -2
  50. package/types/dereference/strategies/openapi-3-1/visitor.d.ts +17 -1
  51. package/types/util/url.d.ts +10 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.2.5](https://github.com/speclynx/apidom/compare/v5.2.4...v5.2.5) (2026-09-17)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **reference:** assign relative $id to embedded schema resources ([#543](https://github.com/speclynx/apidom/issues/543)) ([3ba02e8](https://github.com/speclynx/apidom/commit/3ba02e82ea22a93b40d04c43ec190810a0f4b177)), closes [#531](https://github.com/speclynx/apidom/issues/531)
11
+ - **reference:** defer bundle placement until entry traversal ends ([#538](https://github.com/speclynx/apidom/issues/538)) ([e70f735](https://github.com/speclynx/apidom/commit/e70f73503f21074dda67928d223842df1bdf43f9)), closes [#535](https://github.com/speclynx/apidom/issues/535)
12
+ - **reference:** embed sibling $id schemas of hoisted OAS 3.1 content ([#547](https://github.com/speclynx/apidom/issues/547)) ([65d0998](https://github.com/speclynx/apidom/commit/65d09986191ea5dfb12ee63b78a56bba8ca18057)), closes [#546](https://github.com/speclynx/apidom/issues/546)
13
+ - **reference:** rebase schema $ref onto embedded resource $id ([#532](https://github.com/speclynx/apidom/issues/532)) ([840c89c](https://github.com/speclynx/apidom/commit/840c89cdddab270ac6cdc389fc27c8be24e4a857)), closes [#530](https://github.com/speclynx/apidom/issues/530) [#531](https://github.com/speclynx/apidom/issues/531) [usearazzo/arazzo-toolkit#158](https://github.com/usearazzo/arazzo-toolkit/issues/158)
14
+ - **reference:** relocate schema $refs in hoisted OAS 3.1 components ([#542](https://github.com/speclynx/apidom/issues/542)) ([71e067b](https://github.com/speclynx/apidom/commit/71e067b019f809f37a08cb185d61a75d9d07715b)), closes [#537](https://github.com/speclynx/apidom/issues/537)
15
+ - **reference:** resolve schema $id lookups against document base URI ([#539](https://github.com/speclynx/apidom/issues/539)) ([e4763fa](https://github.com/speclynx/apidom/commit/e4763fada3b569c5811b1a8f02014017ef1d2679)), closes [#536](https://github.com/speclynx/apidom/issues/536)
16
+ - **reference:** resolve schema $id within referenced OAS 3.1 fragments ([#545](https://github.com/speclynx/apidom/issues/545)) ([c69ab53](https://github.com/speclynx/apidom/commit/c69ab531bde79a10bdd7406d9c8f56ea7536436b)), closes [#541](https://github.com/speclynx/apidom/issues/541)
17
+
6
18
  ## [5.2.4](https://github.com/speclynx/apidom/compare/v5.2.3...v5.2.4) (2026-09-15)
7
19
 
8
20
  **Note:** Version bump only for package @speclynx/apidom-reference
package/README.md CHANGED
@@ -2909,12 +2909,26 @@ inlined in place. Example Object `externalValue` content is inlined, and an exte
2909
2909
 
2910
2910
  **Schema Objects** are a [JSON Schema 2020-12](https://json-schema.org/draft/2020-12) dialect and are
2911
2911
  bundled per the [JSON Schema Compound Document](https://json-schema.org/blog/posts/bundling-json-schema-compound-documents)
2912
- rules: the external schema **resource** is embedded verbatim into `components.schemas` carrying its `$id`
2913
- (one is assigned from the retrieval URI when absent), and the referencing `$ref` is left **unchanged** — it
2914
- keeps resolving against the embedded resource's `$id`. The whole external resource is embedded once, keyed by
2915
- its `$id`; references (including `$anchor`, `$dynamicRef`, and `$dynamicAnchor`) are never rewritten. Nested
2916
- external schema resources are embedded flat into the top-level `components.schemas`, deduplicated by resource
2917
- URI. Internal Schema Object references are preserved untouched.
2912
+ rules: the external schema **resource** is embedded verbatim into `components.schemas` carrying its `$id`.
2913
+ A resource without a `$id` of its own gets one assigned as a URI-reference relative to the entry document's
2914
+ base URI (e.g. `schemas/ex.json`), so the bundle carries no absolute filesystem paths and stays self-contained
2915
+ when moved as a directory tree. The referencing `$ref` is **rebased** onto the embedded
2916
+ resource's `$id` (keeping any `$anchor` or JSON Pointer fragment) whenever it resolves to a different URI —
2917
+ e.g. `./ex.json#/$defs/Pet` becomes `https://example.com/schemas/pets#/$defs/Pet` — since once embedded the
2918
+ resource is reachable only by its `$id`; a `$ref` that already resolves to that `$id` is left unchanged. The
2919
+ whole external resource is embedded once, keyed by its `$id`; `$anchor`, `$dynamicRef`, and `$dynamicAnchor`
2920
+ inside the embedded resource are preserved verbatim. Nested external `$ref`s inside an embedded resource are
2921
+ bundled the same way — the nested resource is embedded flat into the top-level `components.schemas`,
2922
+ deduplicated by resource URI, and the nested `$ref` is rebased onto its `$id` when needed. Internal Schema
2923
+ Object references are preserved untouched.
2924
+
2925
+ A Schema Object carried inside a hoisted component (a Response, Parameter, Request Body, Path Item, ...) changes
2926
+ its base URI on relocation — from the hoisted document's to the entry document's — so a location-based `$ref`
2927
+ in it is rewritten to address the embedded resource from the entry document: by the resource's declared `$id`,
2928
+ or, when the `$id` was assigned from the retrieval URI, by a URI reference relative to the entry document
2929
+ (e.g. `./pet.json` inside `responses/ok.json` becomes `responses/pet.json`), keeping any fragment. A `$ref`
2930
+ that resolves to the same URI from the entry document — under an absolute `$id`, or from a hoisted document
2931
+ sitting next to the entry document — is left as written.
2918
2932
 
2919
2933
  Multiple references to the **same** external target are collapsed into a single component; distinct targets
2920
2934
  each get their own component, even when their content happens to be identical. Internal Reference Objects are
@@ -2971,11 +2985,16 @@ The only external references Arazzo defines are **JSON Schema Objects** — a
2971
2985
  external documents that are intentionally kept external — neither is bundled.) Schema Objects are therefore
2972
2986
  bundled per the [JSON Schema Compound Document](https://json-schema.org/blog/posts/bundling-json-schema-compound-documents)
2973
2987
  rules, exactly as in the `openapi-3-1` strategy: the external schema **resource** is embedded verbatim into
2974
- `components.inputs` carrying its `$id` (one is assigned from the retrieval URI when absent), and the referencing
2975
- `$ref` is left **unchanged** — it keeps resolving against the embedded resource's `$id`. The whole external
2976
- resource is embedded once, keyed by its `$id`; references (including `$anchor`, `$dynamicRef`, and
2977
- `$dynamicAnchor`) are never rewritten. Nested external schema resources are embedded flat into the top-level
2978
- `components.inputs`, deduplicated by resource URI. Internal Schema Object references are preserved untouched.
2988
+ `components.inputs` carrying its `$id`. A resource without a `$id` of its own is assigned one relative to the
2989
+ entry document's base URI (its `$self` when present), e.g. `schemas/ex.json`. The referencing
2990
+ `$ref` is **rebased** onto the embedded resource's `$id` (keeping any `$anchor` or JSON Pointer fragment)
2991
+ whenever it resolves to a different URI — e.g. `./ex.json#/$defs/Pet` becomes
2992
+ `https://example.com/schemas/pets#/$defs/Pet` — since once embedded the resource is reachable only by its `$id`;
2993
+ a `$ref` that already resolves to that `$id` is left unchanged. The whole external resource is embedded once,
2994
+ keyed by its `$id`; `$anchor`, `$dynamicRef`, and `$dynamicAnchor` inside the embedded resource are preserved
2995
+ verbatim. Nested external `$ref`s inside an embedded resource are bundled the same way — the nested resource is
2996
+ embedded flat into the top-level `components.inputs`, deduplicated by resource URI, and the nested `$ref` is
2997
+ rebased onto its `$id` when needed. Internal Schema Object references are preserved untouched.
2979
2998
  Schema Object `$ref`s are resolved against the document's base URI — the Arazzo Object's `$self` field when
2980
2999
  present (Arazzo 1.1.0), otherwise the retrieval URI — and references resolving into the entry document
2981
3000
  (including by its `$self` identity) are treated as internal.