@speclynx/apidom-reference 5.2.4 → 5.2.6
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.
- package/CHANGELOG.md +19 -0
- package/README.md +37 -14
- package/dist/apidom-reference.browser.js +1234 -596
- package/dist/apidom-reference.browser.min.js +1 -1
- package/package.json +29 -29
- package/src/bundle/strategies/arazzo-1/visitor.cjs +105 -22
- package/src/bundle/strategies/arazzo-1/visitor.mjs +107 -24
- package/src/bundle/strategies/openapi-3-1/visitor.cjs +197 -47
- package/src/bundle/strategies/openapi-3-1/visitor.mjs +200 -50
- package/src/bundle/util.cjs +57 -2
- package/src/bundle/util.mjs +52 -0
- package/src/dereference/strategies/arazzo-1/index.cjs +20 -17
- package/src/dereference/strategies/arazzo-1/index.mjs +14 -11
- package/src/dereference/strategies/arazzo-1/selectors/$anchor.cjs +6 -0
- package/src/dereference/strategies/arazzo-1/selectors/$anchor.mjs +1 -1
- package/src/dereference/strategies/arazzo-1/selectors/uri.cjs +6 -0
- package/src/dereference/strategies/arazzo-1/selectors/uri.mjs +1 -1
- package/src/dereference/strategies/arazzo-1/source-descriptions.cjs +65 -42
- package/src/dereference/strategies/arazzo-1/source-descriptions.mjs +64 -42
- package/src/dereference/strategies/arazzo-1/util.cjs +6 -0
- package/src/dereference/strategies/arazzo-1/util.mjs +1 -1
- package/src/dereference/strategies/arazzo-1/visitor.cjs +97 -35
- package/src/dereference/strategies/arazzo-1/visitor.mjs +101 -39
- package/src/dereference/strategies/openapi-3-1/index.cjs +2 -1
- package/src/dereference/strategies/openapi-3-1/index.mjs +3 -1
- package/src/dereference/strategies/openapi-3-1/selectors/$anchor.cjs +16 -4
- package/src/dereference/strategies/openapi-3-1/selectors/$anchor.mjs +14 -3
- package/src/dereference/strategies/openapi-3-1/selectors/json-pointer.cjs +29 -0
- package/src/dereference/strategies/openapi-3-1/selectors/json-pointer.mjs +22 -0
- package/src/dereference/strategies/openapi-3-1/selectors/uri.cjs +54 -27
- package/src/dereference/strategies/openapi-3-1/selectors/uri.mjs +51 -27
- package/src/dereference/strategies/openapi-3-1/util.cjs +75 -14
- package/src/dereference/strategies/openapi-3-1/util.mjs +68 -14
- package/src/dereference/strategies/openapi-3-1/visitor.cjs +85 -9
- package/src/dereference/strategies/openapi-3-1/visitor.mjs +89 -13
- package/src/util/url.cjs +35 -2
- package/src/util/url.mjs +32 -0
- package/types/apidom-reference.d.ts +12 -0
- package/types/bundle/strategies/arazzo-1/index.d.ts +1 -1
- package/types/bundle/strategies/arazzo-1/visitor.d.ts +51 -6
- package/types/bundle/strategies/openapi-3-1/index.d.ts +1 -1
- package/types/bundle/strategies/openapi-3-1/visitor.d.ts +59 -3
- package/types/bundle/util.d.ts +39 -0
- package/types/dereference/strategies/arazzo-1/selectors/$anchor.d.ts +1 -1
- package/types/dereference/strategies/arazzo-1/selectors/uri.d.ts +1 -1
- package/types/dereference/strategies/arazzo-1/util.d.ts +1 -1
- package/types/dereference/strategies/arazzo-1/visitor.d.ts +17 -1
- package/types/dereference/strategies/openapi-3-1/selectors/$anchor.d.ts +8 -0
- package/types/dereference/strategies/openapi-3-1/selectors/json-pointer.d.ts +9 -0
- package/types/dereference/strategies/openapi-3-1/selectors/uri.d.ts +37 -4
- package/types/dereference/strategies/openapi-3-1/util.d.ts +53 -2
- package/types/dereference/strategies/openapi-3-1/visitor.d.ts +17 -1
- package/types/util/url.d.ts +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.6](https://github.com/speclynx/apidom/compare/v5.2.5...v5.2.6) (2026-09-19)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **reference:** honour continueOnError for Arazzo Reusable Objects ([#552](https://github.com/speclynx/apidom/issues/552)) ([2bcd675](https://github.com/speclynx/apidom/commit/2bcd675d16fc1bf3fc5079fdee37419c1d84017c)), closes [#550](https://github.com/speclynx/apidom/issues/550)
|
|
11
|
+
- **reference:** isolate refSet of Arazzo source descriptions ([#553](https://github.com/speclynx/apidom/issues/553)) ([ac21c16](https://github.com/speclynx/apidom/commit/ac21c165104e604aa59f027a8d78645c8bd9ca66)), closes [#551](https://github.com/speclynx/apidom/issues/551)
|
|
12
|
+
|
|
13
|
+
## [5.2.5](https://github.com/speclynx/apidom/compare/v5.2.4...v5.2.5) (2026-09-17)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- **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)
|
|
18
|
+
- **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)
|
|
19
|
+
- **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)
|
|
20
|
+
- **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)
|
|
21
|
+
- **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)
|
|
22
|
+
- **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)
|
|
23
|
+
- **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)
|
|
24
|
+
|
|
6
25
|
## [5.2.4](https://github.com/speclynx/apidom/compare/v5.2.3...v5.2.4) (2026-09-15)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @speclynx/apidom-reference
|
package/README.md
CHANGED
|
@@ -2071,6 +2071,10 @@ Strategy-specific options take precedence over global options.
|
|
|
2071
2071
|
The `SourceDescriptionElement`'s `'parseResult'` meta points at that same `ParseResultElement`, so the dereferenced
|
|
2072
2072
|
document is reachable from every source description that references it.
|
|
2073
2073
|
|
|
2074
|
+
When `dereference.refSet` is provided, source descriptions reuse the documents it already contains,
|
|
2075
|
+
and every document reached through a source description is added to it.
|
|
2076
|
+
This is also how resolving with `sourceDescriptions` enabled reports the documents behind source descriptions.
|
|
2077
|
+
|
|
2074
2078
|
###### Error handling
|
|
2075
2079
|
|
|
2076
2080
|
The source descriptions dereferencing uses annotations instead of throwing errors, allowing dereferencing to continue
|
|
@@ -2496,16 +2500,16 @@ await dereference('/home/user/oas.json', {
|
|
|
2496
2500
|
// errors is an array of UnresolvableReferenceError instances
|
|
2497
2501
|
```
|
|
2498
2502
|
|
|
2499
|
-
Each `UnresolvableReferenceError` (extends `
|
|
2503
|
+
Each `UnresolvableReferenceError` (extends `ResolveError`) carries structured context:
|
|
2500
2504
|
|
|
2501
2505
|
| Property | Type | Description |
|
|
2502
2506
|
|---|---|---|
|
|
2503
2507
|
| `message` | `string` | Contextual description (e.g., "Error while dereferencing Reference Object. Cannot resolve $ref ...") |
|
|
2504
|
-
| `type` | `string` | Element type that failed (e.g., `"reference"`, `"pathItem"`, `"schema"`, `"link"`, `"example"`) |
|
|
2508
|
+
| `type` | `string` | Element type that failed (e.g., `"reference"`, `"pathItem"`, `"schema"`, `"link"`, `"example"`, `"reusable"`) |
|
|
2505
2509
|
| `uri` | `string` | Document URI where the error occurred |
|
|
2506
2510
|
| `location` | `string` | JSON Pointer to the element within the document |
|
|
2507
2511
|
| `codeFrame` | `string` | YAML snippet of the referencing element |
|
|
2508
|
-
| `refFieldName` | `string` | Reference field name (e.g., `"$ref"`, `"operationRef"`, `"externalValue"`) |
|
|
2512
|
+
| `refFieldName` | `string` | Reference field name (e.g., `"$ref"`, `"operationRef"`, `"externalValue"`, `"reference"`) |
|
|
2509
2513
|
| `refFieldValue` | `string` | Reference field value |
|
|
2510
2514
|
| `trace` | `Array` | Chain of reference hops from entry document to the failure |
|
|
2511
2515
|
| `cause` | `Error` | The underlying error |
|
|
@@ -2909,12 +2913,26 @@ inlined in place. Example Object `externalValue` content is inlined, and an exte
|
|
|
2909
2913
|
|
|
2910
2914
|
**Schema Objects** are a [JSON Schema 2020-12](https://json-schema.org/draft/2020-12) dialect and are
|
|
2911
2915
|
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
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2916
|
+
rules: the external schema **resource** is embedded verbatim into `components.schemas` carrying its `$id`.
|
|
2917
|
+
A resource without a `$id` of its own gets one assigned as a URI-reference relative to the entry document's
|
|
2918
|
+
base URI (e.g. `schemas/ex.json`), so the bundle carries no absolute filesystem paths and stays self-contained
|
|
2919
|
+
when moved as a directory tree. The referencing `$ref` is **rebased** onto the embedded
|
|
2920
|
+
resource's `$id` (keeping any `$anchor` or JSON Pointer fragment) whenever it resolves to a different URI —
|
|
2921
|
+
e.g. `./ex.json#/$defs/Pet` becomes `https://example.com/schemas/pets#/$defs/Pet` — since once embedded the
|
|
2922
|
+
resource is reachable only by its `$id`; a `$ref` that already resolves to that `$id` is left unchanged. The
|
|
2923
|
+
whole external resource is embedded once, keyed by its `$id`; `$anchor`, `$dynamicRef`, and `$dynamicAnchor`
|
|
2924
|
+
inside the embedded resource are preserved verbatim. Nested external `$ref`s inside an embedded resource are
|
|
2925
|
+
bundled the same way — the nested resource is embedded flat into the top-level `components.schemas`,
|
|
2926
|
+
deduplicated by resource URI, and the nested `$ref` is rebased onto its `$id` when needed. Internal Schema
|
|
2927
|
+
Object references are preserved untouched.
|
|
2928
|
+
|
|
2929
|
+
A Schema Object carried inside a hoisted component (a Response, Parameter, Request Body, Path Item, ...) changes
|
|
2930
|
+
its base URI on relocation — from the hoisted document's to the entry document's — so a location-based `$ref`
|
|
2931
|
+
in it is rewritten to address the embedded resource from the entry document: by the resource's declared `$id`,
|
|
2932
|
+
or, when the `$id` was assigned from the retrieval URI, by a URI reference relative to the entry document
|
|
2933
|
+
(e.g. `./pet.json` inside `responses/ok.json` becomes `responses/pet.json`), keeping any fragment. A `$ref`
|
|
2934
|
+
that resolves to the same URI from the entry document — under an absolute `$id`, or from a hoisted document
|
|
2935
|
+
sitting next to the entry document — is left as written.
|
|
2918
2936
|
|
|
2919
2937
|
Multiple references to the **same** external target are collapsed into a single component; distinct targets
|
|
2920
2938
|
each get their own component, even when their content happens to be identical. Internal Reference Objects are
|
|
@@ -2971,11 +2989,16 @@ The only external references Arazzo defines are **JSON Schema Objects** — a
|
|
|
2971
2989
|
external documents that are intentionally kept external — neither is bundled.) Schema Objects are therefore
|
|
2972
2990
|
bundled per the [JSON Schema Compound Document](https://json-schema.org/blog/posts/bundling-json-schema-compound-documents)
|
|
2973
2991
|
rules, exactly as in the `openapi-3-1` strategy: the external schema **resource** is embedded verbatim into
|
|
2974
|
-
`components.inputs` carrying its `$id
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
`
|
|
2992
|
+
`components.inputs` carrying its `$id`. A resource without a `$id` of its own is assigned one relative to the
|
|
2993
|
+
entry document's base URI (its `$self` when present), e.g. `schemas/ex.json`. The referencing
|
|
2994
|
+
`$ref` is **rebased** onto the embedded resource's `$id` (keeping any `$anchor` or JSON Pointer fragment)
|
|
2995
|
+
whenever it resolves to a different URI — e.g. `./ex.json#/$defs/Pet` becomes
|
|
2996
|
+
`https://example.com/schemas/pets#/$defs/Pet` — since once embedded the resource is reachable only by its `$id`;
|
|
2997
|
+
a `$ref` that already resolves to that `$id` is left unchanged. The whole external resource is embedded once,
|
|
2998
|
+
keyed by its `$id`; `$anchor`, `$dynamicRef`, and `$dynamicAnchor` inside the embedded resource are preserved
|
|
2999
|
+
verbatim. Nested external `$ref`s inside an embedded resource are bundled the same way — the nested resource is
|
|
3000
|
+
embedded flat into the top-level `components.inputs`, deduplicated by resource URI, and the nested `$ref` is
|
|
3001
|
+
rebased onto its `$id` when needed. Internal Schema Object references are preserved untouched.
|
|
2979
3002
|
Schema Object `$ref`s are resolved against the document's base URI — the Arazzo Object's `$self` field when
|
|
2980
3003
|
present (Arazzo 1.1.0), otherwise the retrieval URI — and references resolving into the entry document
|
|
2981
3004
|
(including by its `$self` identity) are treated as internal.
|