@speclynx/apidom-reference 4.13.0 → 4.14.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 CHANGED
@@ -3,6 +3,12 @@
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.14.0](https://github.com/speclynx/apidom/compare/v4.13.0...v4.14.0) (2026-06-23)
7
+
8
+ ### Features
9
+
10
+ - **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)
11
+
6
12
  # [4.13.0](https://github.com/speclynx/apidom/compare/v4.12.1...v4.13.0) (2026-06-23)
7
13
 
8
14
  ### 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
- > **Note:** this strategy is **not implemented yet**. It matches OpenAPI 3.1.x
2867
- > documents but currently returns the parse result unchanged (no references are
2868
- > resolved or hoisted). For real bundling, use OpenAPI 3.0.x for now.
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,30 @@ 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
+
2886
2928
  ##### Bundle strategies execution order
2887
2929
 
2888
2930
  It's important to understand that default bundle strategies are run in specific order. The order is determined