@speclynx/apidom-reference 4.15.0 → 5.0.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 +22 -0
- package/README.md +79 -1
- package/dist/apidom-reference.browser.js +8903 -6042
- package/dist/apidom-reference.browser.min.js +1 -1
- package/package.json +34 -29
- 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 -10
- package/src/configuration/saturated.mjs +2 -1
- package/src/dereference/strategies/arazzo-1/visitor.cjs +1 -1
- package/src/dereference/strategies/arazzo-1/visitor.mjs +1 -1
- 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,28 @@
|
|
|
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.0.0](https://github.com/speclynx/apidom/compare/v4.16.0...v5.0.0) (2026-07-07)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **reference:** upgrade arazzo-runtime-expression to v3.0.0 ([#388](https://github.com/speclynx/apidom/issues/388)) ([1ac337a](https://github.com/speclynx/apidom/commit/1ac337afa7fcbfdce7074bd70a95183defaa69f3))
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
- **reference:** in v3:
|
|
15
|
+
The parse result tree structure for ComponentsExpression changed from
|
|
16
|
+
{ type, field, subField } to { type, componentType, componentName }.
|
|
17
|
+
|
|
18
|
+
Updated the arazzo-1 dereference visitor to use the new v3 API.
|
|
19
|
+
|
|
20
|
+
Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
|
|
21
|
+
|
|
22
|
+
# [4.16.0](https://github.com/speclynx/apidom/compare/v4.15.0...v4.16.0) (2026-06-24)
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
- **reference:** add AsyncAPI 2 bundle strategy ([#368](https://github.com/speclynx/apidom/issues/368)) ([32acbe8](https://github.com/speclynx/apidom/commit/32acbe80604b26dcdf03292c2010e58ea74b81f8))
|
|
27
|
+
|
|
6
28
|
# [4.15.0](https://github.com/speclynx/apidom/compare/v4.14.0...v4.15.0) (2026-06-24)
|
|
7
29
|
|
|
8
30
|
### 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
|
|
|
@@ -2978,6 +2978,83 @@ await bundle('/home/user/arazzo.json', {
|
|
|
2978
2978
|
Embedded schema resources are annotated with a `ref-origin` meta field pointing at their source document.
|
|
2979
2979
|
The bundling process is **immutable** by default (`bundle.immutable: true`).
|
|
2980
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
|
+
|
|
2981
3058
|
##### Bundle strategies execution order
|
|
2982
3059
|
|
|
2983
3060
|
It's important to understand that default bundle strategies are run in specific order. The order is determined
|
|
@@ -2993,6 +3070,7 @@ returns `true` or until entire list of strategies is exhausted (throws error).
|
|
|
2993
3070
|
new OpenAPI2BundleStrategy(),
|
|
2994
3071
|
new OpenAPI3_0BundleStrategy(),
|
|
2995
3072
|
new OpenAPI3_1BundleStrategy(),
|
|
3073
|
+
new AsyncAPI2BundleStrategy(),
|
|
2996
3074
|
new Arazzo1BundleStrategy(),
|
|
2997
3075
|
]
|
|
2998
3076
|
```
|