@speclynx/apidom-parser-adapter-openapi-yaml-3-1 3.2.1 → 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 CHANGED
@@ -3,6 +3,10 @@
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-yaml-3-1
9
+
6
10
  ## [3.2.1](https://github.com/speclynx/apidom/compare/v3.2.0...v3.2.1) (2026-03-09)
7
11
 
8
12
  **Note:** Version bump only for package @speclynx/apidom-parser-adapter-openapi-yaml-3-1
@@ -52696,7 +52696,9 @@ class Path {
52696
52696
  *
52697
52697
  * @example
52698
52698
  * // For a path to $.paths['/pets'].get in an OpenAPI document:
52699
+ * ```
52699
52700
  * path.getPathKeys(); // => ['paths', '/pets', 'get']
52701
+ * ```
52700
52702
  */
52701
52703
  getPathKeys() {
52702
52704
  const keys = [];
@@ -52731,18 +52733,22 @@ class Path {
52731
52733
  * or Normalized JSONPath like "$['paths']['/pets']['get']['responses']['200']"
52732
52734
  *
52733
52735
  * @example
52736
+ * ```
52734
52737
  * // JSON Pointer examples:
52735
52738
  * path.formatPath(); // "" (root)
52736
52739
  * path.formatPath(); // "/info"
52737
52740
  * path.formatPath(); // "/paths/~1pets/get"
52738
52741
  * path.formatPath(); // "/paths/~1users~1{id}/parameters/0"
52742
+ * ```
52739
52743
  *
52740
52744
  * @example
52745
+ * ```
52741
52746
  * // JSONPath examples:
52742
52747
  * path.formatPath('jsonpath'); // "$" (root)
52743
52748
  * path.formatPath('jsonpath'); // "$['info']"
52744
52749
  * path.formatPath('jsonpath'); // "$['paths']['/pets']['get']"
52745
52750
  * path.formatPath('jsonpath'); // "$['paths']['/users/{id}']['parameters'][0]"
52751
+ * ```
52746
52752
  */
52747
52753
  formatPath(pathFormat = 'jsonpointer') {
52748
52754
  const parts = this.getPathKeys();
@@ -52952,15 +52958,15 @@ __webpack_require__.r(__webpack_exports__);
52952
52958
  /* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72078);
52953
52959
 
52954
52960
  /**
52955
- * Finds all elements matching the predicate.
52961
+ * Finds all paths whose elements match the predicate.
52956
52962
  * @public
52957
52963
  */
52958
52964
  const filter = (element, predicate) => {
52959
52965
  const result = [];
52960
52966
  (0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
52961
52967
  enter(path) {
52962
- if (predicate(path.node)) {
52963
- result.push(path.node);
52968
+ if (predicate(path)) {
52969
+ result.push(path);
52964
52970
  }
52965
52971
  }
52966
52972
  });
@@ -52986,7 +52992,7 @@ __webpack_require__.r(__webpack_exports__);
52986
52992
  * @public
52987
52993
  */
52988
52994
  /**
52989
- * Finds the most inner node at the given offset.
52995
+ * Finds the path of the most inner node at the given offset.
52990
52996
  * If includeRightBound is set, also finds nodes that end at the given offset.
52991
52997
  * @public
52992
52998
  */
@@ -53011,7 +53017,7 @@ const findAtOffset = (element, options) => {
53011
53017
  const endOffset = node.endOffset;
53012
53018
  const isWithinOffsetRange = offset >= startOffset && (offset < endOffset || includeRightBound && offset <= endOffset);
53013
53019
  if (isWithinOffsetRange) {
53014
- result.push(node);
53020
+ result.push(path);
53015
53021
  return; // push to stack and dive in
53016
53022
  }
53017
53023
  path.skip(); // skip entire sub-tree
@@ -53034,15 +53040,15 @@ __webpack_require__.r(__webpack_exports__);
53034
53040
  /* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72078);
53035
53041
 
53036
53042
  /**
53037
- * Find first element that satisfies the provided predicate.
53043
+ * Finds first path whose element satisfies the provided predicate.
53038
53044
  * @public
53039
53045
  */
53040
53046
  const find = (element, predicate) => {
53041
53047
  let result;
53042
53048
  (0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
53043
53049
  enter(path) {
53044
- if (predicate(path.node)) {
53045
- result = path.node;
53050
+ if (predicate(path)) {
53051
+ result = path;
53046
53052
  path.stop();
53047
53053
  }
53048
53054
  }
@@ -53061,9 +53067,7 @@ __webpack_require__.r(__webpack_exports__);
53061
53067
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
53062
53068
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
53063
53069
  /* harmony export */ });
53064
- /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25162);
53065
- /* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(72078);
53066
-
53070
+ /* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72078);
53067
53071
 
53068
53072
  /**
53069
53073
  * @public
@@ -53072,7 +53076,7 @@ __webpack_require__.r(__webpack_exports__);
53072
53076
  * @public
53073
53077
  */
53074
53078
  /**
53075
- * Executes the callback on this element and all descendants.
53079
+ * Executes the callback on this element's path and all descendant paths.
53076
53080
  * @public
53077
53081
  */
53078
53082
  const forEach = (element, options) => {
@@ -53080,15 +53084,15 @@ const forEach = (element, options) => {
53080
53084
  let predicate;
53081
53085
  if (typeof options === 'function') {
53082
53086
  callback = options;
53083
- predicate = _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isElement;
53087
+ predicate = () => true;
53084
53088
  } else {
53085
53089
  callback = options.callback ?? (() => {});
53086
- predicate = options.predicate ?? _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isElement;
53090
+ predicate = options.predicate ?? (() => true);
53087
53091
  }
53088
- (0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_1__.traverse)(element, {
53092
+ (0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
53089
53093
  enter(path) {
53090
- if (predicate(path.node)) {
53091
- callback(path.node);
53094
+ if (predicate(path)) {
53095
+ callback(path);
53092
53096
  }
53093
53097
  }
53094
53098
  });
@@ -53137,11 +53141,11 @@ __webpack_require__.r(__webpack_exports__);
53137
53141
  /* harmony import */ var _filter_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(75247);
53138
53142
 
53139
53143
  /**
53140
- * Complement of filter. Finds all elements NOT matching the predicate.
53144
+ * Complement of filter. Finds all paths whose elements do NOT match the predicate.
53141
53145
  * @public
53142
53146
  */
53143
53147
  const reject = (element, predicate) => {
53144
- return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element, el => !predicate(el));
53148
+ return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element, path => !predicate(path));
53145
53149
  };
53146
53150
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (reject);
53147
53151
 
@@ -53158,7 +53162,7 @@ __webpack_require__.r(__webpack_exports__);
53158
53162
  /* harmony import */ var _find_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(44860);
53159
53163
 
53160
53164
  /**
53161
- * Tests whether at least one element passes the predicate.
53165
+ * Tests whether at least one path's element passes the predicate.
53162
53166
  * @public
53163
53167
  */
53164
53168
  const some = (element, predicate) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speclynx/apidom-parser-adapter-openapi-yaml-3-1",
3
- "version": "3.2.1",
3
+ "version": "4.0.0",
4
4
  "description": "Parser adapter for parsing YAML documents into OpenAPI 3.1.x namespace.",
5
5
  "keywords": [
6
6
  "apidom",
@@ -62,10 +62,10 @@
62
62
  "license": "Apache-2.0",
63
63
  "dependencies": {
64
64
  "@babel/runtime-corejs3": "^7.28.4",
65
- "@speclynx/apidom-core": "3.2.1",
66
- "@speclynx/apidom-datamodel": "3.2.1",
67
- "@speclynx/apidom-ns-openapi-3-1": "3.2.1",
68
- "@speclynx/apidom-parser-adapter-yaml-1-2": "3.2.1",
65
+ "@speclynx/apidom-core": "4.0.0",
66
+ "@speclynx/apidom-datamodel": "4.0.0",
67
+ "@speclynx/apidom-ns-openapi-3-1": "4.0.0",
68
+ "@speclynx/apidom-parser-adapter-yaml-1-2": "4.0.0",
69
69
  "ramda": "~0.32.0",
70
70
  "ramda-adjunct": "^6.0.0"
71
71
  },
@@ -79,5 +79,5 @@
79
79
  "README.md",
80
80
  "CHANGELOG.md"
81
81
  ],
82
- "gitHead": "83a1e97089ef29134e41ff7cacd351973114ea5b"
82
+ "gitHead": "384ff82a1bb68d015fd6801de641898b4b582876"
83
83
  }
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 _apidomNsOpenapi = _interopRequireWildcard(require("@speclynx/apidom-ns-openapi-3-1"));
12
- var _mediaTypes = _interopRequireDefault(require("./media-types.cjs"));
13
- exports.mediaTypes = _mediaTypes.default;
14
- /**
15
- * @public
16
- */
17
- const detectionRegExp = exports.detectionRegExp = /(?<YAML>^(["']?)openapi\2\s*:\s*(["']?)(?<version_yaml>3\.1\.(?:[1-9]\d*|0))\3(?:\s+|$))|(?<JSON>"openapi"\s*:\s*"(?<version_json>3\.1\.(?:[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 openApiElement = (0, _apidomNsOpenapi.refractOpenApi3_1)(result, {
40
- consume: true,
41
- ...refractorOpts
42
- });
43
- openApiElement.classes.push('result');
44
- parseResultElement.replaceResult(openApiElement);
45
- }
46
- return parseResultElement;
47
- };
48
-
49
- /**
50
- * @public
51
- */
52
- exports.parse = parse;
53
- const namespace = exports.namespace = new _apidomDatamodel.Namespace().use(_apidomNsOpenapi.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 openApiNamespace, { refractOpenApi3_1 } from '@speclynx/apidom-ns-openapi-3-1';
6
- export { default as mediaTypes } from "./media-types.mjs";
7
- /**
8
- * @public
9
- */
10
- export const detectionRegExp = /(?<YAML>^(["']?)openapi\2\s*:\s*(["']?)(?<version_yaml>3\.1\.(?:[1-9]\d*|0))\3(?:\s+|$))|(?<JSON>"openapi"\s*:\s*"(?<version_json>3\.1\.(?:[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 openApiElement = refractOpenApi3_1(result, {
33
- consume: true,
34
- ...refractorOpts
35
- });
36
- openApiElement.classes.push('result');
37
- parseResultElement.replaceResult(openApiElement);
38
- }
39
- return parseResultElement;
40
- };
41
-
42
- /**
43
- * @public
44
- */
45
- export const namespace = new Namespace().use(openApiNamespace);
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
- var _apidomNsOpenapi = require("@speclynx/apidom-ns-openapi-3-1");
6
- /**
7
- * @public
8
- */
9
- const yamlMediaTypes = new _apidomNsOpenapi.OpenAPIMediaTypes(..._apidomNsOpenapi.mediaTypes.filterByFormat('generic'), ..._apidomNsOpenapi.mediaTypes.filterByFormat('yaml'));
10
- var _default = exports.default = yamlMediaTypes;
@@ -1,7 +0,0 @@
1
- import { mediaTypes, OpenAPIMediaTypes } from '@speclynx/apidom-ns-openapi-3-1';
2
-
3
- /**
4
- * @public
5
- */
6
- const yamlMediaTypes = new OpenAPIMediaTypes(...mediaTypes.filterByFormat('generic'), ...mediaTypes.filterByFormat('yaml'));
7
- export default yamlMediaTypes;