@speclynx/apidom-reference 4.14.0 → 4.16.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 +133 -1
- package/dist/apidom-reference.browser.js +2043 -49
- package/dist/apidom-reference.browser.min.js +1 -1
- package/package.json +38 -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/asyncapi-2/index.cjs +94 -0
- package/src/bundle/strategies/asyncapi-2/index.mjs +81 -0
- package/src/bundle/strategies/asyncapi-2/visitor.cjs +571 -0
- package/src/bundle/strategies/asyncapi-2/visitor.mjs +563 -0
- package/src/configuration/saturated.cjs +11 -9
- package/src/configuration/saturated.mjs +3 -1
- 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/asyncapi-2/index.d.ts +31 -0
- package/types/bundle/strategies/asyncapi-2/visitor.d.ts +116 -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.16.0](https://github.com/speclynx/apidom/compare/v4.15.0...v4.16.0) (2026-06-24)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **reference:** add AsyncAPI 2 bundle strategy ([#368](https://github.com/speclynx/apidom/issues/368)) ([32acbe8](https://github.com/speclynx/apidom/commit/32acbe80604b26dcdf03292c2010e58ea74b81f8))
|
|
11
|
+
|
|
12
|
+
# [4.15.0](https://github.com/speclynx/apidom/compare/v4.14.0...v4.15.0) (2026-06-24)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **reference:** add Arazzo 1 bundle strategy ([#367](https://github.com/speclynx/apidom/issues/367)) ([c2bbf7f](https://github.com/speclynx/apidom/commit/c2bbf7f27214839d7288c6439ec482e4094756a3))
|
|
17
|
+
|
|
6
18
|
# [4.14.0](https://github.com/speclynx/apidom/compare/v4.13.0...v4.14.0) (2026-06-23)
|
|
7
19
|
|
|
8
20
|
### Features
|
package/README.md
CHANGED
|
@@ -2707,7 +2707,7 @@ await bundle('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/e
|
|
|
2707
2707
|
#### [Bundle strategies](https://github.com/speclynx/apidom/tree/main/packages/apidom-reference/src/bundle/strategies)
|
|
2708
2708
|
|
|
2709
2709
|
Bundle strategy determines how a document is bundled into a Compound Document. Depending on document `mediaType` option,
|
|
2710
|
-
every strategy differs significantly. `Bundle component` comes with
|
|
2710
|
+
every strategy differs significantly. `Bundle component` comes with five (5) default bundle strategies.
|
|
2711
2711
|
|
|
2712
2712
|
##### [openapi-2](https://github.com/speclynx/apidom/tree/main/packages/apidom-reference/src/bundle/strategies/openapi-2)
|
|
2713
2713
|
|
|
@@ -2925,6 +2925,136 @@ await bundle('/home/user/oas.json', {
|
|
|
2925
2925
|
Hoisted components and embedded schema resources are annotated with a `ref-origin` meta field pointing at
|
|
2926
2926
|
their source document. The bundling process is **immutable** by default (`bundle.immutable: true`).
|
|
2927
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
|
+
|
|
2981
|
+
##### [asyncapi-2](https://github.com/speclynx/apidom/tree/main/packages/apidom-reference/src/bundle/strategies/asyncapi-2)
|
|
2982
|
+
|
|
2983
|
+
Bundle strategy for bundling [AsyncAPI 2.x](https://www.asyncapi.com/docs/reference/specification/v2.6.0) definitions.
|
|
2984
|
+
|
|
2985
|
+
It produces a self-contained, transferable Compound Document: every external reference is resolved and lifted
|
|
2986
|
+
into the appropriate `components` field, and the referencing `$ref` is rewritten to an internal JSON Pointer.
|
|
2987
|
+
**Reference Objects** are bundled exactly as in the `openapi-3-0` strategy, hoisted into the `components`
|
|
2988
|
+
field that matches their referencing context (Schema Objects → `components.schemas`, Message Objects →
|
|
2989
|
+
`components.messages`, Parameter Objects → `components.parameters`, and likewise for `servers`,
|
|
2990
|
+
`serverVariables`, `securitySchemes`, `correlationIds`, `operationTraits`, `messageTraits`, and the binding
|
|
2991
|
+
fields). Unlike OpenAPI, **Schema Objects** in AsyncAPI 2.0 are an [extended JSON Schema Draft 7](https://www.asyncapi.com/docs/reference/specification/v2.6.0#schemaObject)
|
|
2992
|
+
dialect that does **not** use `$id`-based resolution — a schema `$ref` is a plain Reference Object resolved by
|
|
2993
|
+
JSON Pointer, so schemas are hoisted into `components.schemas` like any other Reference Object rather than
|
|
2994
|
+
embedded as JSON Schema compound resources.
|
|
2995
|
+
|
|
2996
|
+
**Channel Item Objects** have a `components.channels` field in AsyncAPI 2.0, so an external Channel Item is
|
|
2997
|
+
hoisted there (and its `$ref` rewritten to `#/components/channels/<name>`); sibling fields next to the `$ref`
|
|
2998
|
+
(e.g. `description`) are kept on the referencing element.
|
|
2999
|
+
|
|
3000
|
+
Multiple references to the **same** external target (same document URI and JSON Pointer) are collapsed into a
|
|
3001
|
+
single component; distinct targets each get their own component, even when their content happens to be
|
|
3002
|
+
identical. Internal references are preserved untouched; only a self-file reference (e.g.
|
|
3003
|
+
`./root.json#/components/messages/UserSignedUp`) is normalized to a bare fragment
|
|
3004
|
+
(`#/components/messages/UserSignedUp`) so the bundled document remains transferable.
|
|
3005
|
+
|
|
3006
|
+
Supported media types:
|
|
3007
|
+
|
|
3008
|
+
```js
|
|
3009
|
+
[
|
|
3010
|
+
'application/vnd.aai.asyncapi;version=2.0.0',
|
|
3011
|
+
'application/vnd.aai.asyncapi+json;version=2.0.0',
|
|
3012
|
+
'application/vnd.aai.asyncapi+yaml;version=2.0.0',
|
|
3013
|
+
'application/vnd.aai.asyncapi;version=2.1.0',
|
|
3014
|
+
'application/vnd.aai.asyncapi+json;version=2.1.0',
|
|
3015
|
+
'application/vnd.aai.asyncapi+yaml;version=2.1.0',
|
|
3016
|
+
'application/vnd.aai.asyncapi;version=2.2.0',
|
|
3017
|
+
'application/vnd.aai.asyncapi+json;version=2.2.0',
|
|
3018
|
+
'application/vnd.aai.asyncapi+yaml;version=2.2.0',
|
|
3019
|
+
'application/vnd.aai.asyncapi;version=2.3.0',
|
|
3020
|
+
'application/vnd.aai.asyncapi+json;version=2.3.0',
|
|
3021
|
+
'application/vnd.aai.asyncapi+yaml;version=2.3.0',
|
|
3022
|
+
'application/vnd.aai.asyncapi;version=2.4.0',
|
|
3023
|
+
'application/vnd.aai.asyncapi+json;version=2.4.0',
|
|
3024
|
+
'application/vnd.aai.asyncapi+yaml;version=2.4.0',
|
|
3025
|
+
'application/vnd.aai.asyncapi;version=2.5.0',
|
|
3026
|
+
'application/vnd.aai.asyncapi+json;version=2.5.0',
|
|
3027
|
+
'application/vnd.aai.asyncapi+yaml;version=2.5.0',
|
|
3028
|
+
'application/vnd.aai.asyncapi;version=2.6.0',
|
|
3029
|
+
'application/vnd.aai.asyncapi+json;version=2.6.0',
|
|
3030
|
+
'application/vnd.aai.asyncapi+yaml;version=2.6.0'
|
|
3031
|
+
]
|
|
3032
|
+
```
|
|
3033
|
+
|
|
3034
|
+
This strategy's behavior is controlled by the same `bundle` options as the `openapi-3-0` strategy
|
|
3035
|
+
(`componentNamesStrategy`, `onComponentNameCollision`, `immutable`, `maxDepth`, `continueOnError`, `refSet`),
|
|
3036
|
+
documented above. Per-strategy overrides use the `asyncapi-2` key in `bundle.strategyOpts`:
|
|
3037
|
+
|
|
3038
|
+
```js
|
|
3039
|
+
import { bundle } from '@speclynx/apidom-reference';
|
|
3040
|
+
|
|
3041
|
+
await bundle('/home/user/asyncapi.json', {
|
|
3042
|
+
parse: {
|
|
3043
|
+
mediaType: 'application/vnd.aai.asyncapi+json;version=2.6.0',
|
|
3044
|
+
},
|
|
3045
|
+
bundle: {
|
|
3046
|
+
strategyOpts: {
|
|
3047
|
+
'asyncapi-2': {
|
|
3048
|
+
onComponentNameCollision: 'error',
|
|
3049
|
+
},
|
|
3050
|
+
},
|
|
3051
|
+
},
|
|
3052
|
+
});
|
|
3053
|
+
```
|
|
3054
|
+
|
|
3055
|
+
Hoisted components are annotated with a `ref-origin` meta field pointing at their source document.
|
|
3056
|
+
The bundling process is **immutable** by default (`bundle.immutable: true`).
|
|
3057
|
+
|
|
2928
3058
|
##### Bundle strategies execution order
|
|
2929
3059
|
|
|
2930
3060
|
It's important to understand that default bundle strategies are run in specific order. The order is determined
|
|
@@ -2940,6 +3070,8 @@ returns `true` or until entire list of strategies is exhausted (throws error).
|
|
|
2940
3070
|
new OpenAPI2BundleStrategy(),
|
|
2941
3071
|
new OpenAPI3_0BundleStrategy(),
|
|
2942
3072
|
new OpenAPI3_1BundleStrategy(),
|
|
3073
|
+
new AsyncAPI2BundleStrategy(),
|
|
3074
|
+
new Arazzo1BundleStrategy(),
|
|
2943
3075
|
]
|
|
2944
3076
|
```
|
|
2945
3077
|
Most specific strategies are listed first, most generic are listed last.
|