@speclynx/apidom-reference 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.
Files changed (192) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/apidom-reference.browser.js +40 -36
  3. package/dist/apidom-reference.browser.min.js +1 -1
  4. package/package.json +25 -25
  5. package/types/dereference/strategies/apidom/visitor.d.ts +1 -1
  6. package/types/dereference/strategies/arazzo-1/visitor.d.ts +1 -1
  7. package/types/dereference/strategies/asyncapi-2/visitor.d.ts +1 -1
  8. package/types/dereference/strategies/openapi-2/visitor.d.ts +1 -1
  9. package/types/dereference/strategies/openapi-3-0/visitor.d.ts +1 -1
  10. package/types/dereference/strategies/openapi-3-1/visitor.d.ts +1 -1
  11. package/src/File.cjs +0 -50
  12. package/src/File.mjs +0 -44
  13. package/src/Reference.cjs +0 -31
  14. package/src/Reference.mjs +0 -27
  15. package/src/ReferenceSet.cjs +0 -60
  16. package/src/ReferenceSet.mjs +0 -57
  17. package/src/bundle/index.cjs +0 -61
  18. package/src/bundle/index.mjs +0 -55
  19. package/src/bundle/strategies/BundleStrategy.cjs +0 -20
  20. package/src/bundle/strategies/BundleStrategy.mjs +0 -16
  21. package/src/bundle/strategies/openapi-3-1/index.cjs +0 -35
  22. package/src/bundle/strategies/openapi-3-1/index.mjs +0 -29
  23. package/src/configuration/empty.cjs +0 -9
  24. package/src/configuration/empty.mjs +0 -1
  25. package/src/configuration/saturated.cjs +0 -88
  26. package/src/configuration/saturated.mjs +0 -80
  27. package/src/dereference/index.cjs +0 -90
  28. package/src/dereference/index.mjs +0 -83
  29. package/src/dereference/strategies/DereferenceStrategy.cjs +0 -20
  30. package/src/dereference/strategies/DereferenceStrategy.mjs +0 -16
  31. package/src/dereference/strategies/apidom/index.cjs +0 -89
  32. package/src/dereference/strategies/apidom/index.mjs +0 -83
  33. package/src/dereference/strategies/apidom/selectors/element-id.cjs +0 -47
  34. package/src/dereference/strategies/apidom/selectors/element-id.mjs +0 -41
  35. package/src/dereference/strategies/apidom/visitor.cjs +0 -266
  36. package/src/dereference/strategies/apidom/visitor.mjs +0 -259
  37. package/src/dereference/strategies/arazzo-1/index.cjs +0 -109
  38. package/src/dereference/strategies/arazzo-1/index.mjs +0 -100
  39. package/src/dereference/strategies/arazzo-1/selectors/$anchor.cjs +0 -12
  40. package/src/dereference/strategies/arazzo-1/selectors/$anchor.mjs +0 -1
  41. package/src/dereference/strategies/arazzo-1/selectors/uri.cjs +0 -8
  42. package/src/dereference/strategies/arazzo-1/selectors/uri.mjs +0 -1
  43. package/src/dereference/strategies/arazzo-1/source-descriptions.cjs +0 -248
  44. package/src/dereference/strategies/arazzo-1/source-descriptions.mjs +0 -243
  45. package/src/dereference/strategies/arazzo-1/util.cjs +0 -37
  46. package/src/dereference/strategies/arazzo-1/util.mjs +0 -29
  47. package/src/dereference/strategies/arazzo-1/visitor.cjs +0 -507
  48. package/src/dereference/strategies/arazzo-1/visitor.mjs +0 -500
  49. package/src/dereference/strategies/asyncapi-2/index.cjs +0 -94
  50. package/src/dereference/strategies/asyncapi-2/index.mjs +0 -88
  51. package/src/dereference/strategies/asyncapi-2/visitor.cjs +0 -501
  52. package/src/dereference/strategies/asyncapi-2/visitor.mjs +0 -494
  53. package/src/dereference/strategies/openapi-2/index.cjs +0 -96
  54. package/src/dereference/strategies/openapi-2/index.mjs +0 -90
  55. package/src/dereference/strategies/openapi-2/visitor.cjs +0 -629
  56. package/src/dereference/strategies/openapi-2/visitor.mjs +0 -622
  57. package/src/dereference/strategies/openapi-3-0/index.cjs +0 -96
  58. package/src/dereference/strategies/openapi-3-0/index.mjs +0 -90
  59. package/src/dereference/strategies/openapi-3-0/visitor.cjs +0 -621
  60. package/src/dereference/strategies/openapi-3-0/visitor.mjs +0 -614
  61. package/src/dereference/strategies/openapi-3-1/index.cjs +0 -99
  62. package/src/dereference/strategies/openapi-3-1/index.mjs +0 -90
  63. package/src/dereference/strategies/openapi-3-1/selectors/$anchor.cjs +0 -67
  64. package/src/dereference/strategies/openapi-3-1/selectors/$anchor.mjs +0 -56
  65. package/src/dereference/strategies/openapi-3-1/selectors/uri.cjs +0 -50
  66. package/src/dereference/strategies/openapi-3-1/selectors/uri.mjs +0 -42
  67. package/src/dereference/strategies/openapi-3-1/util.cjs +0 -68
  68. package/src/dereference/strategies/openapi-3-1/util.mjs +0 -59
  69. package/src/dereference/strategies/openapi-3-1/visitor.cjs +0 -873
  70. package/src/dereference/strategies/openapi-3-1/visitor.mjs +0 -866
  71. package/src/dereference/util.cjs +0 -31
  72. package/src/dereference/util.mjs +0 -27
  73. package/src/errors/BundleError.cjs +0 -10
  74. package/src/errors/BundleError.mjs +0 -7
  75. package/src/errors/DereferenceError.cjs +0 -10
  76. package/src/errors/DereferenceError.mjs +0 -7
  77. package/src/errors/EvaluationElementIdError.cjs +0 -10
  78. package/src/errors/EvaluationElementIdError.mjs +0 -7
  79. package/src/errors/EvaluationJsonSchema$anchorError.cjs +0 -11
  80. package/src/errors/EvaluationJsonSchema$anchorError.mjs +0 -6
  81. package/src/errors/EvaluationJsonSchemaUriError.cjs +0 -11
  82. package/src/errors/EvaluationJsonSchemaUriError.mjs +0 -6
  83. package/src/errors/InvalidJsonSchema$anchorError.cjs +0 -15
  84. package/src/errors/InvalidJsonSchema$anchorError.mjs +0 -10
  85. package/src/errors/JsonSchema$anchorError.cjs +0 -10
  86. package/src/errors/JsonSchema$anchorError.mjs +0 -7
  87. package/src/errors/JsonSchemaUriError.cjs +0 -10
  88. package/src/errors/JsonSchemaUriError.mjs +0 -7
  89. package/src/errors/MaximumBundleDepthError.cjs +0 -11
  90. package/src/errors/MaximumBundleDepthError.mjs +0 -6
  91. package/src/errors/MaximumDereferenceDepthError.cjs +0 -11
  92. package/src/errors/MaximumDereferenceDepthError.mjs +0 -6
  93. package/src/errors/MaximumResolveDepthError.cjs +0 -11
  94. package/src/errors/MaximumResolveDepthError.mjs +0 -6
  95. package/src/errors/ParseError.cjs +0 -10
  96. package/src/errors/ParseError.mjs +0 -7
  97. package/src/errors/ParserError.cjs +0 -11
  98. package/src/errors/ParserError.mjs +0 -6
  99. package/src/errors/PluginError.cjs +0 -18
  100. package/src/errors/PluginError.mjs +0 -15
  101. package/src/errors/ResolveError.cjs +0 -10
  102. package/src/errors/ResolveError.mjs +0 -7
  103. package/src/errors/ResolverError.cjs +0 -11
  104. package/src/errors/ResolverError.mjs +0 -6
  105. package/src/errors/UnmatchedBundleStrategyError.cjs +0 -11
  106. package/src/errors/UnmatchedBundleStrategyError.mjs +0 -6
  107. package/src/errors/UnmatchedDereferenceStrategyError.cjs +0 -11
  108. package/src/errors/UnmatchedDereferenceStrategyError.mjs +0 -6
  109. package/src/errors/UnmatchedParserError.cjs +0 -11
  110. package/src/errors/UnmatchedParserError.mjs +0 -6
  111. package/src/errors/UnmatchedResolveStrategyError.cjs +0 -11
  112. package/src/errors/UnmatchedResolveStrategyError.mjs +0 -6
  113. package/src/errors/UnmatchedResolverError.cjs +0 -11
  114. package/src/errors/UnmatchedResolverError.mjs +0 -6
  115. package/src/errors/UnresolvableReferenceError.cjs +0 -11
  116. package/src/errors/UnresolvableReferenceError.mjs +0 -6
  117. package/src/index.cjs +0 -146
  118. package/src/index.mjs +0 -103
  119. package/src/options/index.cjs +0 -194
  120. package/src/options/index.mjs +0 -191
  121. package/src/options/util.cjs +0 -24
  122. package/src/options/util.mjs +0 -19
  123. package/src/parse/index.cjs +0 -69
  124. package/src/parse/index.mjs +0 -63
  125. package/src/parse/parsers/Parser.cjs +0 -62
  126. package/src/parse/parsers/Parser.mjs +0 -58
  127. package/src/parse/parsers/apidom-json/index.cjs +0 -70
  128. package/src/parse/parsers/apidom-json/index.mjs +0 -64
  129. package/src/parse/parsers/arazzo-json-1/index.cjs +0 -62
  130. package/src/parse/parsers/arazzo-json-1/index.mjs +0 -56
  131. package/src/parse/parsers/arazzo-json-1/source-descriptions.cjs +0 -221
  132. package/src/parse/parsers/arazzo-json-1/source-descriptions.mjs +0 -214
  133. package/src/parse/parsers/arazzo-yaml-1/index.cjs +0 -62
  134. package/src/parse/parsers/arazzo-yaml-1/index.mjs +0 -56
  135. package/src/parse/parsers/arazzo-yaml-1/source-descriptions.cjs +0 -12
  136. package/src/parse/parsers/arazzo-yaml-1/source-descriptions.mjs +0 -7
  137. package/src/parse/parsers/asyncapi-json-2/index.cjs +0 -54
  138. package/src/parse/parsers/asyncapi-json-2/index.mjs +0 -48
  139. package/src/parse/parsers/asyncapi-yaml-2/index.cjs +0 -54
  140. package/src/parse/parsers/asyncapi-yaml-2/index.mjs +0 -48
  141. package/src/parse/parsers/binary/index-browser.cjs +0 -56
  142. package/src/parse/parsers/binary/index-browser.mjs +0 -50
  143. package/src/parse/parsers/binary/index-node.cjs +0 -51
  144. package/src/parse/parsers/binary/index-node.mjs +0 -45
  145. package/src/parse/parsers/json/index.cjs +0 -53
  146. package/src/parse/parsers/json/index.mjs +0 -47
  147. package/src/parse/parsers/openapi-json-2/index.cjs +0 -54
  148. package/src/parse/parsers/openapi-json-2/index.mjs +0 -48
  149. package/src/parse/parsers/openapi-json-3-0/index.cjs +0 -54
  150. package/src/parse/parsers/openapi-json-3-0/index.mjs +0 -48
  151. package/src/parse/parsers/openapi-json-3-1/index.cjs +0 -54
  152. package/src/parse/parsers/openapi-json-3-1/index.mjs +0 -48
  153. package/src/parse/parsers/openapi-yaml-2/index.cjs +0 -54
  154. package/src/parse/parsers/openapi-yaml-2/index.mjs +0 -48
  155. package/src/parse/parsers/openapi-yaml-3-0/index.cjs +0 -54
  156. package/src/parse/parsers/openapi-yaml-3-0/index.mjs +0 -48
  157. package/src/parse/parsers/openapi-yaml-3-1/index.cjs +0 -54
  158. package/src/parse/parsers/openapi-yaml-3-1/index.mjs +0 -48
  159. package/src/parse/parsers/yaml-1-2/index.cjs +0 -56
  160. package/src/parse/parsers/yaml-1-2/index.mjs +0 -50
  161. package/src/resolve/index.cjs +0 -67
  162. package/src/resolve/index.mjs +0 -60
  163. package/src/resolve/resolvers/HTTPResolver.cjs +0 -45
  164. package/src/resolve/resolvers/HTTPResolver.mjs +0 -37
  165. package/src/resolve/resolvers/Resolver.cjs +0 -20
  166. package/src/resolve/resolvers/Resolver.mjs +0 -16
  167. package/src/resolve/resolvers/file/index-browser.cjs +0 -24
  168. package/src/resolve/resolvers/file/index-browser.mjs +0 -19
  169. package/src/resolve/resolvers/file/index-node.cjs +0 -49
  170. package/src/resolve/resolvers/file/index-node.mjs +0 -42
  171. package/src/resolve/resolvers/http-axios/cache/MemoryCache.cjs +0 -41
  172. package/src/resolve/resolvers/http-axios/cache/MemoryCache.mjs +0 -37
  173. package/src/resolve/resolvers/http-axios/index.cjs +0 -113
  174. package/src/resolve/resolvers/http-axios/index.mjs +0 -105
  175. package/src/resolve/strategies/ResolveStrategy.cjs +0 -20
  176. package/src/resolve/strategies/ResolveStrategy.mjs +0 -16
  177. package/src/resolve/strategies/apidom/index.cjs +0 -49
  178. package/src/resolve/strategies/apidom/index.mjs +0 -43
  179. package/src/resolve/strategies/asyncapi-2/index.cjs +0 -49
  180. package/src/resolve/strategies/asyncapi-2/index.mjs +0 -43
  181. package/src/resolve/strategies/openapi-2/index.cjs +0 -49
  182. package/src/resolve/strategies/openapi-2/index.mjs +0 -43
  183. package/src/resolve/strategies/openapi-3-0/index.cjs +0 -49
  184. package/src/resolve/strategies/openapi-3-0/index.mjs +0 -43
  185. package/src/resolve/strategies/openapi-3-1/index.cjs +0 -49
  186. package/src/resolve/strategies/openapi-3-1/index.mjs +0 -43
  187. package/src/resolve/util.cjs +0 -37
  188. package/src/resolve/util.mjs +0 -30
  189. package/src/util/plugins.cjs +0 -39
  190. package/src/util/plugins.mjs +0 -34
  191. package/src/util/url.cjs +0 -288
  192. package/src/util/url.mjs +0 -274
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
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
+ ### Features
9
+
10
+ - **traverse:** all traverse operations work on Path and not Element ([#153](https://github.com/speclynx/apidom/issues/153)) ([67d244c](https://github.com/speclynx/apidom/commit/67d244cfd3e77f6a9db704cede50ba8e45d10b11))
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ - **traverse:** This is a breaking change as operation callbacks
15
+ now accept Path instead of Element. By accepting Path, full
16
+ context of traversal is exposed to consumer instead of just Element.
17
+
6
18
  ## [3.2.1](https://github.com/speclynx/apidom/compare/v3.2.0...v3.2.1) (2026-03-09)
7
19
 
8
20
  ### Bug Fixes
@@ -589,9 +589,9 @@ const getElementID = element => {
589
589
  // handle both raw string (new format) and StringElement (legacy Refract without __meta_raw__)
590
590
  return (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isElement)(id) ? (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(id) : id;
591
591
  };
592
- const hasElementID = element => {
593
- if (!element.hasMetaProperty('id')) return false;
594
- const id = getElementID(element);
592
+ const hasElementID = path => {
593
+ if (!path.node.hasMetaProperty('id')) return false;
594
+ const id = getElementID(path.node);
595
595
  return typeof id === 'string' && id !== '';
596
596
  };
597
597
 
@@ -605,8 +605,8 @@ const evaluate = (elementID, element) => {
605
605
  } = evaluate;
606
606
  // warm the cache
607
607
  if (!cache.has(element)) {
608
- const elementsWithID = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__.filter)(element, hasElementID);
609
- cache.set(element, Array.from(elementsWithID));
608
+ const pathsWithID = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__.filter)(element, hasElementID);
609
+ cache.set(element, pathsWithID.map(path => path.node));
610
610
  }
611
611
 
612
612
  // search for the matching element
@@ -3987,7 +3987,8 @@ class OpenAPI3_0DereferenceVisitor {
3987
3987
  if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(linkElement.operationId)) {
3988
3988
  const operationId = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(linkElement.operationId);
3989
3989
  const reference = await this.toReference(_util_url_ts__WEBPACK_IMPORTED_MODULE_17__.unsanitize(this.reference.uri));
3990
- operationElement = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_8__.find)(reference.value.result, e => (0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_12__.isOperationElement)(e) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isElement)(e.operationId) && e.operationId.equals(operationId));
3990
+ const operationPath = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_8__.find)(reference.value.result, path => (0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_12__.isOperationElement)(path.node) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isElement)(path.node.operationId) && path.node.operationId.equals(operationId));
3991
+ operationElement = operationPath?.node;
3991
3992
  // OperationElement not found by its operationId
