@speclynx/apidom-parser-adapter-openapi-yaml-3-0 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-0
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-0
@@ -47087,7 +47087,9 @@ class Path {
47087
47087
  *
47088
47088
  * @example
47089
47089
  * // For a path to $.paths['/pets'].get in an OpenAPI document:
47090
+ * ```
47090
47091
  * path.getPathKeys(); // => ['paths', '/pets', 'get']
47092
+ * ```
47091
47093
  */
47092
47094
  getPathKeys() {
47093
47095
  const keys = [];
@@ -47122,18 +47124,22 @@ class Path {
47122
47124
  * or Normalized JSONPath like "$['paths']['/pets']['get']['responses']['200']"
47123
47125
  *
47124
47126
  * @example
47127
+ * ```
47125
47128
  * // JSON Pointer examples:
47126
47129
  * path.formatPath(); // "" (root)
47127
47130
  * path.formatPath(); // "/info"
47128
47131
  * path.formatPath(); // "/paths/~1pets/get"
47129
47132
  * path.formatPath(); // "/paths/~1users~1{id}/parameters/0"
47133
+ * ```
47130
47134
  *
47131
47135
  * @example
47136
+ * ```
47132
47137
  * // JSONPath examples:
47133
47138
  * path.formatPath('jsonpath'); // "$" (root)
47134
47139
  * path.formatPath('jsonpath'); // "$['info']"
47135
47140
  * path.formatPath('jsonpath'); // "$['paths']['/pets']['get']"
47136
47141
  * path.formatPath('jsonpath'); // "$['paths']['/users/{id}']['parameters'][0]"
47142
+ * ```
47137
47143
  */
47138
47144
  formatPath(pathFormat = 'jsonpointer') {
47139
47145
  const parts = this.getPathKeys();
@@ -47343,15 +47349,15 @@ __webpack_require__.r(__webpack_exports__);
47343
47349
  /* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72078);
47344
47350
 
47345
47351
  /**
47346
- * Finds all elements matching the predicate.
47352
+ * Finds all paths whose elements match the predicate.
47347
47353
  * @public
47348
47354
  */
47349
47355
  const filter = (element, predicate) => {
47350
47356
  const result = [];
47351
47357
  (0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
47352
47358
  enter(path) {
47353
- if (predicate(path.node)) {
47354
- result.push(path.node);
47359
+ if (predicate(path)) {
47360
+ result.push(path);
47355
47361
  }
47356
47362
  }
47357
47363
  });
@@ -47377,7 +47383,7 @@ __webpack_require__.r(__webpack_exports__);
47377
47383
  * @public
47378
47384
  */
47379
47385
  /**
47380
- * Finds the most inner node at the given offset.
47386
+ * Finds the path of the most inner node at the given offset.
47381
47387
  * If includeRightBound is set, also finds nodes that end at the given offset.
47382
47388
  * @public
47383
47389
  */
@@ -47402,7 +47408,7 @@ const findAtOffset = (element, options) => {
47402
47408
  const endOffset = node.endOffset;
47403
47409
  const isWithinOffsetRange = offset >= startOffset && (offset < endOffset || includeRightBound && offset <= endOffset);
47404
47410
  if (isWithinOffsetRange) {
47405
- result.push(node);
47411
+ result.push(path);
47406
47412
  return; // push to stack and dive in
47407
47413
  }
47408
47414
  path.skip(); // skip entire sub-tree
@@ -47425,15 +47431,15 @@ __webpack_require__.r(__webpack_exports__);
47425
47431
  /* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72078);
47426
47432
 
47427
47433
  /**
47428
- * Find first element that satisfies the provided predicate.
47434
+ * Finds first path whose element satisfies the provided predicate.
47429
47435
  * @public
47430
47436
  */
47431
47437
  const find = (element, predicate) => {
47432
47438
  let result;
47433
47439
  (0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
47434
47440
  enter(path) {
47435
- if (predicate(path.node)) {
47436
- result = path.node;
47441
+ if (predicate(path)) {
47442
+ result = path;
47437
47443
  path.stop();
47438
47444
  }
47439
47445
  }
@@ -47452,9 +47458,7 @@ __webpack_require__.r(__webpack_exports__);
47452
47458
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
47453
47459
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
47454
47460
  /* harmony export */ });
47455
- /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25162);
47456
- /* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(72078);
47457
-
47461
+ /* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72078);
47458
47462
 
47459
47463
  /**
47460
47464
  * @public
@@ -47463,7 +47467,7 @@ __webpack_require__.r(__webpack_exports__);
47463
47467
  * @public
47464
47468
  */
47465
47469
  /**
47466
- * Executes the callback on this element and all descendants.
47470
+ * Executes the callback on this element's path and all descendant paths.
47467
47471
  * @public
47468
47472
  */
47469
47473
  const forEach = (element, options) => {
@@ -47471,15 +47475,15 @@ const forEach = (element, options) => {
47471
47475
  let predicate;
47472
47476
  if (typeof options === 'function') {
47473
47477
  callback = options;
47474
- predicate = _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isElement;
47478
+ predicate = () => true;
47475
47479
  } else {
47476
47480
  callback = options.callback ?? (() => {});
47477
- predicate = options.predicate ?? _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isElement;
47481
+ predicate = options.predicate ?? (() => true);
47478
47482
  }
47479
- (0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_1__.traverse)(element, {
47483
+ (0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
47480
47484
  enter(path) {
47481
- if (predicate(path.node)) {
47482
- callback(path.node);
47485
+ if (predicate(path)) {
47486
+ callback(path);
47483
47487
  }
47484
47488
  }
47485
47489
  });
@@ -47528,11 +47532,11 @@ __webpack_require__.r(__webpack_exports__);
47528
47532
  /* harmony import */ var _filter_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(75247);
47529
47533
 
47530
47534
  /**
47531
- * Complement of filter. Finds all elements NOT matching the predicate.
47535
+ * Complement of filter. Finds all paths whose elements do NOT match the predicate.
47532
47536
  * @public
47533
47537
  */
47534
47538
  const reject = (element, predicate) => {
47535
- return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element, el => !predicate(el));
47539
+ return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element, path => !predicate(path));
47536
47540
  };
47537
47541
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (reject);
47538
47542
 
@@ -47549,7 +47553,7 @@ __webpack_require__.r(__webpack_exports__);
47549
47553
  /* harmony import */ var _find_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(44860);
47550
47554
 
47551
47555
  /**
47552
- * Tests whether at least one element passes the predicate.
47556
+ * Tests whether at least one path's element passes the predicate.
47553
47557
  * @public
47554
47558
  */
47555
47559
  const some = (element, predicate) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speclynx/apidom-parser-adapter-openapi-yaml-3-0",
3
- "version": "3.2.1",
3
+ "version": "4.0.0",
4
4
  "description": "Parser adapter for parsing YAML documents into OpenAPI 3.0.x namespace.",
5
5
  "keywords": [
6
6
  "apidom",
@@ -56,10 +56,10 @@
56
56
  "license": "Apache-2.0",
57
57
  "dependencies": {
58
58
  "@babel/runtime-corejs3": "^7.28.4",
59
- "@speclynx/apidom-core": "3.2.1",
60
- "@speclynx/apidom-datamodel": "3.2.1",
61
- "@speclynx/apidom-ns-openapi-3-0": "3.2.1",
62
- "@speclynx/apidom-parser-adapter-yaml-1-2": "3.2.1",
59
+ "@speclynx/apidom-core": "4.0.0",
60
+ "@speclynx/apidom-datamodel": "4.0.0",
61
+ "@speclynx/apidom-ns-openapi-3-0": "4.0.0",
62
+ "@speclynx/apidom-parser-adapter-yaml-1-2": "4.0.0",
63
63
  "ramda": "~0.32.0",
64
64
  "ramda-adjunct": "^6.0.0"
65
65
  },
@@ -73,5 +73,5 @@
73
73
  "README.md",
74
74
  "CHANGELOG.md"
75
75
  ],
76
- "gitHead": "83a1e97089ef29134e41ff7cacd351973114ea5b"
76
+ "gitHead": "384ff82a1bb68d015fd6801de641898b4b582876"
77
77
  }
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-0"));
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\.0\.(?:[1-9]\d*|0))\3(?:\s+|$))|(?<JSON>"openapi"\s*:\s*"(?<version_json>3\.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 openApiElement = (0, _apidomNsOpenapi.refractOpenApi3_0)(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_0 } from '@speclynx/apidom-ns-openapi-3-0';
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\.0\.(?:[1-9]\d*|0))\3(?:\s+|$))|(?<JSON>"openapi"\s*:\s*"(?<version_json>3\.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 openApiElement = refractOpenApi3_0(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-0");
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-0';
2
-
3
- /**
4
- * @public
5
- */
6
- const yamlMediaTypes = new OpenAPIMediaTypes(...mediaTypes.filterByFormat('generic'), ...mediaTypes.filterByFormat('yaml'));
7
- export default yamlMediaTypes;