@speclynx/apidom-parser-adapter-openapi-json-2 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-openapi-json-2.browser.js +49 -49
- package/dist/apidom-parser-adapter-openapi-json-2.browser.min.js +1 -1
- 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-openapi-json-2
|
|
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-openapi-json-2
|
|
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
|
|
@@ -30664,11 +30664,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30664
30664
|
/* harmony export */ });
|
|
30665
30665
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9498);
|
|
30666
30666
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5162);
|
|
30667
|
-
/* harmony import */ var
|
|
30668
|
-
/* harmony import */ var
|
|
30669
|
-
/* harmony import */ var
|
|
30670
|
-
/* harmony import */ var
|
|
30671
|
-
/* harmony import */ var _bases_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7488);
|
|
30667
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4673);
|
|
30668
|
+
/* harmony import */ var _elements_PathItem_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3419);
|
|
30669
|
+
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6365);
|
|
30670
|
+
/* harmony import */ var _bases_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7488);
|
|
30672
30671
|
|
|
30673
30672
|
|
|
30674
30673
|
|
|
@@ -30678,23 +30677,22 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30678
30677
|
/**
|
|
30679
30678
|
* @public
|
|
30680
30679
|
*/
|
|
30681
|
-
class PathItemVisitor extends
|
|
30680
|
+
class PathItemVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_5__.BaseFixedFieldsVisitor {
|
|
30682
30681
|
constructor(options) {
|
|
30683
30682
|
super(options);
|
|
30684
|
-
this.element = new
|
|
30683
|
+
this.element = new _elements_PathItem_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]();
|
|
30685
30684
|
this.consumeSafe = true;
|
|
30686
30685
|
this.specPath = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'PathItem']);
|
|
30687
30686
|
}
|
|
30688
30687
|
ObjectElement(path) {
|
|
30689
|
-
|
|
30688
|
+
_bases_mjs__WEBPACK_IMPORTED_MODULE_5__.BaseFixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
30690
30689
|
|
|
30691
30690
|
// decorate Operation elements with HTTP method
|
|
30692
|
-
this.element.filter(
|
|
30691
|
+
this.element.filter(_predicates_mjs__WEBPACK_IMPORTED_MODULE_4__.isOperationElement)
|
|
30693
30692
|
// @ts-ignore
|
|
30694
30693
|
.forEach((operationElement, httpMethodElementCI) => {
|
|
30695
|
-
const
|
|
30696
|
-
|
|
30697
|
-
operationElement.meta.set('http-method', httpMethodElementCS);
|
|
30694
|
+
const httpMethod = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(httpMethodElementCI).toUpperCase();
|
|
30695
|
+
operationElement.meta.set('http-method', httpMethod);
|
|
30698
30696
|
});
|
|
30699
30697
|
|
|
30700
30698
|
// mark this PathItemElement with reference metadata
|
|
@@ -30717,7 +30715,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30717
30715
|
/* harmony export */ });
|
|
30718
30716
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3679);
|
|
30719
30717
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9498);
|
|
30720
|
-
/* harmony import */ var
|
|
30718
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4673);
|
|
30721
30719
|
/* harmony import */ var _elements_Paths_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8253);
|
|
30722
30720
|
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6365);
|
|
30723
30721
|
/* harmony import */ var _bases_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7488);
|
|
@@ -30748,7 +30746,7 @@ class PathsVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_5__.BasePatterned
|
|
|
30748
30746
|
.forEach((pathItemElement, key) => {
|
|
30749
30747
|
key.classes.push('openapi-path-template');
|
|
30750
30748
|
key.classes.push('path-template');
|
|
30751
|
-
pathItemElement.meta.set('path', (0,
|
|
30749
|
+
pathItemElement.meta.set('path', (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(key));
|
|
30752
30750
|
});
|
|
30753
30751
|
}
|
|
30754
30752
|
}
|
|
@@ -30933,13 +30931,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30933
30931
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9498);
|
|
30934
30932
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4066);
|
|
30935
30933
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2343);
|
|
30936
|
-
/* harmony import */ var
|
|
30937
|
-
/* harmony import */ var
|
|
30938
|
-
/* harmony import */ var
|
|
30939
|
-
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(
|
|
30940
|
-
/* harmony import */ var
|
|
30941
|
-
/* harmony import */ var _bases_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(7488);
|
|
30942
|
-
|
|
30934
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4673);
|
|
30935
|
+
/* harmony import */ var _elements_Responses_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1297);
|
|
30936
|
+
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2880);
|
|
30937
|
+
/* harmony import */ var _predicates_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6365);
|
|
30938
|
+
/* harmony import */ var _bases_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(7488);
|
|
30943
30939
|
|
|
30944
30940
|
|
|
30945
30941
|
|
|
@@ -30949,32 +30945,32 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30949
30945
|
/**
|
|
30950
30946
|
* @public
|
|
30951
30947
|
*/
|
|
30952
|
-
class ResponsesVisitor extends
|
|
30948
|
+
class ResponsesVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_7__.BaseMixedFieldsVisitor {
|
|
30953
30949
|
constructor(options) {
|
|
30954
30950
|
super(options);
|
|
30955
|
-
this.element = new
|
|
30951
|
+
this.element = new _elements_Responses_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]();
|
|
30956
30952
|
this.specPathFixedFields = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['document', 'objects', 'Responses']);
|
|
30957
30953
|
this.canSupportSpecificationExtensions = true;
|
|
30958
30954
|
this.specPathPatternedFields = element => {
|
|
30959
|
-
return (0,
|
|
30955
|
+
return (0,_predicates_mjs__WEBPACK_IMPORTED_MODULE_5__.isReferenceLikeElement)(element) ? ['document', 'objects', 'Reference'] : ['document', 'objects', 'Response'];
|
|
30960
30956
|
};
|
|
30961
30957
|
// @ts-ignore
|
|
30962
30958
|
this.fieldPatternPredicate = (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(new RegExp(`^(1XX|2XX|3XX|4XX|5XX|${(0,ramda__WEBPACK_IMPORTED_MODULE_1__["default"])(100, 600).join('|')})$`));
|
|
30963
30959
|
}
|
|
30964
30960
|
ObjectElement(path) {
|
|
30965
|
-
|
|
30961
|
+
_bases_mjs__WEBPACK_IMPORTED_MODULE_7__.BaseMixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
30966
30962
|
|
|
30967
30963
|
// decorate every ReferenceElement with metadata about their referencing type
|
|
30968
30964
|
// @ts-ignore
|
|
30969
|
-
this.element.filter(
|
|
30965
|
+
this.element.filter(_predicates_mjs__WEBPACK_IMPORTED_MODULE_6__.isReferenceElement).forEach(referenceElement => {
|
|
30970
30966
|
referenceElement.meta.set('referenced-element', 'response');
|
|
30971
30967
|
});
|
|
30972
30968
|
|
|
30973
30969
|
// decorate every ResponseElement with metadata about their status code
|
|
30974
30970
|
// @ts-ignore
|
|
30975
|
-
this.element.filter(
|
|
30976
|
-
const httpStatusCode = (0,
|
|
30977
|
-
if (!this.fieldPatternPredicate(
|
|
30971
|
+
this.element.filter(_predicates_mjs__WEBPACK_IMPORTED_MODULE_6__.isResponseElement).forEach((value, key) => {
|
|
30972
|
+
const httpStatusCode = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(key);
|
|
30973
|
+
if (!this.fieldPatternPredicate(httpStatusCode)) return;
|
|
30978
30974
|
value.meta.set('http-status-code', httpStatusCode);
|
|
30979
30975
|
});
|
|
30980
30976
|
}
|
|
@@ -32058,7 +32054,9 @@ class Path {
|
|
|
32058
32054
|
*
|
|
32059
32055
|
* @example
|
|
32060
32056
|
* // For a path to $.paths['/pets'].get in an OpenAPI document:
|
|
32057
|
+
* ```
|
|
32061
32058
|
* path.getPathKeys(); // => ['paths', '/pets', 'get']
|
|
32059
|
+
* ```
|
|
32062
32060
|
*/
|
|
32063
32061
|
getPathKeys() {
|
|
32064
32062
|
const keys = [];
|
|
@@ -32093,18 +32091,22 @@ class Path {
|
|
|
32093
32091
|
* or Normalized JSONPath like "$['paths']['/pets']['get']['responses']['200']"
|
|
32094
32092
|
*
|
|
32095
32093
|
* @example
|
|
32094
|
+
* ```
|
|
32096
32095
|
* // JSON Pointer examples:
|
|
32097
32096
|
* path.formatPath(); // "" (root)
|
|
32098
32097
|
* path.formatPath(); // "/info"
|
|
32099
32098
|
* path.formatPath(); // "/paths/~1pets/get"
|
|
32100
32099
|
* path.formatPath(); // "/paths/~1users~1{id}/parameters/0"
|
|
32100
|
+
* ```
|
|
32101
32101
|
*
|
|
32102
32102
|
* @example
|
|
32103
|
+
* ```
|
|
32103
32104
|
* // JSONPath examples:
|
|
32104
32105
|
* path.formatPath('jsonpath'); // "$" (root)
|
|
32105
32106
|
* path.formatPath('jsonpath'); // "$['info']"
|
|
32106
32107
|
* path.formatPath('jsonpath'); // "$['paths']['/pets']['get']"
|
|
32107
32108
|
* path.formatPath('jsonpath'); // "$['paths']['/users/{id}']['parameters'][0]"
|
|
32109
|
+
* ```
|
|
32108
32110
|
*/
|
|
32109
32111
|
formatPath(pathFormat = 'jsonpointer') {
|
|
32110
32112
|
const parts = this.getPathKeys();
|
|
@@ -32314,15 +32316,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32314
32316
|
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2078);
|
|
32315
32317
|
|
|
32316
32318
|
/**
|
|
32317
|
-
* Finds all elements
|
|
32319
|
+
* Finds all paths whose elements match the predicate.
|
|
32318
32320
|
* @public
|
|
32319
32321
|
*/
|
|
32320
32322
|
const filter = (element, predicate) => {
|
|
32321
32323
|
const result = [];
|
|
32322
32324
|
(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
32323
32325
|
enter(path) {
|
|
32324
|
-
if (predicate(path
|
|
32325
|
-
result.push(path
|
|
32326
|
+
if (predicate(path)) {
|
|
32327
|
+
result.push(path);
|
|
32326
32328
|
}
|
|
32327
32329
|
}
|
|
32328
32330
|
});
|
|
@@ -32348,7 +32350,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32348
32350
|
* @public
|
|
32349
32351
|
*/
|
|
32350
32352
|
/**
|
|
32351
|
-
* Finds the most inner node at the given offset.
|
|
32353
|
+
* Finds the path of the most inner node at the given offset.
|
|
32352
32354
|
* If includeRightBound is set, also finds nodes that end at the given offset.
|
|
32353
32355
|
* @public
|
|
32354
32356
|
*/
|
|
@@ -32373,7 +32375,7 @@ const findAtOffset = (element, options) => {
|
|
|
32373
32375
|
const endOffset = node.endOffset;
|
|
32374
32376
|
const isWithinOffsetRange = offset >= startOffset && (offset < endOffset || includeRightBound && offset <= endOffset);
|
|
32375
32377
|
if (isWithinOffsetRange) {
|
|
32376
|
-
result.push(
|
|
32378
|
+
result.push(path);
|
|
32377
32379
|
return; // push to stack and dive in
|
|
32378
32380
|
}
|
|
32379
32381
|
path.skip(); // skip entire sub-tree
|
|
@@ -32396,15 +32398,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32396
32398
|
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2078);
|
|
32397
32399
|
|
|
32398
32400
|
/**
|
|
32399
|
-
*
|
|
32401
|
+
* Finds first path whose element satisfies the provided predicate.
|
|
32400
32402
|
* @public
|
|
32401
32403
|
*/
|
|
32402
32404
|
const find = (element, predicate) => {
|
|
32403
32405
|
let result;
|
|
32404
32406
|
(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
32405
32407
|
enter(path) {
|
|
32406
|
-
if (predicate(path
|
|
32407
|
-
result = path
|
|
32408
|
+
if (predicate(path)) {
|
|
32409
|
+
result = path;
|
|
32408
32410
|
path.stop();
|
|
32409
32411
|
}
|
|
32410
32412
|
}
|
|
@@ -32423,9 +32425,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32423
32425
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
32424
32426
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
32425
32427
|
/* harmony export */ });
|
|
32426
|
-
/* harmony import */ var
|
|
32427
|
-
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2078);
|
|
32428
|
-
|
|
32428
|
+
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2078);
|
|
32429
32429
|
|
|
32430
32430
|
/**
|
|
32431
32431
|
* @public
|
|
@@ -32434,7 +32434,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32434
32434
|
* @public
|
|
32435
32435
|
*/
|
|
32436
32436
|
/**
|
|
32437
|
-
* Executes the callback on this element and all
|
|
32437
|
+
* Executes the callback on this element's path and all descendant paths.
|
|
32438
32438
|
* @public
|
|
32439
32439
|
*/
|
|
32440
32440
|
const forEach = (element, options) => {
|
|
@@ -32442,15 +32442,15 @@ const forEach = (element, options) => {
|
|
|
32442
32442
|
let predicate;
|
|
32443
32443
|
if (typeof options === 'function') {
|
|
32444
32444
|
callback = options;
|
|
32445
|
-
predicate =
|
|
32445
|
+
predicate = () => true;
|
|
32446
32446
|
} else {
|
|
32447
32447
|
callback = options.callback ?? (() => {});
|
|
32448
|
-
predicate = options.predicate ??
|
|
32448
|
+
predicate = options.predicate ?? (() => true);
|
|
32449
32449
|
}
|
|
32450
|
-
(0,
|
|
32450
|
+
(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
32451
32451
|
enter(path) {
|
|
32452
|
-
if (predicate(path
|
|
32453
|
-
callback(path
|
|
32452
|
+
if (predicate(path)) {
|
|
32453
|
+
callback(path);
|
|
32454
32454
|
}
|
|
32455
32455
|
}
|
|
32456
32456
|
});
|
|
@@ -32499,11 +32499,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32499
32499
|
/* harmony import */ var _filter_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5247);
|
|
32500
32500
|
|
|
32501
32501
|
/**
|
|
32502
|
-
* Complement of filter. Finds all elements NOT
|
|
32502
|
+
* Complement of filter. Finds all paths whose elements do NOT match the predicate.
|
|
32503
32503
|
* @public
|
|
32504
32504
|
*/
|
|
32505
32505
|
const reject = (element, predicate) => {
|
|
32506
|
-
return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element,
|
|
32506
|
+
return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element, path => !predicate(path));
|
|
32507
32507
|
};
|
|
32508
32508
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (reject);
|
|
32509
32509
|
|
|
@@ -32520,7 +32520,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32520
32520
|
/* harmony import */ var _find_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4860);
|
|
32521
32521
|
|
|
32522
32522
|
/**
|
|
32523
|
-
* Tests whether at least one element passes the predicate.
|
|
32523
|
+
* Tests whether at least one path's element passes the predicate.
|
|
32524
32524
|
* @public
|
|
32525
32525
|
*/
|
|
32526
32526
|
const some = (element, predicate) => {
|