@jentic/arazzo-parser 1.0.0-alpha.8 → 1.0.0-alpha.9
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
|
+
# [1.0.0-alpha.9](https://github.com/jentic/jentic-arazzo-tools/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2026-02-05)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **resolver:** add dereferencing support for Arazzo Source Descriptions ([#43](https://github.com/jentic/jentic-arazzo-tools/issues/43)) ([091610b](https://github.com/jentic/jentic-arazzo-tools/commit/091610be81b32540845c7f1cb60dd68348ee282b))
|
|
11
|
+
|
|
6
12
|
# [1.0.0-alpha.8](https://github.com/jentic/jentic-arazzo-tools/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2026-02-05)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @jentic/arazzo-parser
|
|
@@ -89,12 +89,10 @@ const defaultOptions = {
|
|
|
89
89
|
parse: {
|
|
90
90
|
parsers: [new _speclynx_apidom_reference_parse_parsers_arazzo_json_1__WEBPACK_IMPORTED_MODULE_3__["default"]({
|
|
91
91
|
allowEmpty: false,
|
|
92
|
-
fileExtensions: ['.json']
|
|
93
|
-
parseFn: _speclynx_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_0__.parse
|
|
92
|
+
fileExtensions: ['.json']
|
|
94
93
|
}), new _speclynx_apidom_reference_parse_parsers_arazzo_yaml_1__WEBPACK_IMPORTED_MODULE_4__["default"]({
|
|
95
94
|
allowEmpty: false,
|
|
96
|
-
fileExtensions: ['.yaml', '.yml']
|
|
97
|
-
parseFn: _speclynx_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_0__.parse
|
|
95
|
+
fileExtensions: ['.yaml', '.yml']
|
|
98
96
|
}), new _speclynx_apidom_reference_parse_parsers_openapi_json_2__WEBPACK_IMPORTED_MODULE_5__["default"]({
|
|
99
97
|
allowEmpty: false,
|
|
100
98
|
fileExtensions: ['.json']
|
|
@@ -43775,10 +43773,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
43775
43773
|
*/
|
|
43776
43774
|
class ArazzoJSON1Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["default"] {
|
|
43777
43775
|
refractorOpts;
|
|
43778
|
-
parseFn;
|
|
43779
43776
|
constructor(options) {
|
|
43780
43777
|
const {
|
|
43781
|
-
parseFn,
|
|
43782
43778
|
fileExtensions = [],
|
|
43783
43779
|
mediaTypes = _speclynx_apidom_parser_adapter_arazzo_json_1__WEBPACK_IMPORTED_MODULE_2__["default"],
|
|
43784
43780
|
...rest
|
|
@@ -43789,7 +43785,6 @@ class ArazzoJSON1Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["defaul
|
|
|
43789
43785
|
fileExtensions,
|
|
43790
43786
|
mediaTypes
|
|
43791
43787
|
});
|
|
43792
|
-
this.parseFn = parseFn;
|
|
43793
43788
|
}
|
|
43794
43789
|
async canParse(file) {
|
|
43795
43790
|
const hasSupportedFileExtension = this.fileExtensions.length === 0 ? true : this.fileExtensions.includes(file.extension);
|
|
@@ -43808,7 +43803,7 @@ class ArazzoJSON1Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["defaul
|
|
|
43808
43803
|
const parseResult = await (0,_speclynx_apidom_parser_adapter_arazzo_json_1__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
|
|
43809
43804
|
const shouldParseSourceDescriptions = options?.parse?.parserOpts?.[this.name]?.sourceDescriptions ?? options?.parse?.parserOpts?.sourceDescriptions;
|
|
43810
43805
|
if (shouldParseSourceDescriptions) {
|
|
43811
|
-
const sourceDescriptions = await _source_description_mjs__WEBPACK_IMPORTED_MODULE_5__.parseSourceDescriptions
|
|
43806
|
+
const sourceDescriptions = await (0,_source_description_mjs__WEBPACK_IMPORTED_MODULE_5__.parseSourceDescriptions)(this.name, parseResult.api, file, options);
|
|
43812
43807
|
parseResult.push(...sourceDescriptions);
|
|
43813
43808
|
}
|
|
43814
43809
|
return parseResult;
|
|
@@ -43842,6 +43837,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
43842
43837
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(7456);
|
|
43843
43838
|
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(30698);
|
|
43844
43839
|
/* harmony import */ var _options_util_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(8841);
|
|
43840
|
+
/* harmony import */ var _index_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(62792);
|
|
43841
|
+
|
|
43845
43842
|
|
|
43846
43843
|
|
|
43847
43844
|
|
|
@@ -43858,7 +43855,7 @@ const ARAZZO_RECURSION_KEY = 'arazzo-1';
|
|
|
43858
43855
|
async function parseSourceDescription(sourceDescription, ctx) {
|
|
43859
43856
|
const parseResult = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"]();
|
|
43860
43857
|
if (!(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_4__.isSourceDescriptionElement)(sourceDescription)) {
|
|
43861
|
-
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]('Element is not a valid SourceDescriptionElement. Skipping
|
|
43858
|
+
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]('Element is not a valid SourceDescriptionElement. Skipping');
|
|
43862
43859
|
annotation.classes.push('warning');
|
|
43863
43860
|
parseResult.push(annotation);
|
|
43864
43861
|
return parseResult;
|
|
@@ -43870,7 +43867,7 @@ async function parseSourceDescription(sourceDescription, ctx) {
|
|
|
43870
43867
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(sourceDescription.type)) parseResult.setMetaProperty('type', (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(sourceDescription.type));
|
|
43871
43868
|
const sourceDescriptionURI = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(sourceDescription.url);
|
|
43872
43869
|
if (typeof sourceDescriptionURI !== 'string') {
|
|
43873
|
-
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]('Source description URL is missing or not a string. Skipping
|
|
43870
|
+
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]('Source description URL is missing or not a string. Skipping');
|
|
43874
43871
|
annotation.classes.push('warning');
|
|
43875
43872
|
parseResult.push(annotation);
|
|
43876
43873
|
return parseResult;
|
|
@@ -43879,14 +43876,14 @@ async function parseSourceDescription(sourceDescription, ctx) {
|
|
|
43879
43876
|
|
|
43880
43877
|
// skip if already visited (cycle detection)
|
|
43881
43878
|
if (ctx.visitedUrls.has(retrievalURI)) {
|
|
43882
|
-
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"](`Source description "${retrievalURI}" has already been visited. Skipping to prevent cycle
|
|
43879
|
+
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"](`Source description "${retrievalURI}" has already been visited. Skipping to prevent cycle`);
|
|
43883
43880
|
annotation.classes.push('warning');
|
|
43884
43881
|
parseResult.push(annotation);
|
|
43885
43882
|
return parseResult;
|
|
43886
43883
|
}
|
|
43887
43884
|
ctx.visitedUrls.add(retrievalURI);
|
|
43888
43885
|
try {
|
|
43889
|
-
const sdParseResult = await
|
|
43886
|
+
const sdParseResult = await (0,_index_mjs__WEBPACK_IMPORTED_MODULE_11__["default"])(retrievalURI, (0,_options_util_mjs__WEBPACK_IMPORTED_MODULE_10__.merge)(ctx.options, {
|
|
43890
43887
|
parse: {
|
|
43891
43888
|
mediaType: 'text/plain',
|
|
43892
43889
|
// allow parser plugin detection
|
|
@@ -43918,7 +43915,7 @@ async function parseSourceDescription(sourceDescription, ctx) {
|
|
|
43918
43915
|
const isOpenApi = (0,_speclynx_apidom_ns_openapi_2__WEBPACK_IMPORTED_MODULE_5__.isSwaggerElement)(sourceDescriptionAPI) || (0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_6__.isOpenApi3_0Element)(sourceDescriptionAPI) || (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_7__.isOpenApi3_1Element)(sourceDescriptionAPI);
|
|
43919
43916
|
const isArazzo = (0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_4__.isArazzoSpecification1Element)(sourceDescriptionAPI);
|
|
43920
43917
|
if (!isOpenApi && !isArazzo) {
|
|
43921
|
-
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"](`Source description "${retrievalURI}" is not an OpenAPI or Arazzo document
|
|
43918
|
+
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"](`Source description "${retrievalURI}" is not an OpenAPI or Arazzo document`);
|
|
43922
43919
|
annotation.classes.push('warning');
|
|
43923
43920
|
parseResult.push(annotation);
|
|
43924
43921
|
return parseResult;
|
|
@@ -43928,11 +43925,11 @@ async function parseSourceDescription(sourceDescription, ctx) {
|
|
|
43928
43925
|
const declaredType = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(sourceDescription.type);
|
|
43929
43926
|
if (typeof declaredType === 'string') {
|
|
43930
43927
|
if (declaredType === 'openapi' && !isOpenApi) {
|
|
43931
|
-
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"](`Source description "${retrievalURI}" declared as "openapi" but parsed as Arazzo document
|
|
43928
|
+
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"](`Source description "${retrievalURI}" declared as "openapi" but parsed as Arazzo document`);
|
|
43932
43929
|
annotation.classes.push('warning');
|
|
43933
43930
|
parseResult.push(annotation);
|
|
43934
43931
|
} else if (declaredType === 'arazzo' && !isArazzo) {
|
|
43935
|
-
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"](`Source description "${retrievalURI}" declared as "arazzo" but parsed as OpenAPI document
|
|
43932
|
+
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"](`Source description "${retrievalURI}" declared as "arazzo" but parsed as OpenAPI document`);
|
|
43936
43933
|
annotation.classes.push('warning');
|
|
43937
43934
|
parseResult.push(annotation);
|
|
43938
43935
|
}
|
|
@@ -43942,10 +43939,9 @@ async function parseSourceDescription(sourceDescription, ctx) {
|
|
|
43942
43939
|
|
|
43943
43940
|
/**
|
|
43944
43941
|
* Shared function for parsing source descriptions.
|
|
43945
|
-
* Call with `.call(this, ...)` where `this` has `name` and `parseFn` properties.
|
|
43946
43942
|
* @public
|
|
43947
43943
|
*/
|
|
43948
|
-
async function parseSourceDescriptions(api, file, options) {
|
|
43944
|
+
async function parseSourceDescriptions(parserName, api, file, options) {
|
|
43949
43945
|
const results = [];
|
|
43950
43946
|
|
|
43951
43947
|
/**
|
|
@@ -43953,23 +43949,18 @@ async function parseSourceDescriptions(api, file, options) {
|
|
|
43953
43949
|
* Return warning annotations if validation fails.
|
|
43954
43950
|
*/
|
|
43955
43951
|
if (!(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_4__.isArazzoSpecification1Element)(api)) {
|
|
43956
|
-
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]('Cannot parse source descriptions: API is not an Arazzo specification
|
|
43952
|
+
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]('Cannot parse source descriptions: API is not an Arazzo specification');
|
|
43957
43953
|
annotation.classes.push('warning');
|
|
43958
43954
|
return [new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"]([annotation])];
|
|
43959
43955
|
}
|
|
43960
43956
|
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isArrayElement)(api.sourceDescriptions)) {
|
|
43961
|
-
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]('Cannot parse source descriptions: sourceDescriptions field is missing or not an array
|
|
43957
|
+
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]('Cannot parse source descriptions: sourceDescriptions field is missing or not an array');
|
|
43962
43958
|
annotation.classes.push('warning');
|
|
43963
43959
|
return [new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"]([annotation])];
|
|
43964
43960
|
}
|
|
43965
|
-
if (typeof this.parseFn !== 'function') {
|
|
43966
|
-
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]('Source descriptions found but parseFn is not configured. Skipping source description parsing.');
|
|
43967
|
-
annotation.classes.push('error');
|
|
43968
|
-
return [new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"]([annotation])];
|
|
43969
|
-
}
|
|
43970
43961
|
|
|
43971
43962
|
// user config: parser-specific options take precedence over global parserOpts
|
|
43972
|
-
const maxDepth = options?.parse?.parserOpts?.[
|
|
43963
|
+
const maxDepth = options?.parse?.parserOpts?.[parserName]?.sourceDescriptionsMaxDepth ?? options?.parse?.parserOpts?.sourceDescriptionsMaxDepth ?? +Infinity;
|
|
43973
43964
|
|
|
43974
43965
|
// recursion state comes from shared key (works across JSON/YAML)
|
|
43975
43966
|
const sharedOpts = options?.parse?.parserOpts?.[ARAZZO_RECURSION_KEY] ?? {};
|
|
@@ -43986,7 +43977,6 @@ async function parseSourceDescriptions(api, file, options) {
|
|
|
43986
43977
|
return [parseResult];
|
|
43987
43978
|
}
|
|
43988
43979
|
const ctx = {
|
|
43989
|
-
parseFn: this.parseFn,
|
|
43990
43980
|
baseURI: file.uri,
|
|
43991
43981
|
options,
|
|
43992
43982
|
currentDepth,
|
|
@@ -43994,7 +43984,7 @@ async function parseSourceDescriptions(api, file, options) {
|
|
|
43994
43984
|
};
|
|
43995
43985
|
|
|
43996
43986
|
// determine which source descriptions to parse
|
|
43997
|
-
const sourceDescriptionsOption = options?.parse?.parserOpts?.[
|
|
43987
|
+
const sourceDescriptionsOption = options?.parse?.parserOpts?.[parserName]?.sourceDescriptions ?? options?.parse?.parserOpts?.sourceDescriptions;
|
|
43998
43988
|
|
|
43999
43989
|
// handle false or other falsy values - no source descriptions should be parsed
|
|
44000
43990
|
if (!sourceDescriptionsOption) {
|
|
@@ -44043,10 +44033,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
44043
44033
|
*/
|
|
44044
44034
|
class ArazzoYAML1Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["default"] {
|
|
44045
44035
|
refractorOpts;
|
|
44046
|
-
parseFn;
|
|
44047
44036
|
constructor(options) {
|
|
44048
44037
|
const {
|
|
44049
|
-
parseFn,
|
|
44050
44038
|
fileExtensions = [],
|
|
44051
44039
|
mediaTypes = _speclynx_apidom_parser_adapter_arazzo_yaml_1__WEBPACK_IMPORTED_MODULE_2__["default"],
|
|
44052
44040
|
...rest
|
|
@@ -44057,7 +44045,6 @@ class ArazzoYAML1Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["defaul
|
|
|
44057
44045
|
fileExtensions,
|
|
44058
44046
|
mediaTypes
|
|
44059
44047
|
});
|
|
44060
|
-
this.parseFn = parseFn;
|
|
44061
44048
|
}
|
|
44062
44049
|
async canParse(file) {
|
|
44063
44050
|
const hasSupportedFileExtension = this.fileExtensions.length === 0 ? true : this.fileExtensions.includes(file.extension);
|
|
@@ -44076,7 +44063,7 @@ class ArazzoYAML1Parser extends _Parser_mjs__WEBPACK_IMPORTED_MODULE_4__["defaul
|
|
|
44076
44063
|
const parseResult = await (0,_speclynx_apidom_parser_adapter_arazzo_yaml_1__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
|
|
44077
44064
|
const shouldParseSourceDescriptions = options?.parse?.parserOpts?.[this.name]?.sourceDescriptions ?? options?.parse?.parserOpts?.sourceDescriptions;
|
|
44078
44065
|
if (shouldParseSourceDescriptions) {
|
|
44079
|
-
const sourceDescriptions = await _arazzo_json_1_source_description_mjs__WEBPACK_IMPORTED_MODULE_5__.parseSourceDescriptions
|
|
44066
|
+
const sourceDescriptions = await (0,_arazzo_json_1_source_description_mjs__WEBPACK_IMPORTED_MODULE_5__.parseSourceDescriptions)(this.name, parseResult.api, file, options);
|
|
44080
44067
|
parseResult.push(...sourceDescriptions);
|
|
44081
44068
|
}
|
|
44082
44069
|
return parseResult;
|
|
@@ -44654,7 +44641,7 @@ class FileResolver extends _Resolver_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]
|
|
|
44654
44641
|
return false;
|
|
44655
44642
|
}
|
|
44656
44643
|
read() {
|
|
44657
|
-
throw new _errors_ResolverError_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]('FileResolver is not intended to be used in browser context
|
|
44644
|
+
throw new _errors_ResolverError_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]('FileResolver is not intended to be used in browser context');
|
|
44658
44645
|
}
|
|
44659
44646
|
}
|
|
44660
44647
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FileResolver);
|