@speclynx/apidom-reference 2.6.1 → 2.8.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 +60 -33
- package/dist/apidom-reference.browser.js +349 -99
- package/dist/apidom-reference.browser.min.js +1 -1
- package/package.json +25 -25
- package/src/configuration/saturated.cjs +2 -4
- package/src/configuration/saturated.mjs +3 -5
- package/src/dereference/strategies/arazzo-1/index.cjs +10 -0
- package/src/dereference/strategies/arazzo-1/index.mjs +10 -0
- package/src/dereference/strategies/arazzo-1/source-description.cjs +179 -0
- package/src/dereference/strategies/arazzo-1/source-description.mjs +172 -0
- package/src/dereference/strategies/openapi-3-0/visitor.cjs +2 -2
- package/src/dereference/strategies/openapi-3-0/visitor.mjs +2 -2
- package/src/dereference/strategies/openapi-3-1/visitor.cjs +2 -2
- package/src/dereference/strategies/openapi-3-1/visitor.mjs +2 -2
- package/src/parse/parsers/arazzo-json-1/index.cjs +3 -5
- package/src/parse/parsers/arazzo-json-1/index.mjs +3 -5
- package/src/parse/parsers/arazzo-json-1/{source-description.cjs → source-descriptions.cjs} +47 -21
- package/src/parse/parsers/arazzo-json-1/{source-description.mjs → source-descriptions.mjs} +47 -22
- package/src/parse/parsers/arazzo-yaml-1/index.cjs +3 -5
- package/src/parse/parsers/arazzo-yaml-1/index.mjs +3 -5
- package/src/parse/parsers/arazzo-yaml-1/source-descriptions.cjs +12 -0
- package/src/parse/parsers/arazzo-yaml-1/source-descriptions.mjs +7 -0
- package/src/resolve/resolvers/file/index-browser.cjs +1 -1
- package/src/resolve/resolvers/file/index-browser.mjs +1 -1
- package/types/dereference/strategies/arazzo-1/source-description.d.ts +8 -0
- package/types/parse/parsers/arazzo-json-1/index.d.ts +1 -3
- package/types/parse/parsers/arazzo-json-1/source-descriptions.d.ts +31 -0
- package/types/parse/parsers/arazzo-yaml-1/index.d.ts +1 -3
- package/types/parse/parsers/arazzo-yaml-1/source-descriptions.d.ts +6 -0
- package/types/parse/parsers/arazzo-json-1/source-description.d.ts +0 -13
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
|
+
# [2.8.0](https://github.com/speclynx/apidom/compare/v2.7.0...v2.8.0) (2026-02-06)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **reference:** expose low level API for parsing Arazzo source descriptions ([#73](https://github.com/speclynx/apidom/issues/73)) ([1f0d771](https://github.com/speclynx/apidom/commit/1f0d7713f864924e03c601113c0270aeed6e9f81))
|
|
11
|
+
|
|
12
|
+
# [2.7.0](https://github.com/speclynx/apidom/compare/v2.6.1...v2.7.0) (2026-02-05)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **reference:** add support for Arazzo Source Description dereferencing ([#69](https://github.com/speclynx/apidom/issues/69)) ([87efee9](https://github.com/speclynx/apidom/commit/87efee95b86ab6f947ef908db6225b9bb60d7a40))
|
|
17
|
+
|
|
6
18
|
## [2.6.1](https://github.com/speclynx/apidom/compare/v2.6.0...v2.6.1) (2026-02-04)
|
|
7
19
|
|
|
8
20
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -292,25 +292,6 @@ Supported media types are:
|
|
|
292
292
|
]
|
|
293
293
|
```
|
|
294
294
|
|
|
295
|
-
##### Constructor options
|
|
296
|
-
|
|
297
|
-
In addition to standard parser plugin options (`allowEmpty`, `sourceMap`, etc.), this parser accepts:
|
|
298
|
-
|
|
299
|
-
- **parseFn** - A function used to parse source descriptions. When provided, enables the `sourceDescriptions` feature.
|
|
300
|
-
In saturated configuration, this is automatically set to the `parse` function.
|
|
301
|
-
|
|
302
|
-
```js
|
|
303
|
-
import { parse } from '@speclynx/apidom-reference';
|
|
304
|
-
import ArazzoJSON1Parser from '@speclynx/apidom-reference/parse/parsers/arazzo-json-1';
|
|
305
|
-
|
|
306
|
-
// Create parser with parseFn to enable source descriptions feature
|
|
307
|
-
const parser = new ArazzoJSON1Parser({
|
|
308
|
-
allowEmpty: true,
|
|
309
|
-
sourceMap: false,
|
|
310
|
-
parseFn: parse, // pass the parse function to enable recursive parsing
|
|
311
|
-
});
|
|
312
|
-
```
|
|
313
|
-
|
|
314
295
|
##### Parser options
|
|
315
296
|
|
|
316
297
|
The following options can be passed via `parse.parserOpts` (globally) or `parse.parserOpts['arazzo-json-1']` (parser-specific).
|
|
@@ -337,7 +318,7 @@ with an `'error'` class within the parse result:
|
|
|
337
318
|
an error annotation is returned for that specific source description while other source descriptions
|
|
338
319
|
continue to be processed
|
|
339
320
|
- **Validation warnings** - Warning annotations (with `'warning'` class) are returned when prerequisites
|
|
340
|
-
for parsing are not met (e.g., API is not an Arazzo specification
|
|
321
|
+
for parsing are not met (e.g., API is not an Arazzo specification)
|
|
341
322
|
|
|
342
323
|
```js
|
|
343
324
|
import { parse } from '@speclynx/apidom-reference';
|
|
@@ -386,13 +367,6 @@ Supported media types are:
|
|
|
386
367
|
]
|
|
387
368
|
```
|
|
388
369
|
|
|
389
|
-
##### Constructor options
|
|
390
|
-
|
|
391
|
-
In addition to standard parser plugin options (`allowEmpty`, `sourceMap`, etc.), this parser accepts:
|
|
392
|
-
|
|
393
|
-
- **parseFn** - A function used to parse source descriptions. When provided, enables the `sourceDescriptions` feature.
|
|
394
|
-
In saturated configuration, this is automatically set to the `parse` function.
|
|
395
|
-
|
|
396
370
|
##### Parser options
|
|
397
371
|
|
|
398
372
|
The following options can be passed via `parse.parserOpts` (globally) or `parse.parserOpts['arazzo-yaml-1']` (parser-specific).
|
|
@@ -468,8 +442,8 @@ returns `true` or until entire list of parser plugins is exhausted (throws error
|
|
|
468
442
|
new OpenAPIYAML3_1Parser({ allowEmpty: true, sourceMap: false }),
|
|
469
443
|
new AsyncAPIJSON2Parser({ allowEmpty: true, sourceMap: false }),
|
|
470
444
|
new AsyncAPIYAML2Parser({ allowEmpty: true, sourceMap: false }),
|
|
471
|
-
new ArazzoJSON1Parser({ allowEmpty: true, sourceMap: false
|
|
472
|
-
new ArazzoYAML1Parser({ allowEmpty: true, sourceMap: false
|
|
445
|
+
new ArazzoJSON1Parser({ allowEmpty: true, sourceMap: false }),
|
|
446
|
+
new ArazzoYAML1Parser({ allowEmpty: true, sourceMap: false }),
|
|
473
447
|
new APIDesignSystemsJSONParser({ allowEmpty: true, sourceMap: false }),
|
|
474
448
|
new APIDesignSystemsYAMLParser({ allowEmpty: true, sourceMap: false }),
|
|
475
449
|
new APIDOMJSONParser({ allowEmpty: true, sourceMap: false }),
|
|
@@ -509,8 +483,8 @@ options.parse.parsers = [
|
|
|
509
483
|
new OpenAPIYAML3_1Parser({ allowEmpty: true, sourceMap: false }),
|
|
510
484
|
new AsyncAPIJSON2Parser({ allowEmpty: true, sourceMap: false }),
|
|
511
485
|
new AsyncAPIYAML2Parser({ allowEmpty: true, sourceMap: false }),
|
|
512
|
-
new ArazzoJSON1Parser({ allowEmpty: true, sourceMap: false
|
|
513
|
-
new ArazzoYAML1Parser({ allowEmpty: true, sourceMap: false
|
|
486
|
+
new ArazzoJSON1Parser({ allowEmpty: true, sourceMap: false }),
|
|
487
|
+
new ArazzoYAML1Parser({ allowEmpty: true, sourceMap: false }),
|
|
514
488
|
new APIDesignSystemsJSONParser({ allowEmpty: true, sourceMap: false }),
|
|
515
489
|
new APIDesignSystemsYAMLParser({ allowEmpty: true, sourceMap: false }),
|
|
516
490
|
new APIDOMJSONParser({ allowEmpty: true, sourceMap: false }),
|
|
@@ -551,8 +525,8 @@ await parse('/home/user/oas.json', {
|
|
|
551
525
|
new OpenAPIYAML3_1Parser({ allowEmpty: true, sourceMap: false }),
|
|
552
526
|
new AsyncAPIJSON2Parser({ allowEmpty: true, sourceMap: false }),
|
|
553
527
|
new AsyncAPIYAML2Parser({ allowEmpty: true, sourceMap: false }),
|
|
554
|
-
new ArazzoJSON1Parser({ allowEmpty: true, sourceMap: false
|
|
555
|
-
new ArazzoYAML1Parser({ allowEmpty: true, sourceMap: false
|
|
528
|
+
new ArazzoJSON1Parser({ allowEmpty: true, sourceMap: false }),
|
|
529
|
+
new ArazzoYAML1Parser({ allowEmpty: true, sourceMap: false }),
|
|
556
530
|
new APIDesignSystemsJSONParser({ allowEmpty: true, sourceMap: false }),
|
|
557
531
|
new APIDesignSystemsYAMLParser({ allowEmpty: true, sourceMap: false }),
|
|
558
532
|
new APIDOMJSONParser({ allowEmpty: true, sourceMap: false }),
|
|
@@ -1650,6 +1624,59 @@ Supported media types:
|
|
|
1650
1624
|
]
|
|
1651
1625
|
```
|
|
1652
1626
|
|
|
1627
|
+
###### Strategy options
|
|
1628
|
+
|
|
1629
|
+
The following options can be passed via `dereference.strategyOpts` (globally) or `dereference.strategyOpts['arazzo-1']` (strategy-specific).
|
|
1630
|
+
Strategy-specific options take precedence over global options.
|
|
1631
|
+
|
|
1632
|
+
- **sourceDescriptions** - Controls which external source descriptions are dereferenced and included in the result.
|
|
1633
|
+
- `true` - dereference all source descriptions
|
|
1634
|
+
- `string[]` - dereference only source descriptions with matching names (e.g., `['petStore', 'paymentApi']`)
|
|
1635
|
+
|
|
1636
|
+
Each dereferenced source description is added with a `'source-description'` class and metadata (`name`, `type`).
|
|
1637
|
+
Only OpenAPI 2.0, OpenAPI 3.0.x, OpenAPI 3.1.x, and Arazzo 1.x documents are accepted as source descriptions.
|
|
1638
|
+
- **sourceDescriptionsMaxDepth** - Maximum recursion depth for dereferencing nested Arazzo source descriptions.
|
|
1639
|
+
Defaults to `+Infinity`. Circular references are automatically detected and skipped.
|
|
1640
|
+
|
|
1641
|
+
###### Error handling
|
|
1642
|
+
|
|
1643
|
+
The source descriptions dereferencing uses annotations instead of throwing errors, allowing dereferencing to continue
|
|
1644
|
+
even when individual source descriptions fail. Errors are reported as `AnnotationElement` instances
|
|
1645
|
+
with an `'error'` class within the result:
|
|
1646
|
+
|
|
1647
|
+
- **Max depth exceeded** - When `sourceDescriptionsMaxDepth` is reached, an error annotation is returned
|
|
1648
|
+
instead of the nested source descriptions
|
|
1649
|
+
- **Dereference failures** - If a source description file cannot be dereferenced (e.g., file not found, invalid syntax),
|
|
1650
|
+
an error annotation is returned for that specific source description while other source descriptions
|
|
1651
|
+
continue to be processed
|
|
1652
|
+
- **Validation warnings** - Warning annotations (with `'warning'` class) are returned when the dereferenced document
|
|
1653
|
+
is not an OpenAPI or Arazzo specification
|
|
1654
|
+
|
|
1655
|
+
```js
|
|
1656
|
+
import { dereference } from '@speclynx/apidom-reference';
|
|
1657
|
+
|
|
1658
|
+
// Dereference all source descriptions
|
|
1659
|
+
const result = await dereference('/path/to/arazzo.json', {
|
|
1660
|
+
dereference: {
|
|
1661
|
+
strategyOpts: {
|
|
1662
|
+
sourceDescriptions: true,
|
|
1663
|
+
sourceDescriptionsMaxDepth: 10,
|
|
1664
|
+
},
|
|
1665
|
+
},
|
|
1666
|
+
});
|
|
1667
|
+
|
|
1668
|
+
// Dereference only specific source descriptions by name
|
|
1669
|
+
const resultFiltered = await dereference('/path/to/arazzo.json', {
|
|
1670
|
+
dereference: {
|
|
1671
|
+
strategyOpts: {
|
|
1672
|
+
'arazzo-1': {
|
|
1673
|
+
sourceDescriptions: ['petStore', 'paymentApi'],
|
|
1674
|
+
},
|
|
1675
|
+
},
|
|
1676
|
+
},
|
|
1677
|
+
});
|
|
1678
|
+
```
|
|
1679
|
+
|
|
1653
1680
|
##### [openapi-2](https://github.com/speclynx/apidom/tree/main/packages/apidom-reference/src/dereference/strategies/openapi-2)
|
|
1654
1681
|
|
|
1655
1682
|
Dereference strategy for dereferencing [OpenApi 2.0](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md) definitions.
|