@speclynx/apidom-reference 2.9.0 → 2.10.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 +6 -0
- package/README.md +11 -5
- package/dist/apidom-reference.browser.js +9 -2
- package/dist/apidom-reference.browser.min.js +1 -1
- package/package.json +25 -25
- package/src/dereference/strategies/arazzo-1/source-descriptions.cjs +5 -1
- package/src/dereference/strategies/arazzo-1/source-descriptions.mjs +5 -1
- package/src/parse/parsers/arazzo-json-1/source-descriptions.cjs +4 -1
- package/src/parse/parsers/arazzo-json-1/source-descriptions.mjs +4 -1
- package/types/dereference/strategies/arazzo-1/source-descriptions.d.ts +4 -1
- package/types/parse/parsers/arazzo-json-1/source-descriptions.d.ts +3 -1
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
|
+
# [2.10.0](https://github.com/speclynx/apidom/compare/v2.9.0...v2.10.0) (2026-02-08)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **reference:** add retrievalURI metadata for Arazzo Source Descriptions ([#79](https://github.com/speclynx/apidom/issues/79)) ([df78cb3](https://github.com/speclynx/apidom/commit/df78cb3226521e6f7097b85cccdbc6b0b39e7a7b))
|
|
11
|
+
|
|
6
12
|
# [2.9.0](https://github.com/speclynx/apidom/compare/v2.8.0...v2.9.0) (2026-02-08)
|
|
7
13
|
|
|
8
14
|
### Features
|
package/README.md
CHANGED
|
@@ -301,7 +301,7 @@ Parser-specific options take precedence over global options.
|
|
|
301
301
|
- `true` - parse all source descriptions
|
|
302
302
|
- `string[]` - parse only source descriptions with matching names (e.g., `['petStore', 'paymentApi']`)
|
|
303
303
|
|
|
304
|
-
Each parsed source description is added with a `'source-description'` class and metadata (`name`, `type`).
|
|
304
|
+
Each parsed source description is added with a `'source-description'` class and metadata (`name`, `type`, `retrievalURI`).
|
|
305
305
|
Only OpenAPI 2.0, OpenAPI 3.0.x, OpenAPI 3.1.x, and Arazzo 1.x documents are accepted as source descriptions.
|
|
306
306
|
- **sourceDescriptionsMaxDepth** - Maximum recursion depth for parsing nested Arazzo source descriptions.
|
|
307
307
|
Defaults to `+Infinity`. Circular references are automatically detected and skipped.
|
|
@@ -321,6 +321,7 @@ with an `'error'` class within the parse result:
|
|
|
321
321
|
for parsing are not met (e.g., API is not an Arazzo specification)
|
|
322
322
|
|
|
323
323
|
```js
|
|
324
|
+
import { toValue } from '@speclynx/apidom-core';
|
|
324
325
|
import { parse } from '@speclynx/apidom-reference';
|
|
325
326
|
|
|
326
327
|
// Parse all source descriptions
|
|
@@ -345,8 +346,9 @@ const parseResultFiltered = await parse('/path/to/arazzo.json', {
|
|
|
345
346
|
// Access parsed source descriptions
|
|
346
347
|
for (const element of parseResult) {
|
|
347
348
|
if (element.classes.includes('source-description')) {
|
|
348
|
-
console.log(element.meta.get('name')
|
|
349
|
-
console.log(element.meta.get('type')
|
|
349
|
+
console.log(toValue(element.meta.get('name'))); // e.g., 'petStore'
|
|
350
|
+
console.log(toValue(element.meta.get('type'))); // e.g., 'openapi'
|
|
351
|
+
console.log(toValue(element.meta.get('retrievalURI'))); // e.g., '/path/to/petstore.json'
|
|
350
352
|
}
|
|
351
353
|
}
|
|
352
354
|
```
|
|
@@ -361,6 +363,7 @@ regardless of success or failure:
|
|
|
361
363
|
- **On failure**: The parseResult contains error/warning annotations explaining what went wrong
|
|
362
364
|
|
|
363
365
|
```js
|
|
366
|
+
import { toValue } from '@speclynx/apidom-core';
|
|
364
367
|
import { parse } from '@speclynx/apidom-reference';
|
|
365
368
|
|
|
366
369
|
const parseResult = await parse('/path/to/arazzo.json', {
|
|
@@ -377,6 +380,7 @@ if (parsedDoc.errors.length > 0) {
|
|
|
377
380
|
console.log('Parsing failed:', parsedDoc.errors);
|
|
378
381
|
} else {
|
|
379
382
|
console.log(parsedDoc.api.element); // e.g., 'openApi3_1'
|
|
383
|
+
console.log(toValue(parsedDoc.meta.get('retrievalURI'))); // URI where it was fetched from
|
|
380
384
|
}
|
|
381
385
|
```
|
|
382
386
|
|
|
@@ -450,7 +454,7 @@ Parser-specific options take precedence over global options. See [arazzo-json-1]
|
|
|
450
454
|
- `true` - parse all source descriptions
|
|
451
455
|
- `string[]` - parse only source descriptions with matching names (e.g., `['petStore', 'paymentApi']`)
|
|
452
456
|
|
|
453
|
-
Each parsed source description is added with a `'source-description'` class and metadata (`name`, `type`).
|
|
457
|
+
Each parsed source description is added with a `'source-description'` class and metadata (`name`, `type`, `retrievalURI`).
|
|
454
458
|
Only OpenAPI 2.0, OpenAPI 3.0.x, OpenAPI 3.1.x, and Arazzo 1.x documents are accepted as source descriptions.
|
|
455
459
|
- **sourceDescriptionsMaxDepth** - Maximum recursion depth for parsing nested Arazzo source descriptions.
|
|
456
460
|
Defaults to `+Infinity`. Circular references are automatically detected and skipped.
|
|
@@ -1756,7 +1760,7 @@ Strategy-specific options take precedence over global options.
|
|
|
1756
1760
|
- `true` - dereference all source descriptions
|
|
1757
1761
|
- `string[]` - dereference only source descriptions with matching names (e.g., `['petStore', 'paymentApi']`)
|
|
1758
1762
|
|
|
1759
|
-
Each dereferenced source description is added with a `'source-description'` class and metadata (`name`, `type`).
|
|
1763
|
+
Each dereferenced source description is added with a `'source-description'` class and metadata (`name`, `type`, `retrievalURI`).
|
|
1760
1764
|
Only OpenAPI 2.0, OpenAPI 3.0.x, OpenAPI 3.1.x, and Arazzo 1.x documents are accepted as source descriptions.
|
|
1761
1765
|
- **sourceDescriptionsMaxDepth** - Maximum recursion depth for dereferencing nested Arazzo source descriptions.
|
|
1762
1766
|
Defaults to `+Infinity`. Circular references are automatically detected and skipped.
|
|
@@ -1810,6 +1814,7 @@ regardless of success or failure:
|
|
|
1810
1814
|
- **On failure**: The parseResult contains error/warning annotations explaining what went wrong
|
|
1811
1815
|
|
|
1812
1816
|
```js
|
|
1817
|
+
import { toValue } from '@speclynx/apidom-core';
|
|
1813
1818
|
import { dereference } from '@speclynx/apidom-reference';
|
|
1814
1819
|
|
|
1815
1820
|
const parseResult = await dereference('/path/to/arazzo.json', {
|
|
@@ -1826,6 +1831,7 @@ if (dereferencedDoc.errors.length > 0) {
|
|
|
1826
1831
|
console.log('Dereferencing failed:', dereferencedDoc.errors);
|
|
1827
1832
|
} else {
|
|
1828
1833
|
console.log(dereferencedDoc.api.element); // e.g., 'openApi3_1'
|
|
1834
|
+
console.log(toValue(dereferencedDoc.meta.get('retrievalURI'))); // URI where it was fetched from
|
|
1829
1835
|
}
|
|
1830
1836
|
```
|
|
1831
1837
|
|
|
@@ -998,6 +998,7 @@ async function dereferenceSourceDescription(sourceDescription, ctx) {
|
|
|
998
998
|
|
|
999
999
|
// normalize URI for consistent cycle detection and refSet cache key matching
|
|
1000
1000
|
const retrievalURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_10__.sanitize(_util_url_ts__WEBPACK_IMPORTED_MODULE_10__.stripHash(_util_url_ts__WEBPACK_IMPORTED_MODULE_10__.resolve(ctx.baseURI, sourceDescriptionURI)));
|
|
1001
|
+
parseResult.setMetaProperty('retrievalURI', retrievalURI);
|
|
1001
1002
|
|
|
1002
1003
|
// skip if already visited (cycle detection)
|
|
1003
1004
|
if (ctx.visitedUrls.has(retrievalURI)) {
|
|
@@ -1111,7 +1112,7 @@ async function dereferenceSourceDescription(sourceDescription, ctx) {
|
|
|
1111
1112
|
* in `dereference.strategyOpts` to filter which source descriptions to process.
|
|
1112
1113
|
* @param strategyName - Strategy name for options lookup (defaults to 'arazzo-1')
|
|
1113
1114
|
* @returns Array of ParseResultElements. Returns one ParseResultElement per source description
|
|
1114
|
-
* (each with class 'source-description' and name
|
|
1115
|
+
* (each with class 'source-description' and metadata: name, type, retrievalURI).
|
|
1115
1116
|
* May return early with a single-element array containing a warning annotation when:
|
|
1116
1117
|
* - The API is not an Arazzo specification
|
|
1117
1118
|
* - The sourceDescriptions field is missing or not an array
|
|
@@ -1120,6 +1121,8 @@ async function dereferenceSourceDescription(sourceDescription, ctx) {
|
|
|
1120
1121
|
*
|
|
1121
1122
|
* @example
|
|
1122
1123
|
* ```typescript
|
|
1124
|
+
* import { toValue } from '@speclynx/apidom-core';
|
|
1125
|
+
*
|
|
1123
1126
|
* // Dereference all source descriptions
|
|
1124
1127
|
* await dereferenceSourceDescriptions(parseResult, uri, options);
|
|
1125
1128
|
*
|
|
@@ -1131,6 +1134,7 @@ async function dereferenceSourceDescription(sourceDescription, ctx) {
|
|
|
1131
1134
|
* // Access dereferenced document from source description element
|
|
1132
1135
|
* const sourceDesc = parseResult.api.sourceDescriptions.get(0);
|
|
1133
1136
|
* const dereferencedDoc = sourceDesc.meta.get('parseResult');
|
|
1137
|
+
* const retrievalURI = toValue(dereferencedDoc.meta.get('retrievalURI'));
|
|
1134
1138
|
* ```
|
|
1135
1139
|
*
|
|
1136
1140
|
* @public
|
|
@@ -5903,6 +5907,7 @@ async function parseSourceDescription(sourceDescription, ctx) {
|
|
|
5903
5907
|
|
|
5904
5908
|
// normalize URI for consistent cycle detection and cache key matching
|
|
5905
5909
|
const retrievalURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_10__.sanitize(_util_url_ts__WEBPACK_IMPORTED_MODULE_10__.stripHash(_util_url_ts__WEBPACK_IMPORTED_MODULE_10__.resolve(ctx.baseURI, sourceDescriptionURI)));
|
|
5910
|
+
parseResult.setMetaProperty('retrievalURI', retrievalURI);
|
|
5906
5911
|
|
|
5907
5912
|
// skip if already visited (cycle detection)
|
|
5908
5913
|
if (ctx.visitedUrls.has(retrievalURI)) {
|
|
@@ -5984,7 +5989,7 @@ async function parseSourceDescription(sourceDescription, ctx) {
|
|
|
5984
5989
|
* in `parse.parserOpts` to filter which source descriptions to process.
|
|
5985
5990
|
* @param parserName - Parser name for options lookup (defaults to 'arazzo-json-1')
|
|
5986
5991
|
* @returns Array of ParseResultElements. Returns one ParseResultElement per source description
|
|
5987
|
-
* (each with class 'source-description' and name
|
|
5992
|
+
* (each with class 'source-description' and metadata: name, type, retrievalURI).
|
|
5988
5993
|
* May return early with a single-element array containing a warning annotation when:
|
|
5989
5994
|
* - The API is not an Arazzo specification
|
|
5990
5995
|
* - The sourceDescriptions field is missing or not an array
|
|
@@ -5993,6 +5998,7 @@ async function parseSourceDescription(sourceDescription, ctx) {
|
|
|
5993
5998
|
*
|
|
5994
5999
|
* @example
|
|
5995
6000
|
* ```typescript
|
|
6001
|
+
* import { toValue } from '@speclynx/apidom-core';
|
|
5996
6002
|
* import { options, mergeOptions } from '@speclynx/apidom-reference';
|
|
5997
6003
|
* import { parseSourceDescriptions } from '@speclynx/apidom-reference/parse/parsers/arazzo-json-1';
|
|
5998
6004
|
*
|
|
@@ -6007,6 +6013,7 @@ async function parseSourceDescription(sourceDescription, ctx) {
|
|
|
6007
6013
|
* // Access parsed document from source description element
|
|
6008
6014
|
* const sourceDesc = parseResult.api.sourceDescriptions.get(0);
|
|
6009
6015
|
* const parsedDoc = sourceDesc.meta.get('parseResult');
|
|
6016
|
+
* const retrievalURI = toValue(parsedDoc.meta.get('retrievalURI'));
|
|
6010
6017
|
* ```
|
|
6011
6018
|
*
|
|
6012
6019
|
* @public
|