3992
3993
  if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__["default"])(operationElement)) {
3993
3994
  throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_7__["default"](`OperationElement(operationId=${operationId}) not found`, {
@@ -4247,15 +4248,13 @@ const parse = anchor => {
4247
4248
  */
4248
4249
  const evaluate = (anchor, element) => {
4249
4250
  const token = parse(anchor);
4250
-
4251
+ const resultPath = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__.find)(element,
4251
4252
  // @ts-ignore
4252
- const result = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__.find)(element, e => (0,_speclynx_apidom_ns_json_schema_2020_12__WEBPACK_IMPORTED_MODULE_4__.isJSONSchemaElement)(e) && (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(e.$anchor) === token);
4253
- if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__["default"])(result)) {
4253
+ path => (0,_speclynx_apidom_ns_json_schema_2020_12__WEBPACK_IMPORTED_MODULE_4__.isJSONSchemaElement)(path.node) && (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(path.node.$anchor) === token);
4254
+ if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__["default"])(resultPath)) {
4254
4255
  throw new _errors_EvaluationJsonSchema$anchorError_ts__WEBPACK_IMPORTED_MODULE_6__["default"](`Evaluation failed on token: "${token}"`);
4255
4256
  }
4256
-
4257
- // @ts-ignore
4258
- return result;
4257
+ return resultPath.node;
4259
4258
  };
4260
4259
 
4261
4260
 
@@ -4300,12 +4299,12 @@ const evaluate = (uri, element) => {
4300
4299
  cache
4301
4300
  } = evaluate;
4302
4301
  const uriStrippedHash = _util_url_ts__WEBPACK_IMPORTED_MODULE_5__.stripHash(uri);
4303
- const isJSONSchemaElementWith$id = e => (0,_speclynx_apidom_ns_json_schema_2020_12__WEBPACK_IMPORTED_MODULE_2__.isJSONSchemaElement)(e) && typeof e.$id !== 'undefined';
4302
+ const isJSONSchemaElementWith$id = path => (0,_speclynx_apidom_ns_json_schema_2020_12__WEBPACK_IMPORTED_MODULE_2__.isJSONSchemaElement)(path.node) && typeof path.node.$id !== 'undefined';
4304
4303
 
4305
4304
  // warm the cache
4306
4305
  if (!cache.has(element)) {
4307
- const schemaObjectElements = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_1__.filter)(element, isJSONSchemaElementWith$id);
4308
- cache.set(element, Array.from(schemaObjectElements));
4306
+ const schemaObjectPaths = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_1__.filter)(element, isJSONSchemaElementWith$id);
4307
+ cache.set(element, schemaObjectPaths.map(path => path.node));
4309
4308
  }
