@speclynx/apidom-reference 4.13.0 → 4.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +99 -3
- package/dist/apidom-reference.browser.js +2076 -216
- package/dist/apidom-reference.browser.min.js +1 -1
- package/package.json +33 -28
- package/src/bundle/strategies/arazzo-1/index.cjs +94 -0
- package/src/bundle/strategies/arazzo-1/index.mjs +81 -0
- package/src/bundle/strategies/arazzo-1/visitor.cjs +417 -0
- package/src/bundle/strategies/arazzo-1/visitor.mjs +409 -0
- package/src/bundle/strategies/openapi-2/visitor.cjs +8 -16
- package/src/bundle/strategies/openapi-2/visitor.mjs +8 -16
- package/src/bundle/strategies/openapi-3-0/visitor.cjs +10 -18
- package/src/bundle/strategies/openapi-3-0/visitor.mjs +10 -18
- package/src/bundle/strategies/openapi-3-1/index.cjs +59 -2
- package/src/bundle/strategies/openapi-3-1/index.mjs +54 -2
- package/src/bundle/strategies/openapi-3-1/visitor.cjs +811 -0
- package/src/bundle/strategies/openapi-3-1/visitor.mjs +803 -0
- package/src/configuration/saturated.cjs +10 -9
- package/src/configuration/saturated.mjs +2 -1
- package/src/util/url.cjs +26 -4
- package/src/util/url.mjs +23 -2
- package/types/apidom-reference.d.ts +10 -0
- package/types/bundle/strategies/arazzo-1/index.d.ts +31 -0
- package/types/bundle/strategies/arazzo-1/visitor.d.ts +90 -0
- package/types/bundle/strategies/openapi-2/visitor.d.ts +2 -2
- package/types/bundle/strategies/openapi-3-0/visitor.d.ts +2 -2
- package/types/bundle/strategies/openapi-3-1/index.d.ts +6 -1
- package/types/bundle/strategies/openapi-3-1/visitor.d.ts +141 -0
- package/types/util/url.d.ts +8 -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
|
+
# [4.15.0](https://github.com/speclynx/apidom/compare/v4.14.0...v4.15.0) (2026-06-24)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **reference:** add Arazzo 1 bundle strategy ([#367](https://github.com/speclynx/apidom/issues/367)) ([c2bbf7f](https://github.com/speclynx/apidom/commit/c2bbf7f27214839d7288c6439ec482e4094756a3))
|
|
11
|
+
|
|
12
|
+
# [4.14.0](https://github.com/speclynx/apidom/compare/v4.13.0...v4.14.0) (2026-06-23)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **reference:** add OpenAPI 3.1 bundle strategy ([#361](https://github.com/speclynx/apidom/issues/361)) ([ab3effb](https://github.com/speclynx/apidom/commit/ab3effb7d1f19ae4d757ba222b194e477e64d6e8)), closes [#351](https://github.com/speclynx/apidom/issues/351)
|
|
17
|
+
|
|
6
18
|
# [4.13.0](https://github.com/speclynx/apidom/compare/v4.12.1...v4.13.0) (2026-06-23)
|
|
7
19
|
|
|
8
20
|
### Features
|
package/README.md
CHANGED
|
@@ -2863,9 +2863,27 @@ the original.
|
|
|
2863
2863
|
|
|
2864
2864
|
Bundle strategy for bundling [OpenApi 3.1.x](https://spec.openapis.org/oas/v3.1.2.html) definitions.
|
|
2865
2865
|
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2866
|
+
It produces a self-contained, transferable Compound Document. **Reference Objects** are bundled exactly as
|
|
2867
|
+
in the `openapi-3-0` strategy: every external reference is resolved and lifted into the appropriate
|
|
2868
|
+
`components` field, and the referencing `$ref` is rewritten to an internal JSON Pointer. The one upgrade
|
|
2869
|
+
over 3.0 is **Path Item Objects** — OpenAPI 3.1 adds a `components.pathItems` field, so an external Path
|
|
2870
|
+
Item is hoisted there (and its `$ref` rewritten to `#/components/pathItems/<name>`) instead of being
|
|
2871
|
+
inlined in place. Example Object `externalValue` content is inlined, and an external Link Object
|
|
2872
|
+
`operationRef` is rewritten to an absolute URI so the link stays resolvable.
|
|
2873
|
+
|
|
2874
|
+
**Schema Objects** are a [JSON Schema 2020-12](https://json-schema.org/draft/2020-12) dialect and are
|
|
2875
|
+
bundled per the [JSON Schema Compound Document](https://json-schema.org/blog/posts/bundling-json-schema-compound-documents)
|
|
2876
|
+
rules: the external schema **resource** is embedded verbatim into `components.schemas` carrying its `$id`
|
|
2877
|
+
(one is assigned from the retrieval URI when absent), and the referencing `$ref` is left **unchanged** — it
|
|
2878
|
+
keeps resolving against the embedded resource's `$id`. The whole external resource is embedded once, keyed by
|
|
2879
|
+
its `$id`; references (including `$anchor`, `$dynamicRef`, and `$dynamicAnchor`) are never rewritten. Nested
|
|
2880
|
+
external schema resources are embedded flat into the top-level `components.schemas`, deduplicated by resource
|
|
2881
|
+
URI. Internal Schema Object references are preserved untouched.
|
|
2882
|
+
|
|
2883
|
+
Multiple references to the **same** external target are collapsed into a single component; distinct targets
|
|
2884
|
+
each get their own component, even when their content happens to be identical. Internal Reference Objects are
|
|
2885
|
+
preserved untouched; only a self-file reference (e.g. `./root.json#/components/parameters/userId`) is
|
|
2886
|
+
normalized to a bare fragment (`#/components/parameters/userId`) so the bundled document remains transferable.
|
|
2869
2887
|
|
|
2870
2888
|
Supported media types:
|
|
2871
2889
|
|
|
@@ -2883,6 +2901,83 @@ Supported media types:
|
|
|
2883
2901
|
]
|
|
2884
2902
|
```
|
|
2885
2903
|
|
|
2904
|
+
This strategy's behavior is controlled by the same `bundle` options as the `openapi-3-0` strategy
|
|
2905
|
+
(`componentNamesStrategy`, `onComponentNameCollision`, `immutable`, `maxDepth`, `continueOnError`, `refSet`),
|
|
2906
|
+
documented above. Per-strategy overrides use the `openapi-3-1` key in `bundle.strategyOpts`:
|
|
2907
|
+
|
|
2908
|
+
```js
|
|
2909
|
+
import { bundle } from '@speclynx/apidom-reference';
|
|
2910
|
+
|
|
2911
|
+
await bundle('/home/user/oas.json', {
|
|
2912
|
+
parse: {
|
|
2913
|
+
mediaType: 'application/openapi+json;version=3.1.0',
|
|
2914
|
+
},
|
|
2915
|
+
bundle: {
|
|
2916
|
+
strategyOpts: {
|
|
2917
|
+
'openapi-3-1': {
|
|
2918
|
+
onComponentNameCollision: 'error',
|
|
2919
|
+
},
|
|
2920
|
+
},
|
|
2921
|
+
},
|
|
2922
|
+
});
|
|
2923
|
+
```
|
|
2924
|
+
|
|
2925
|
+
Hoisted components and embedded schema resources are annotated with a `ref-origin` meta field pointing at
|
|
2926
|
+
their source document. The bundling process is **immutable** by default (`bundle.immutable: true`).
|
|
2927
|
+
|
|
2928
|
+
##### [arazzo-1](https://github.com/speclynx/apidom/tree/main/packages/apidom-reference/src/bundle/strategies/arazzo-1)
|
|
2929
|
+
|
|
2930
|
+
Bundle strategy for bundling [Arazzo 1.x](https://spec.openapis.org/arazzo/latest.html) definitions.
|
|
2931
|
+
|
|
2932
|
+
The only external references Arazzo defines are **JSON Schema Objects** — a
|
|
2933
|
+
[JSON Schema 2020-12](https://json-schema.org/draft/2020-12) dialect used by Input Objects and inline schemas.
|
|
2934
|
+
(Reusable Objects are internal-only runtime-expression references, and Source Descriptions point at whole
|
|
2935
|
+
external documents that are intentionally kept external — neither is bundled.) Schema Objects are therefore
|
|
2936
|
+
bundled per the [JSON Schema Compound Document](https://json-schema.org/blog/posts/bundling-json-schema-compound-documents)
|
|
2937
|
+
rules, exactly as in the `openapi-3-1` strategy: the external schema **resource** is embedded verbatim into
|
|
2938
|
+
`components.inputs` carrying its `$id` (one is assigned from the retrieval URI when absent), and the referencing
|
|
2939
|
+
`$ref` is left **unchanged** — it keeps resolving against the embedded resource's `$id`. The whole external
|
|
2940
|
+
resource is embedded once, keyed by its `$id`; references (including `$anchor`, `$dynamicRef`, and
|
|
2941
|
+
`$dynamicAnchor`) are never rewritten. Nested external schema resources are embedded flat into the top-level
|
|
2942
|
+
`components.inputs`, deduplicated by resource URI. Internal Schema Object references are preserved untouched.
|
|
2943
|
+
|
|
2944
|
+
Supported media types:
|
|
2945
|
+
|
|
2946
|
+
```js
|
|
2947
|
+
[
|
|
2948
|
+
'application/vnd.oai.workflows;version=1.0.0',
|
|
2949
|
+
'application/vnd.oai.workflows+json;version=1.0.0',
|
|
2950
|
+
'application/vnd.oai.workflows+yaml;version=1.0.0',
|
|
2951
|
+
'application/vnd.oai.workflows;version=1.0.1',
|
|
2952
|
+
'application/vnd.oai.workflows+json;version=1.0.1',
|
|
2953
|
+
'application/vnd.oai.workflows+yaml;version=1.0.1'
|
|
2954
|
+
]
|
|
2955
|
+
```
|
|
2956
|
+
|
|
2957
|
+
This strategy's behavior is controlled by the same `bundle` options as the `openapi-3-1` strategy
|
|
2958
|
+
(`componentNamesStrategy`, `onComponentNameCollision`, `immutable`, `maxDepth`, `continueOnError`, `refSet`),
|
|
2959
|
+
documented above. Per-strategy overrides use the `arazzo-1` key in `bundle.strategyOpts`:
|
|
2960
|
+
|
|
2961
|
+
```js
|
|
2962
|
+
import { bundle } from '@speclynx/apidom-reference';
|
|
2963
|
+
|
|
2964
|
+
await bundle('/home/user/arazzo.json', {
|
|
2965
|
+
parse: {
|
|
2966
|
+
mediaType: 'application/vnd.oai.workflows+json;version=1.0.1',
|
|
2967
|
+
},
|
|
2968
|
+
bundle: {
|
|
2969
|
+
strategyOpts: {
|
|
2970
|
+
'arazzo-1': {
|
|
2971
|
+
onComponentNameCollision: 'error',
|
|
2972
|
+
},
|
|
2973
|
+
},
|
|
2974
|
+
},
|
|
2975
|
+
});
|
|
2976
|
+
```
|
|
2977
|
+
|
|
2978
|
+
Embedded schema resources are annotated with a `ref-origin` meta field pointing at their source document.
|
|
2979
|
+
The bundling process is **immutable** by default (`bundle.immutable: true`).
|
|
2980
|
+
|
|
2886
2981
|
##### Bundle strategies execution order
|
|
2887
2982
|
|
|
2888
2983
|
It's important to understand that default bundle strategies are run in specific order. The order is determined
|
|
@@ -2898,6 +2993,7 @@ returns `true` or until entire list of strategies is exhausted (throws error).
|
|
|
2898
2993
|
new OpenAPI2BundleStrategy(),
|
|
2899
2994
|
new OpenAPI3_0BundleStrategy(),
|
|
2900
2995
|
new OpenAPI3_1BundleStrategy(),
|
|
2996
|
+
new Arazzo1BundleStrategy(),
|
|
2901
2997
|
]
|
|
2902
2998
|
```
|
|
2903
2999
|
Most specific strategies are listed first, most generic are listed last.
|