@speclynx/apidom-parser-adapter-arazzo-json-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-json-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-json-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-json-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
|
|
@@ -32664,7 +32664,9 @@ class Path {
|
|
|
32664
32664
|
*
|
|
32665
32665
|
* @example
|
|
32666
32666
|
* // For a path to $.paths['/pets'].get in an OpenAPI document:
|
|
32667
|
+
* ```
|
|
32667
32668
|
* path.getPathKeys(); // => ['paths', '/pets', 'get']
|
|
32669
|
+
* ```
|
|
32668
32670
|
*/
|
|
32669
32671
|
getPathKeys() {
|
|
32670
32672
|
const keys = [];
|
|
@@ -32699,18 +32701,22 @@ class Path {
|
|
|
32699
32701
|
* or Normalized JSONPath like "$['paths']['/pets']['get']['responses']['200']"
|
|
32700
32702
|
*
|
|
32701
32703
|
* @example
|
|
32704
|
+
* ```
|
|
32702
32705
|
* // JSON Pointer examples:
|
|
32703
32706
|
* path.formatPath(); // "" (root)
|
|
32704
32707
|
* path.formatPath(); // "/info"
|
|
32705
32708
|
* path.formatPath(); // "/paths/~1pets/get"
|
|
32706
32709
|
* path.formatPath(); // "/paths/~1users~1{id}/parameters/0"
|
|
32710
|
+
* ```
|
|
32707
32711
|
*
|
|
32708
32712
|
* @example
|
|
32713
|
+
* ```
|
|
32709
32714
|
* // JSONPath examples:
|
|
32710
32715
|
* path.formatPath('jsonpath'); // "$" (root)
|
|
32711
32716
|
* path.formatPath('jsonpath'); // "$['info']"
|
|
32712
32717
|
* path.formatPath('jsonpath'); // "$['paths']['/pets']['get']"
|
|
32713
32718
|
* path.formatPath('jsonpath'); // "$['paths']['/users/{id}']['parameters'][0]"
|
|
32719
|
+
* ```
|
|
32714
32720
|
*/
|
|
32715
32721
|
formatPath(pathFormat = 'jsonpointer') {
|
|
32716
32722
|
const parts = this.getPathKeys();
|
|
@@ -32920,15 +32926,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32920
32926
|
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2078);
|
|
32921
32927
|
|
|
32922
32928
|
/**
|
|
32923
|
-
* Finds all elements
|
|
32929
|
+
* Finds all paths whose elements match the predicate.
|
|
32924
32930
|
* @public
|
|
32925
32931
|
*/
|
|
32926
32932
|
const filter = (element, predicate) => {
|
|
32927
32933
|
const result = [];
|
|
32928
32934
|
(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
32929
32935
|
enter(path) {
|
|
32930
|
-
if (predicate(path
|
|
32931
|
-
result.push(path
|
|
32936
|
+
if (predicate(path)) {
|
|
32937
|
+
result.push(path);
|
|
32932
32938
|
}
|
|
32933
32939
|
}
|
|
32934
32940
|
});
|
|
@@ -32954,7 +32960,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32954
32960
|
* @public
|
|
32955
32961
|
*/
|
|
32956
32962
|
/**
|
|
32957
|
-
* Finds the most inner node at the given offset.
|
|
32963
|
+
* Finds the path of the most inner node at the given offset.
|
|
32958
32964
|
* If includeRightBound is set, also finds nodes that end at the given offset.
|
|
32959
32965
|
* @public
|
|
32960
32966
|
*/
|
|
@@ -32979,7 +32985,7 @@ const findAtOffset = (element, options) => {
|
|
|
32979
32985
|
const endOffset = node.endOffset;
|
|
32980
32986
|
const isWithinOffsetRange = offset >= startOffset && (offset < endOffset || includeRightBound && offset <= endOffset);
|
|
32981
32987
|
if (isWithinOffsetRange) {
|
|
32982
|
-
result.push(
|
|
32988
|
+
result.push(path);
|
|
32983
32989
|
return; // push to stack and dive in
|
|
32984
32990
|
}
|
|
32985
32991
|
path.skip(); // skip entire sub-tree
|
|
@@ -33002,15 +33008,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
33002
33008
|
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2078);
|
|
33003
33009
|
|
|
33004
33010
|
/**
|
|
33005
|
-
*
|
|
33011
|
+
* Finds first path whose element satisfies the provided predicate.
|
|
33006
33012
|
* @public
|
|
33007
33013
|
*/
|
|
33008
33014
|
const find = (element, predicate) => {
|
|
33009
33015
|
let result;
|
|
33010
33016
|
(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
33011
33017
|
enter(path) {
|
|
33012
|
-
if (predicate(path
|
|
33013
|
-
result = path
|
|
33018
|
+
if (predicate(path)) {
|
|
33019
|
+
result = path;
|
|
33014
33020
|
path.stop();
|
|
33015
33021
|
}
|
|
33016
33022
|
}
|
|
@@ -33029,9 +33035,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
33029
33035
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
33030
33036
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
33031
33037
|
/* harmony export */ });
|
|
33032
|
-
/* harmony import */ var
|
|
33033
|
-
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2078);
|
|
33034
|
-
|
|
33038
|
+
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2078);
|
|
33035
33039
|
|
|
33036
33040
|
/**
|
|
33037
33041
|
* @public
|
|
@@ -33040,7 +33044,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
33040
33044
|
* @public
|
|
33041
33045
|
*/
|
|
33042
33046
|
/**
|
|
33043
|
-
* Executes the callback on this element and all
|
|
33047
|
+
* Executes the callback on this element's path and all descendant paths.
|
|
33044
33048
|
* @public
|
|
33045
33049
|
*/
|
|
33046
33050
|
const forEach = (element, options) => {
|
|
@@ -33048,15 +33052,15 @@ const forEach = (element, options) => {
|
|
|
33048
33052
|
let predicate;
|
|
33049
33053
|
if (typeof options === 'function') {
|
|
33050
33054
|
callback = options;
|
|
33051
|
-
predicate =
|
|
33055
|
+
predicate = () => true;
|
|
33052
33056
|
} else {
|
|
33053
33057
|
callback = options.callback ?? (() => {});
|
|
33054
|
-
predicate = options.predicate ??
|
|
33058
|
+
predicate = options.predicate ?? (() => true);
|
|
33055
33059
|
}
|
|
33056
|
-
(0,
|
|
33060
|
+
(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
33057
33061
|
enter(path) {
|
|
33058
|
-
if (predicate(path
|
|
33059
|
-
callback(path
|
|
33062
|
+
if (predicate(path)) {
|
|
33063
|
+
callback(path);
|
|
33060
33064
|
}
|
|
33061
33065
|
}
|
|
33062
33066
|
});
|
|
@@ -33105,11 +33109,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
33105
33109
|
/* harmony import */ var _filter_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5247);
|
|
33106
33110
|
|
|
33107
33111
|
/**
|
|
33108
|
-
* Complement of filter. Finds all elements NOT
|
|
33112
|
+
* Complement of filter. Finds all paths whose elements do NOT match the predicate.
|
|
33109
33113
|
* @public
|
|
33110
33114
|
*/
|
|
33111
33115
|
const reject = (element, predicate) => {
|
|
33112
|
-
return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element,
|
|
33116
|
+
return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element, path => !predicate(path));
|
|
33113
33117
|
};
|
|
33114
33118
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (reject);
|
|
33115
33119
|
|
|
@@ -33126,7 +33130,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
33126
33130
|
/* harmony import */ var _find_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4860);
|
|
33127
33131
|
|
|
33128
33132
|
/**
|
|
33129
|
-
* Tests whether at least one element passes the predicate.
|
|
33133
|
+
* Tests whether at least one path's element passes the predicate.
|
|
33130
33134
|
* @public
|
|
33131
33135
|
*/
|
|
33132
33136
|
const some = (element, predicate) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speclynx/apidom-parser-adapter-arazzo-json-1",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Parser adapter for parsing JSON 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-json": "
|
|
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-json": "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 _apidomParserAdapterJson = require("@speclynx/apidom-parser-adapter-json");
|
|
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 = /"arazzo"\s*:\s*"(?<version_json>1\.(?:[1-9]\d*|0)\.(?:[1-9]\d*|0))"/;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
const detect = async (source, options = {}) => detectionRegExp.test(source) && (await (0, _apidomParserAdapterJson.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, _apidomParserAdapterJson.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 parseJSON, detect as detectJSON } from '@speclynx/apidom-parser-adapter-json';
|
|
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 = /"arazzo"\s*:\s*"(?<version_json>1\.(?:[1-9]\d*|0)\.(?:[1-9]\d*|0))"/;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export const detect = async (source, options = {}) => detectionRegExp.test(source) && (await detectJSON(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 parseJSON(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 jsonMediaTypes = new _apidomNsArazzo.ArazzoMediaTypes(..._apidomNsArazzo.mediaTypes.filterByFormat('generic'), ..._apidomNsArazzo.mediaTypes.filterByFormat('json'));
|
|
10
|
-
var _default = exports.default = jsonMediaTypes;
|
package/src/media-types.mjs
DELETED