4310
4309
 
4311
4310
  // search for the matching schema
@@ -5006,7 +5005,8 @@ class OpenAPI3_1DereferenceVisitor {
5006
5005
  if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(linkElement.operationId)) {
5007
5006
  const operationId = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__["default"])(linkElement.operationId);
5008
5007
  const reference = await this.toReference(_util_url_ts__WEBPACK_IMPORTED_MODULE_23__.unsanitize(this.reference.uri));
5009
- operationElement = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_10__.find)(reference.value.result, e => (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__.isOperationElement)(e) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isElement)(e.operationId) && e.operationId.equals(operationId));
5008
+ const operationPath = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_10__.find)(reference.value.result, path => (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__.isOperationElement)(path.node) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isElement)(path.node.operationId) && path.node.operationId.equals(operationId));
5009
+ operationElement = operationPath?.node;
5010
5010
  // OperationElement not found by its operationId
5011
5011
  if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__["default"])(operationElement)) {
5012
5012
  throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_9__["default"](`OperationElement(operationId=${operationId}) not found`, {
@@ -96777,7 +96777,9 @@ class Path {
96777
96777
  *
96778
96778
  * @example
96779
96779
  * // For a path to $.paths['/pets'].get in an OpenAPI document:
96780
+ * ```
96780
96781
  * path.getPathKeys(); // => ['paths', '/pets', 'get']
96782
+ * ```
96781
96783
  */
96782
96784
  getPathKeys() {
96783
96785
  const keys = [];
@@ -96812,18 +96814,22 @@ class Path {
96812
96814
  * or Normalized JSONPath like "$['paths']['/pets']['get']['responses']['200']"
96813
96815
  *
96814
96816
  * @example
96817
+ * ```
96815
96818
  * // JSON Pointer examples:
96816
96819
  * path.formatPath(); // "" (root)
96817
96820
  * path.formatPath(); // "/info"
96818
96821
  * path.formatPath(); // "/paths/~1pets/get"
96819
96822
  * path.formatPath(); // "/paths/~1users~1{id}/parameters/0"
96823
+ * ```
96820
96824
  *
96821
96825
  * @example
96826
+ * ```
96822
96827
  * // JSONPath examples:
96823
96828
  * path.formatPath('jsonpath'); // "$" (root)
96824
96829
  * path.formatPath('jsonpath'); // "$['info']"
96825
96830
  * path.formatPath('jsonpath'); // "$['paths']['/pets']['get']"
96826
96831
  * path.formatPath('jsonpath'); // "$['paths']['/users/{id}']['parameters'][0]"
96832
+ * ```
96827
96833
  */
96828
96834
  formatPath(pathFormat = 'jsonpointer') {
96829
96835
  const parts = this.getPathKeys();
@@ -97033,15 +97039,15 @@ __webpack_require__.r(__webpack_exports__);
97033
97039
  /* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72078);
97034
97040
 
97035
97041
  /**
97036
- * Finds all elements matching the predicate.
97042
+ * Finds all paths whose elements match the predicate.
97037
97043
  * @public
97038
97044
  */
97039
97045
  const filter = (element, predicate) => {
97040
97046
  const result = [];
97041
97047
  (0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
97042
97048
  enter(path) {
97043
- if (predicate(path.node)) {
97044
- result.push(path.node);
97049
+ if (predicate(path)) {
97050
+ result.push(path);
97045
97051
  }
97046
97052
  }
97047
97053
  });
@@ -97067,7 +97073,7 @@ __webpack_require__.r(__webpack_exports__);
97067
97073
  * @public
97068
97074
  */
97069
97075
  /**
97070
- * Finds the most inner node at the given offset.
97076
+ * Finds the path of the most inner node at the given offset.
97071
97077
  * If includeRightBound is set, also finds nodes that end at the given offset.
97072
97078
  * @public
97073
97079
  */
@@ -97092,7 +97098,7 @@ const findAtOffset = (element, options) => {
97092
97098
  const endOffset = node.endOffset;
97093
97099
  const isWithinOffsetRange = offset >= startOffset && (offset < endOffset || includeRightBound && offset <= endOffset);
97094
97100
  if (isWithinOffsetRange) {
97095
- result.push(node);
97101
+ result.push(path);
97096
97102
  return; // push to stack and dive in
97097
97103
  }
97098
97104
  path.skip(); // skip entire sub-tree
@@ -97115,15 +97121,15 @@ __webpack_require__.r(__webpack_exports__);
97115
97121
  /* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72078);
97116
97122
 
97117
97123
  /**
97118
- * Find first element that satisfies the provided predicate.
97124
+ * Finds first path whose element satisfies the provided predicate.
97119
97125
  * @public
97120
97126
  */
97121
97127
  const find = (element, predicate) => {
97122
97128
  let result;
97123
97129
  (0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
97124
97130
  enter(path) {
97125
- if (predicate(path.node)) {
97126
- result = path.node;
97131
+ if (predicate(path)) {
97132
+ result = path;
97127
97133
  path.stop();
97128
97134
  }
97129
97135
  }
@@ -97142,9 +97148,7 @@ __webpack_require__.r(__webpack_exports__);
97142
97148
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
97143
97149
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
97144
97150
  /* harmony export */ });
97145
- /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25162);
97146
- /* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(72078);
97147
-
97151
+ /* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72078);
97148
97152
 
97149
97153
  /**
97150
97154
  * @public
@@ -97153,7 +97157,7 @@ __webpack_require__.r(__webpack_exports__);
97153
97157
  * @public
97154
97158
  */
97155
97159
  /**
97156
- * Executes the callback on this element and all descendants.
97160
+ * Executes the callback on this element's path and all descendant paths.
97157
97161
  * @public
97158
97162
  */
97159
97163
  const forEach = (element, options) => {
@@ -97161,15 +97165,15 @@ const forEach = (element, options) => {
97161
97165
  let predicate;
97162
97166
  if (typeof options === 'function') {
97163
97167
  callback = options;
97164
- predicate = _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isElement;
97168
+ predicate = () => true;
97165
97169
  } else {
97166
97170
  callback = options.callback ?? (() => {});
97167
- predicate = options.predicate ?? _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isElement;
97171
+ predicate = options.predicate ?? (() => true);
97168
97172
  }
97169
- (0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_1__.traverse)(element, {
97173
+ (0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
97170
97174
  enter(path) {
97171
- if (predicate(path.node)) {
97172
- callback(path.node);
97175
+ if (predicate(path)) {
97176
+ callback(path);
97173
97177
  }
97174
97178
  }
97175
97179
  });
@@ -97218,11 +97222,11 @@ __webpack_require__.r(__webpack_exports__);
97218
97222
  /* harmony import */ var _filter_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(75247);
97219
97223
 
97220
97224
  /**
97221
- * Complement of filter. Finds all elements NOT matching the predicate.
97225
+ * Complement of filter. Finds all paths whose elements do NOT match the predicate.
97222
97226
  * @public
97223
97227
  */
97224
97228
  const reject = (element, predicate) => {
97225
- return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element, el => !predicate(el));
97229
+ return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element, path => !predicate(path));
97226
97230
  };
97227
97231
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (reject);
97228
97232
 
@@ -97239,7 +97243,7 @@ __webpack_require__.r(__webpack_exports__);
97239
97243
  /* harmony import */ var _find_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(44860);
97240
97244
 
97241
97245
  /**
97242
- * Tests whether at least one element passes the predicate.
97246
+ * Tests whether at least one path's element passes the predicate.
97243
97247
  * @public
97244
97248
  */
97245
97249
  const some = (element, predicate) => {