@speclynx/apidom-reference 4.12.0 → 4.13.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,16 @@
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.13.0](https://github.com/speclynx/apidom/compare/v4.12.1...v4.13.0) (2026-06-23)
7
+
8
+ ### Features
9
+
10
+ - **reference:** add OpenAPI 2.0 bundle strategy ([#360](https://github.com/speclynx/apidom/issues/360)) ([29a1b3f](https://github.com/speclynx/apidom/commit/29a1b3f05ecdf12bf9003af96e19c6dedb4e310f)), closes [#351](https://github.com/speclynx/apidom/issues/351)
11
+
12
+ ## [4.12.1](https://github.com/speclynx/apidom/compare/v4.12.0...v4.12.1) (2026-06-23)
13
+
14
+ **Note:** Version bump only for package @speclynx/apidom-reference
15
+
6
16
  # [4.12.0](https://github.com/speclynx/apidom/compare/v4.11.1...v4.12.0) (2026-06-23)
7
17
 
8
18
  ### Features
package/README.md CHANGED
@@ -2707,7 +2707,59 @@ 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 two (2) default bundle strategies.
2710
+ every strategy differs significantly. `Bundle component` comes with three (3) default bundle strategies.
2711
+
2712
+ ##### [openapi-2](https://github.com/speclynx/apidom/tree/main/packages/apidom-reference/src/bundle/strategies/openapi-2)
2713
+
2714
+ Bundle strategy for bundling [OpenAPI 2.0](https://spec.openapis.org/oas/v2.0.html) (Swagger) definitions.
2715
+
2716
+ It produces a self-contained, transferable Compound Document: every external reference is resolved and lifted
2717
+ into the matching top-level definition field, and the referencing `$ref` is rewritten to an internal JSON
2718
+ Pointer. Unlike OpenAPI 3.x, OpenAPI 2.0 has no single Components Object — reusable definitions live directly
2719
+ under the document root, so the three hoist targets are:
2720
+
2721
+ - external Schema Objects (JSON References) → `definitions`
2722
+ - external Parameter Objects → `parameters`
2723
+ - external Response Objects → `responses`
2724
+
2725
+ External Path Item Objects have no definition field to hold them, so they are inlined in place (after bundling
2726
+ their own external references); a circular external Path Item retains its cycle-breaking `$ref` rather than
2727
+ collapsing to an empty object. Multiple references to the **same** external target (same document URI and JSON
2728
+ Pointer) are collapsed into a single component; distinct targets each get their own component, even when their
2729
+ content happens to be identical. Internal references are preserved untouched; only a self-file reference (e.g.
2730
+ `./root.json#/definitions/Pet`) is normalized to a bare fragment (`#/definitions/Pet`) so the bundled document
2731
+ remains transferable.
2732
+
2733
+ Supported media types:
2734
+
2735
+ ```js
2736
+ [
2737
+ 'application/vnd.oai.openapi;version=2.0',
2738
+ 'application/vnd.oai.openapi+json;version=2.0',
2739
+ 'application/vnd.oai.openapi+yaml;version=2.0'
2740
+ ]
2741
+ ```
2742
+
2743
+ This strategy's behavior is controlled by the same `bundle` options as the `openapi-3-0` strategy
2744
+ (`componentNamesStrategy`, `onComponentNameCollision`, `immutable`, `maxDepth`, `continueOnError`, `refSet`),
2745
+ documented below. Per-strategy overrides use the `openapi-2` key in `bundle.strategyOpts`:
2746
+
2747
+ ```js
2748
+ import { bundle } from '@speclynx/apidom-reference';
2749
+
2750
+ await bundle('/home/user/swagger.json', {
2751
+ parse: {
2752
+ mediaType: 'application/vnd.oai.openapi+json;version=2.0',
2753
+ },
2754
+ bundle: {
2755
+ strategyOpts: {
2756
+ 'openapi-2': {
2757
+ onComponentNameCollision: 'error',
2758
+ },
2759
+ },
2760
+ },
2761
+ });
2762
+ ```
2711
2763
 
2712
2764
  ##### [openapi-3-0](https://github.com/speclynx/apidom/tree/main/packages/apidom-reference/src/bundle/strategies/openapi-3-0)
2713
2765
 
@@ -2843,6 +2895,7 @@ returns `true` or until entire list of strategies is exhausted (throws error).
2843
2895
 
2844
2896
  ```js
2845
2897
  [
2898
+ new OpenAPI2BundleStrategy(),
2846
2899
  new OpenAPI3_0BundleStrategy(),
2847
2900
  new OpenAPI3_1BundleStrategy(),
2848
2901
  ]