@speclynx/apidom-parser-adapter-arazzo-yaml-1 3.2.0 → 4.0.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 +8 -0
- package/dist/apidom-parser-adapter-arazzo-yaml-1.browser.js +24 -20
- package/package.json +6 -6
- package/src/adapter.cjs +0 -53
- package/src/adapter.mjs +0 -45
- package/src/media-types.cjs +0 -10
- package/src/media-types.mjs +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.0.0](https://github.com/speclynx/apidom/compare/v3.2.1...v4.0.0) (2026-03-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @speclynx/apidom-parser-adapter-arazzo-yaml-1
|
|
9
|
+
|
|
10
|
+
## [3.2.1](https://github.com/speclynx/apidom/compare/v3.2.0...v3.2.1) (2026-03-09)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @speclynx/apidom-parser-adapter-arazzo-yaml-1
|
|
13
|
+
|
|
6
14
|
# [3.2.0](https://github.com/speclynx/apidom/compare/v3.1.0...v3.2.0) (2026-03-08)
|
|
7
15
|
|
|
8
16
|
### Features
|
|
@@ -45391,7 +45391,9 @@ class Path {
|
|
|
45391
45391
|
*
|
|
45392
45392
|
* @example
|
|
45393
45393
|
* // For a path to $.paths['/pets'].get in an OpenAPI document:
|
|
45394
|
+
* ```
|
|
45394
45395
|
* path.getPathKeys(); // => ['paths', '/pets', 'get']
|
|
45396
|
+
* ```
|
|
45395
45397
|
*/
|
|
45396
45398
|
getPathKeys() {
|
|
45397
45399
|
const keys = [];
|
|
@@ -45426,18 +45428,22 @@ class Path {
|
|
|
45426
45428
|
* or Normalized JSONPath like "$['paths']['/pets']['get']['responses']['200']"
|
|
45427
45429
|
*
|
|
45428
45430
|
* @example
|
|
45431
|
+
* ```
|
|
45429
45432
|
* // JSON Pointer examples:
|
|
45430
45433
|
* path.formatPath(); // "" (root)
|
|
45431
45434
|
* path.formatPath(); // "/info"
|
|
45432
45435
|
* path.formatPath(); // "/paths/~1pets/get"
|
|
45433
45436
|
* path.formatPath(); // "/paths/~1users~1{id}/parameters/0"
|
|
45437
|
+
* ```
|
|
45434
45438
|
*
|
|
45435
45439
|
* @example
|
|
45440
|
+
* ```
|
|
45436
45441
|
* // JSONPath examples:
|
|
45437
45442
|
* path.formatPath('jsonpath'); // "$" (root)
|
|
45438
45443
|
* path.formatPath('jsonpath'); // "$['info']"
|
|
45439
45444
|
* path.formatPath('jsonpath'); // "$['paths']['/pets']['get']"
|
|
45440
45445
|
* path.formatPath('jsonpath'); // "$['paths']['/users/{id}']['parameters'][0]"
|
|
45446
|
+
* ```
|
|
45441
45447
|
*/
|
|
45442
45448
|
formatPath(pathFormat = 'jsonpointer') {
|
|
45443
45449
|
const parts = this.getPathKeys();
|
|
@@ -45647,15 +45653,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
45647
45653
|
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72078);
|
|
45648
45654
|
|
|
45649
45655
|
/**
|
|
45650
|
-
* Finds all elements
|
|
45656
|
+
* Finds all paths whose elements match the predicate.
|
|
45651
45657
|
* @public
|
|
45652
45658
|
*/
|
|
45653
45659
|
const filter = (element, predicate) => {
|
|
45654
45660
|
const result = [];
|
|
45655
45661
|
(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
45656
45662
|
enter(path) {
|
|
45657
|
-
if (predicate(path
|
|
45658
|
-
result.push(path
|
|
45663
|
+
if (predicate(path)) {
|
|
45664
|
+
result.push(path);
|
|
45659
45665
|
}
|
|
45660
45666
|
}
|
|
45661
45667
|
});
|
|
@@ -45681,7 +45687,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
45681
45687
|
* @public
|
|
45682
45688
|
*/
|
|
45683
45689
|
/**
|
|
45684
|
-
* Finds the most inner node at the given offset.
|
|
45690
|
+
* Finds the path of the most inner node at the given offset.
|
|
45685
45691
|
* If includeRightBound is set, also finds nodes that end at the given offset.
|
|
45686
45692
|
* @public
|
|
45687
45693
|
*/
|
|
@@ -45706,7 +45712,7 @@ const findAtOffset = (element, options) => {
|
|
|
45706
45712
|
const endOffset = node.endOffset;
|
|
45707
45713
|
const isWithinOffsetRange = offset >= startOffset && (offset < endOffset || includeRightBound && offset <= endOffset);
|
|
45708
45714
|
if (isWithinOffsetRange) {
|
|
45709
|
-
result.push(
|
|
45715
|
+
result.push(path);
|
|
45710
45716
|
return; // push to stack and dive in
|
|
45711
45717
|
}
|
|
45712
45718
|
path.skip(); // skip entire sub-tree
|
|
@@ -45729,15 +45735,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
45729
45735
|
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72078);
|
|
45730
45736
|
|
|
45731
45737
|
/**
|
|
45732
|
-
*
|
|
45738
|
+
* Finds first path whose element satisfies the provided predicate.
|
|
45733
45739
|
* @public
|
|
45734
45740
|
*/
|
|
45735
45741
|
const find = (element, predicate) => {
|
|
45736
45742
|
let result;
|
|
45737
45743
|
(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
45738
45744
|
enter(path) {
|
|
45739
|
-
if (predicate(path
|
|
45740
|
-
result = path
|
|
45745
|
+
if (predicate(path)) {
|
|
45746
|
+
result = path;
|
|
45741
45747
|
path.stop();
|
|
45742
45748
|
}
|
|
45743
45749
|
}
|
|
@@ -45756,9 +45762,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
45756
45762
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
45757
45763
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
45758
45764
|
/* harmony export */ });
|
|
45759
|
-
/* harmony import */ var
|
|
45760
|
-
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(72078);
|
|
45761
|
-
|
|
45765
|
+
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72078);
|
|
45762
45766
|
|
|
45763
45767
|
/**
|
|
45764
45768
|
* @public
|
|
@@ -45767,7 +45771,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
45767
45771
|
* @public
|
|
45768
45772
|
*/
|
|
45769
45773
|
/**
|
|
45770
|
-
* Executes the callback on this element and all
|
|
45774
|
+
* Executes the callback on this element's path and all descendant paths.
|
|
45771
45775
|
* @public
|
|
45772
45776
|
*/
|
|
45773
45777
|
const forEach = (element, options) => {
|
|
@@ -45775,15 +45779,15 @@ const forEach = (element, options) => {
|
|
|
45775
45779
|
let predicate;
|
|
45776
45780
|
if (typeof options === 'function') {
|
|
45777
45781
|
callback = options;
|
|
45778
|
-
predicate =
|
|
45782
|
+
predicate = () => true;
|
|
45779
45783
|
} else {
|
|
45780
45784
|
callback = options.callback ?? (() => {});
|
|
45781
|
-
predicate = options.predicate ??
|
|
45785
|
+
predicate = options.predicate ?? (() => true);
|
|
45782
45786
|
}
|
|
45783
|
-
(0,
|
|
45787
|
+
(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
45784
45788
|
enter(path) {
|
|
45785
|
-
if (predicate(path
|
|
45786
|
-
callback(path
|
|
45789
|
+
if (predicate(path)) {
|
|
45790
|
+
callback(path);
|
|
45787
45791
|
}
|
|
45788
45792
|
}
|
|
45789
45793
|
});
|
|
@@ -45832,11 +45836,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
45832
45836
|
/* harmony import */ var _filter_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(75247);
|
|
45833
45837
|
|
|
45834
45838
|
/**
|
|
45835
|
-
* Complement of filter. Finds all elements NOT
|
|
45839
|
+
* Complement of filter. Finds all paths whose elements do NOT match the predicate.
|
|
45836
45840
|
* @public
|
|
45837
45841
|
*/
|
|
45838
45842
|
const reject = (element, predicate) => {
|
|
45839
|
-
return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element,
|
|
45843
|
+
return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element, path => !predicate(path));
|
|
45840
45844
|
};
|
|
45841
45845
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (reject);
|
|
45842
45846
|
|
|
@@ -45853,7 +45857,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
45853
45857
|
/* harmony import */ var _find_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(44860);
|
|
45854
45858
|
|
|
45855
45859
|
/**
|
|
45856
|
-
* Tests whether at least one element passes the predicate.
|
|
45860
|
+
* Tests whether at least one path's element passes the predicate.
|
|
45857
45861
|
* @public
|
|
45858
45862
|
*/
|
|
45859
45863
|
const some = (element, predicate) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speclynx/apidom-parser-adapter-arazzo-yaml-1",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Parser adapter for parsing YAML documents into Arazzo 1.x.y namespace.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apidom",
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"license": "Apache-2.0",
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@babel/runtime-corejs3": "^7.28.4",
|
|
60
|
-
"@speclynx/apidom-core": "
|
|
61
|
-
"@speclynx/apidom-datamodel": "
|
|
62
|
-
"@speclynx/apidom-ns-arazzo-1": "
|
|
63
|
-
"@speclynx/apidom-parser-adapter-yaml-1-2": "
|
|
60
|
+
"@speclynx/apidom-core": "4.0.0",
|
|
61
|
+
"@speclynx/apidom-datamodel": "4.0.0",
|
|
62
|
+
"@speclynx/apidom-ns-arazzo-1": "4.0.0",
|
|
63
|
+
"@speclynx/apidom-parser-adapter-yaml-1-2": "4.0.0",
|
|
64
64
|
"ramda": "~0.32.0",
|
|
65
65
|
"ramda-adjunct": "^6.0.0"
|
|
66
66
|
},
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"README.md",
|
|
75
75
|
"CHANGELOG.md"
|
|
76
76
|
],
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "384ff82a1bb68d015fd6801de641898b4b582876"
|
|
78
78
|
}
|
package/src/adapter.cjs
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
|
|
5
|
-
exports.__esModule = true;
|
|
6
|
-
exports.parse = exports.namespace = exports.mediaTypes = exports.detectionRegExp = exports.detect = void 0;
|
|
7
|
-
var _ramda = require("ramda");
|
|
8
|
-
var _ramdaAdjunct = require("ramda-adjunct");
|
|
9
|
-
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
10
|
-
var _apidomParserAdapterYaml = require("@speclynx/apidom-parser-adapter-yaml-1-2");
|
|
11
|
-
var _apidomNsArazzo = _interopRequireWildcard(require("@speclynx/apidom-ns-arazzo-1"));
|
|
12
|
-
var _mediaTypes = _interopRequireDefault(require("./media-types.cjs"));
|
|
13
|
-
exports.mediaTypes = _mediaTypes.default;
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
const detectionRegExp = exports.detectionRegExp = /(?<YAML>^(["']?)arazzo\2\s*:\s*(["']?)(?<version_yaml>1\.(?:[1-9]\d*|0)\.(?:[1-9]\d*|0))\3(?:\s+|$))|(?<JSON>"arazzo"\s*:\s*"(?<version_json>1\.(?:[1-9]\d*|0)\.(?:[1-9]\d*|0))")/m;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
const detect = async (source, options = {}) => detectionRegExp.test(source) && (await (0, _apidomParserAdapterYaml.detect)(source, options));
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
|
-
exports.detect = detect;
|
|
28
|
-
/**
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
const parse = async (source, options = {}) => {
|
|
32
|
-
const refractorOpts = (0, _ramda.propOr)({}, 'refractorOpts', options);
|
|
33
|
-
const parserOpts = (0, _ramda.omit)(['refractorOpts'], options);
|
|
34
|
-
const parseResultElement = await (0, _apidomParserAdapterYaml.parse)(source, parserOpts);
|
|
35
|
-
const {
|
|
36
|
-
result
|
|
37
|
-
} = parseResultElement;
|
|
38
|
-
if ((0, _ramdaAdjunct.isNotUndefined)(result)) {
|
|
39
|
-
const arazzoSpecificationElement = (0, _apidomNsArazzo.refractArazzoSpecification1)(result, {
|
|
40
|
-
consume: true,
|
|
41
|
-
...refractorOpts
|
|
42
|
-
});
|
|
43
|
-
arazzoSpecificationElement.classes.push('result');
|
|
44
|
-
parseResultElement.replaceResult(arazzoSpecificationElement);
|
|
45
|
-
}
|
|
46
|
-
return parseResultElement;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @public
|
|
51
|
-
*/
|
|
52
|
-
exports.parse = parse;
|
|
53
|
-
const namespace = exports.namespace = new _apidomDatamodel.Namespace().use(_apidomNsArazzo.default);
|
package/src/adapter.mjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { propOr, omit } from 'ramda';
|
|
2
|
-
import { isNotUndefined } from 'ramda-adjunct';
|
|
3
|
-
import { Namespace } from '@speclynx/apidom-datamodel';
|
|
4
|
-
import { parse as parseYAML, detect as detectYAML } from '@speclynx/apidom-parser-adapter-yaml-1-2';
|
|
5
|
-
import arazzoNamespacePlugin, { refractArazzoSpecification1 } from '@speclynx/apidom-ns-arazzo-1';
|
|
6
|
-
export { default as mediaTypes } from "./media-types.mjs";
|
|
7
|
-
/**
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export const detectionRegExp = /(?<YAML>^(["']?)arazzo\2\s*:\s*(["']?)(?<version_yaml>1\.(?:[1-9]\d*|0)\.(?:[1-9]\d*|0))\3(?:\s+|$))|(?<JSON>"arazzo"\s*:\s*"(?<version_json>1\.(?:[1-9]\d*|0)\.(?:[1-9]\d*|0))")/m;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export const detect = async (source, options = {}) => detectionRegExp.test(source) && (await detectYAML(source, options));
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
export const parse = async (source, options = {}) => {
|
|
25
|
-
const refractorOpts = propOr({}, 'refractorOpts', options);
|
|
26
|
-
const parserOpts = omit(['refractorOpts'], options);
|
|
27
|
-
const parseResultElement = await parseYAML(source, parserOpts);
|
|
28
|
-
const {
|
|
29
|
-
result
|
|
30
|
-
} = parseResultElement;
|
|
31
|
-
if (isNotUndefined(result)) {
|
|
32
|
-
const arazzoSpecificationElement = refractArazzoSpecification1(result, {
|
|
33
|
-
consume: true,
|
|
34
|
-
...refractorOpts
|
|
35
|
-
});
|
|
36
|
-
arazzoSpecificationElement.classes.push('result');
|
|
37
|
-
parseResultElement.replaceResult(arazzoSpecificationElement);
|
|
38
|
-
}
|
|
39
|
-
return parseResultElement;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @public
|
|
44
|
-
*/
|
|
45
|
-
export const namespace = new Namespace().use(arazzoNamespacePlugin);
|
package/src/media-types.cjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.default = void 0;
|
|
5
|
-
var _apidomNsArazzo = require("@speclynx/apidom-ns-arazzo-1");
|
|
6
|
-
/**
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
const yamlMediaTypes = new _apidomNsArazzo.ArazzoMediaTypes(..._apidomNsArazzo.mediaTypes.filterByFormat('generic'), ..._apidomNsArazzo.mediaTypes.filterByFormat('yaml'));
|
|
10
|
-
var _default = exports.default = yamlMediaTypes;
|
package/src/media-types.mjs
DELETED