@usearazzo/resolver 1.0.1-alpha.17 → 1.0.1-alpha.19

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,16 @@
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
+ ## [1.0.1-alpha.19](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.18...v1.0.1-alpha.19) (2026-10-31)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **validator:** accept in: querystring in Arazzo 1.1.0 documents ([#299](https://github.com/usearazzo/arazzo-toolkit/issues/299)) ([4d26bbb](https://github.com/usearazzo/arazzo-toolkit/commit/4d26bbb3fd9c08c1345c51d4d6aae99f4e359f28)), closes [speclynx/api-languageservice#97](https://github.com/speclynx/api-languageservice/issues/97) [#281](https://github.com/usearazzo/arazzo-toolkit/issues/281)
11
+
12
+ ## [1.0.1-alpha.18](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.17...v1.0.1-alpha.18) (2026-10-30)
13
+
14
+ **Note:** Version bump only for package @usearazzo/resolver
15
+
6
16
  ## [1.0.1-alpha.17](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.16...v1.0.1-alpha.17) (2026-10-29)
7
17
 
8
18
  **Note:** Version bump only for package @usearazzo/resolver
@@ -2893,11 +2893,8 @@ const serializer = (element, replacer, space, options) => {
2893
2893
  __webpack_require__.r(__webpack_exports__);
2894
2894
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(62823);
2895
2895
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(74918);
2896
- /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25035);
2897
- /* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69236);
2896
+ /* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(69236);
2898
2897
 
2899
- // an empty YAML node (YAML 1.2 §7.2) is a null parsed as an empty string with the yaml-e-node class
2900
- const isEmptyNode = element => (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(element) && element.toValue() === '' && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.includesClasses)(element, ['yaml-e-node']);
2901
2898
 
2902
2899
  /**
2903
2900
  * Transforms the ApiDOM into JavaScript POJO.
@@ -2907,7 +2904,6 @@ const isEmptyNode = element => (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_M
2907
2904
  */
2908
2905
  const serializer = element => {
2909
2906
  if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isElement)(element)) return element;
2910
- if (isEmptyNode(element)) return null;
2911
2907
 
2912
2908
  // Shortcut optimization for primitive element types
2913
2909
  if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(element) || (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isNumberElement)(element) || (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isBooleanElement)(element) || (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isNullElement)(element)) {
@@ -2925,8 +2921,8 @@ const serializer = element => {
2925
2921
  node.forEach((value, key) => {
2926
2922
  const k = serialize(key);
2927
2923
  const v = serialize(value);
2928
- const name = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_3__.toPropertyName)(k);
2929
- if (name !== undefined) (0,_util_mjs__WEBPACK_IMPORTED_MODULE_3__["default"])(obj, name, v);
2924
+ const name = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_2__.toPropertyName)(k);
2925
+ if (name !== undefined) (0,_util_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(obj, name, v);
2930
2926
  });
2931
2927
  return obj;
2932
2928
  }
@@ -2941,7 +2937,6 @@ const serializer = element => {
2941
2937
  if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isLinkElement)(node)) {
2942
2938
  return (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(node.href) ? node.href.toValue() : '';
2943
2939
  }
2944
- if (isEmptyNode(node)) return null;
2945
2940
  return node.toValue();
2946
2941
  };
2947
2942
  return serialize(element);
@@ -3309,9 +3304,10 @@ const toYAMLNode = (element, context) => {
3309
3304
  // scalar element (string, number, boolean, null)
3310
3305
  const scalarType = style.scalarStyle ? scalarStyleMap[style.scalarStyle] : undefined;
3311
3306
  const scalar = new yaml__WEBPACK_IMPORTED_MODULE_0__.Scalar((0,_value_mjs__WEBPACK_IMPORTED_MODULE_5__["default"])(element));
3312
- // an empty node (YAML 1.2 §7.2) is serialized to null; while it's still empty, write it back as
3313
- // it was written: with no content, after its anchor and tag if it had them
3314
- const isEmptyNode = scalar.value === null && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.includesClasses)(element, ['yaml-e-node']);
3307
+ // an empty node (YAML 1.2 §7.2) is serialized to null, or to the empty string as a key; while it's
3308
+ // still empty, write it back as it was written: with no content, after its anchor and tag if it
3309
+ // had them
3310
+ const isEmptyNode = (scalar.value === null || scalar.value === '' && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.includesClasses)(element, ['yaml-e-key'])) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.includesClasses)(element, ['yaml-e-node']);
3315
3311
  if (isEmptyNode) {
3316
3312
  const anchor = claimAnchor(style, context);
3317
3313
  const properties = [anchor && `&${anchor}`, style.tag].filter(Boolean).join(' ');
@@ -3350,7 +3346,10 @@ const toYAMLNode = (element, context) => {
3350
3346
  }
3351
3347
  }
3352
3348
  if ((style.scalarStyle === 'Literal' || style.scalarStyle === 'Folded') && typeof style.rawContent === 'string' && typeof scalar.value === 'string') {
3353
- const text = style.rawContent.replace(/\r\n/g, '\n').replace(/\n$/, '');
3349
+ const raw = style.rawContent.replace(/\r\n/g, '\n');
3350
+ // the empty lines after a clip or strip block aren't part of its value, but separate it from
3351
+ // what follows in its source, so they're dropped; a keep block's are part of its value
3352
+ const text = raw.replace(/^[|>][1-9]?\+/.test(raw) ? /\n$/ : /\n+$/, '');
3354
3353
  scalar.value = new RawBlockScalar(scalar.value, text);
3355
3354
  }
3356
3355
  if (style.styleGroup === 'Flow' && typeof style.rawContent === 'string' && typeof scalar.value === 'string' && scalar.value !== '') {
@@ -37278,15 +37277,19 @@ const transformCstToYamlAst = (cursor, ctx) => {
37278
37277
  __webpack_require__.r(__webpack_exports__);
37279
37278
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81669);
37280
37279
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(62823);
37281
- /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(23560);
37282
- /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(67533);
37283
- /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(32420);
37284
- /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(84149);
37285
- /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(77093);
37286
- /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(52728);
37287
- /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(6361);
37288
- /* harmony import */ var _ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(7775);
37289
- /* harmony import */ var _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(2995);
37280
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(61614);
37281
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(27682);
37282
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(25035);
37283
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(23560);
37284
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(67533);
37285
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(32420);
37286
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(84149);
37287
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(77093);
37288
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(52728);
37289
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(6361);
37290
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(41821);
37291
+ /* harmony import */ var _ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(7775);
37292
+ /* harmony import */ var _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(2995);
37290
37293
 
37291
37294
 
37292
37295
  // Transform context passed through transformation
@@ -37296,7 +37299,7 @@ const maybeAddSourceMap = (node, element, ctx) => {
37296
37299
  if (!ctx.sourceMap) {
37297
37300
  return;
37298
37301
  }
37299
- _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"].transfer(node, element);
37302
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_11__["default"].transfer(node, element);
37300
37303
  };
37301
37304
 
37302
37305
  // find the first descendant matching a type path through the AST
@@ -37314,7 +37317,7 @@ const findFirst = (node, path) => {
37314
37317
  // detect indent from first nested block mapping (stream > document > mapping > keyValuePair > mapping)
37315
37318
  const detectIndent = node => {
37316
37319
  const nested = findFirst(node, ['document', 'mapping', 'keyValuePair', 'mapping']);
37317
- if (nested?.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_10__.YamlStyleGroup.Block && typeof nested.startCharacter === 'number' && nested.startCharacter > 0) {
37320
+ if (nested?.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block && typeof nested.startCharacter === 'number' && nested.startCharacter > 0) {
37318
37321
  return nested.startCharacter;
37319
37322
  }
37320
37323
  return 2;
@@ -37446,7 +37449,7 @@ const buildYamlStyle = (node, ctx, extras) => {
37446
37449
  // an untagged node has the non-specific tag '?' when it's a plain scalar and '!' otherwise
37447
37450
  // (YAML 1.2 §6.9.1); an explicit '!' on any other node means the same as no tag
37448
37451
  const tag = node.tag?.explicitName;
37449
- if (tag !== undefined && tag !== (node.style === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_10__.YamlStyle.Plain ? '?' : '!')) {
37452
+ if (tag !== undefined && tag !== (node.style === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain ? '?' : '!')) {
37450
37453
  yamlStyle.tag = tag;
37451
37454
  }
37452
37455
  // the anchor's name, without the & indicator
@@ -37560,17 +37563,17 @@ const collectStreamComments = node => {
37560
37563
  if (!root) comments.before.push(text);else if (comment.startLine === root.endLine) comments.inline.push(text);else comments.after.push(text);
37561
37564
  };
37562
37565
  for (const child of node.children) {
37563
- if ((0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_9__.isDocument)(child)) {
37566
+ if ((0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isDocument)(child)) {
37564
37567
  if (root) break;
37565
37568
  // comments after an explicit document start (---) or before an explicit document end (...)
37566
37569
  // are the document's own children, around its root node
37567
37570
  const children = child.children || [];
37568
- const rootIndex = children.findIndex(c => !(0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_9__.isComment)(c));
37571
+ const rootIndex = children.findIndex(c => !(0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isComment)(c));
37569
37572
  if (rootIndex === -1) break;
37570
- children.slice(0, rootIndex).filter(_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_9__.isComment).forEach(collect);
37573
+ children.slice(0, rootIndex).filter(_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isComment).forEach(collect);
37571
37574
  root = children[rootIndex];
37572
- children.slice(rootIndex + 1).filter(_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_9__.isComment).forEach(collect);
37573
- } else if ((0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_9__.isComment)(child)) {
37575
+ children.slice(rootIndex + 1).filter(_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isComment).forEach(collect);
37576
+ } else if ((0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isComment)(child)) {
37574
37577
  collect(child);
37575
37578
  }
37576
37579
  }
@@ -37583,7 +37586,7 @@ const transformStream = (node, ctx) => {
37583
37586
  if (ctx.style) {
37584
37587
  ctx.indent = detectIndent(node);
37585
37588
  }
37586
- const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]();
37589
+ const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]();
37587
37590
 
37588
37591
  // Transform all children
37589
37592
  const children = transformChildren(node.children || [], ctx);
@@ -37643,7 +37646,7 @@ const transformDocument = (node, ctx) => {
37643
37646
  const shouldSkipVisitingMoreDocuments = ctx.processedDocumentCount >= 1;
37644
37647
  if (shouldWarnAboutMoreDocuments) {
37645
37648
  const message = 'Only first document within YAML stream will be used. Rest will be discarded.';
37646
- const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"](message);
37649
+ const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
37647
37650
  element.classes.push('warning');
37648
37651
  maybeAddSourceMap(node, element, ctx);
37649
37652
  ctx.annotations.push(element);
@@ -37662,7 +37665,7 @@ const transformCollection = (element, node, ctx) => {
37662
37665
  const typedNode = node;
37663
37666
  const children = node.children || [];
37664
37667
  if (ctx.style) {
37665
- if (ctx.flowCollectionPadding === null && node.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_10__.YamlStyleGroup.Flow) {
37668
+ if (ctx.flowCollectionPadding === null && node.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow) {
37666
37669
  ctx.flowCollectionPadding = detectFlowPadding(typedNode);
37667
37670
  }
37668
37671
  const comments = collectComments(children, typedNode.startCharacter);
@@ -37673,7 +37676,7 @@ const transformCollection = (element, node, ctx) => {
37673
37676
  element.style = buildYamlStyle(node, ctx, {
37674
37677
  comment: comments.trailing,
37675
37678
  // a single pair written directly in a flow sequence (e.g. [a: 1])
37676
- singlePair: node.style === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_10__.YamlStyle.SinglePair || undefined
37679
+ singlePair: node.style === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.SinglePair || undefined
37677
37680
  });
37678
37681
  if (comments.outOfScope.length > 0) {
37679
37682
  ctx.promotedComments.push(...comments.outOfScope);
@@ -37686,14 +37689,14 @@ const transformCollection = (element, node, ctx) => {
37686
37689
 
37687
37690
  // Mapping: Transforms to ObjectElement
37688
37691
  const transformMapping = (node, ctx) => {
37689
- const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"]();
37692
+ const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]();
37690
37693
  transformCollection(element, node, ctx);
37691
37694
  return element;
37692
37695
  };
37693
37696
 
37694
37697
  // KeyValuePair: Transforms to MemberElement
37695
37698
  const transformKeyValuePair = (node, ctx) => {
37696
- const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"]();
37699
+ const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__["default"]();
37697
37700
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
37698
37701
  const {
37699
37702
  key,
@@ -37704,15 +37707,25 @@ const transformKeyValuePair = (node, ctx) => {
37704
37707
  styleGroup,
37705
37708
  startCharacter
37706
37709
  } = value;
37707
- if (styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_10__.YamlStyleGroup.Block) {
37710
+ if (styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block) {
37708
37711
  ctx.indentSeq = startCharacter > node.startCharacter;
37709
37712
  }
37710
37713
  }
37711
37714
 
37712
37715
  // Transform key and value (these are dynamically defined properties)
37713
- const keyResult = transform(key, ctx);
37716
+ let keyResult = transform(key, ctx);
37714
37717
  const valueResult = transform(value, ctx);
37715
37718
 
37719
+ // an empty key is a null in YAML, but a JavaScript property name can't be null, so it's the empty
37720
+ // string it's named by, marked as an empty key
37721
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isNullElement)(keyResult) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.includesClasses)(keyResult, ['yaml-e-node'])) {
37722
+ const emptyKey = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"]('', keyResult.meta, keyResult.attributes);
37723
+ emptyKey.classes.push('yaml-e-key');
37724
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_11__["default"].transfer(keyResult, emptyKey);
37725
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_12__["default"].transfer(keyResult, emptyKey);
37726
+ keyResult = emptyKey;
37727
+ }
37728
+
37716
37729
  // @ts-ignore
37717
37730
  element.content.key = keyResult;
37718
37731
  // @ts-ignore
@@ -37732,19 +37745,18 @@ const transformKeyValuePair = (node, ctx) => {
37732
37745
 
37733
37746
  // Sequence: Transforms to ArrayElement
37734
37747
  const transformSequence = (node, ctx) => {
37735
- const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]();
37748
+ const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"]();
37736
37749
  transformCollection(element, node, ctx);
37737
37750
  return element;
37738
37751
  };
37739
37752
 
37740
37753
  // Scalar: Converts to Element via namespace
37741
37754
  const transformScalar = (node, ctx) => {
37742
- const element = ctx.namespace.toElement(node.content);
37743
-
37744
- // Translate style information about empty nodes; an empty node (YAML 1.2 §7.2) is a null unless
37745
- // a tag other than the null tag makes it something else (e.g. !!str makes it an empty string)
37755
+ // an empty node (YAML 1.2 §7.2) is a null unless a tag other than the null tag makes it
37756
+ // something else (e.g. !!str makes it an empty string); its classes tell it from an explicit null
37746
37757
  const tag = node.tag?.explicitName;
37747
- const isEmptyNode = node.content === '' && node.style === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_10__.YamlStyle.Plain && [undefined, '?', '!!null', '!<tag:yaml.org,2002:null>'].includes(tag);
37758
+ const isEmptyNode = node.content === '' && node.style === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain && [undefined, '?', '!!null', '!<tag:yaml.org,2002:null>'].includes(tag);
37759
+ const element = isEmptyNode ? new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]() : ctx.namespace.toElement(node.content);
37748
37760
  if (isEmptyNode) {
37749
37761
  element.classes.push('yaml-e-node');
37750
37762
  element.classes.push('yaml-e-scalar');
@@ -37772,7 +37784,7 @@ const transformComment = (node, ctx) => {
37772
37784
  // Only interested in stream comments before the first document
37773
37785
  if (isStreamComment) {
37774
37786
  // @ts-ignore
37775
- const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__["default"](node.content);
37787
+ const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_9__["default"](node.content);
37776
37788
  maybeAddSourceMap(node, element, ctx);
37777
37789
  return element;
37778
37790
  }
@@ -37783,7 +37795,7 @@ const transformComment = (node, ctx) => {
37783
37795
  const transformLiteral = (node, ctx) => {
37784
37796
  if (node.isMissing) {
37785
37797
  const message = `(Missing ${node.value})`;
37786
- const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"](message);
37798
+ const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
37787
37799
  element.classes.push('warning');
37788
37800
  maybeAddSourceMap(node, element, ctx);
37789
37801
  ctx.annotations.push(element);
@@ -37794,7 +37806,7 @@ const transformLiteral = (node, ctx) => {
37794
37806
  // Error as annotation (used by keyValuePair)
37795
37807
  const transformErrorAsAnnotation = (node, ctx) => {
37796
37808
  const message = node.isUnexpected ? '(Unexpected YAML syntax error)' : '(Error YAML syntax error)';
37797
- const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"](message);
37809
+ const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
37798
37810
  element.classes.push('error');
37799
37811
  maybeAddSourceMap(node, element, ctx);
37800
37812
  ctx.annotations.push(element);
@@ -37803,7 +37815,7 @@ const transformErrorAsAnnotation = (node, ctx) => {
37803
37815
  // Error: Creates error annotation (adds to annotations array)
37804
37816
  const transformError = (node, ctx) => {
37805
37817
  const message = node.isUnexpected ? '(Unexpected YAML syntax error)' : '(Error YAML syntax error)';
37806
- const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"](message);
37818
+ const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
37807
37819
  element.classes.push('error');
37808
37820
  maybeAddSourceMap(node, element, ctx);
37809
37821
  ctx.annotations.push(element);
@@ -37813,10 +37825,10 @@ const transformError = (node, ctx) => {
37813
37825
  // Error at root level: Creates ParseResultElement with error annotation
37814
37826
  const transformRootError = (node, ctx) => {
37815
37827
  const message = node.isUnexpected ? '(Unexpected YAML syntax error)' : '(Error YAML syntax error)';
37816
- const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"](message);
37828
+ const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
37817
37829
  element.classes.push('error');
37818
37830
  maybeAddSourceMap(node, element, ctx);
37819
- const parseResultElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]();
37831
+ const parseResultElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]();
37820
37832
  parseResultElement.push(element);
37821
37833
  return parseResultElement;
37822
37834
  };
@@ -37843,7 +37855,7 @@ const transformYamlAstToApiDOM = (yamlAst, {
37843
37855
 
37844
37856
  // Handle empty parse result
37845
37857
  if (!rootNode) {
37846
- return new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]();
37858
+ return new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]();
37847
37859
  }
37848
37860
 
37849
37861
  // Handle root-level error (no valid stream, just an error node)
@@ -37853,12 +37865,12 @@ const transformYamlAstToApiDOM = (yamlAst, {
37853
37865
  const result = transform(rootNode, ctx);
37854
37866
 
37855
37867
  // Result should be a ParseResultElement from transformStream
37856
- if (result instanceof _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]) {
37868
+ if (result instanceof _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]) {
37857
37869
  return result;
37858
37870
  }
37859
37871
 
37860
37872
  // Fallback: wrap in ParseResultElement
37861
- const parseResult = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]();
37873
+ const parseResult = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]();
37862
37874
  if (result !== null) {
37863
37875
  if (Array.isArray(result)) {
37864
37876
  result.forEach(el => parseResult.push(el));
@@ -40880,6 +40892,10 @@ class OpenAPI2BundleVisitor {
40880
40892
  * and refraction helpers, so the shared logic is parameterized here.
40881
40893
  */
40882
40894
  async bundleReference(path, referencingElement, isSemanticReference, isReferenceLike, refractReferenceFn, label) {
40895
+ // ignore Reference Object without a string $ref, e.g. an empty YAML value
40896
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(referencingElement.$ref)) {
40897
+ return;
40898
+ }
40883
40899
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref);
40884
40900
  const retrievalURI = this.toBaseURI($ref);
40885
40901
  const isInternalReference = this.entryURI === retrievalURI;
@@ -41588,6 +41604,11 @@ class OpenAPI3_0BundleVisitor {
41588
41604
  }
41589
41605
  async ReferenceElement(path) {
41590
41606
  const referencingElement = path.node;
41607
+
41608
+ // ignore Reference Object without a string $ref, e.g. an empty YAML value
41609
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(referencingElement.$ref)) {
41610
+ return;
41611
+ }
41591
41612
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref);
41592
41613
  const retrievalURI = this.toBaseURI($ref);
41593
41614
  const isInternalReference = this.entryURI === retrievalURI;
@@ -41723,98 +41744,108 @@ class OpenAPI3_0BundleVisitor {
41723
41744
  * Path Item Object is not a Components Object field in OpenAPI 3.0
41724
41745
  * (unlike 3.1 which has `components.pathItems`). An external Path Item
41725
41746
  * reference therefore cannot be hoisted; it is inlined in place instead,
41726
- * after bundling its own external references.
41747
+ * after bundling its own external references. It is inlined on leave, once
41748
+ * the sibling fields of the referencing Path Item have been bundled, so the
41749
+ * traversal doesn't descend into the inlined copy and inline the `$ref` left
41750
+ * in it to break a cycle again.
41727
41751
  */
41728
- async PathItemElement(path) {
41729
- const pathItemElement = path.node;
41752
+ PathItemElement = {
41753
+ leave: async path => {
41754
+ const pathItemElement = path.node;
41730
41755
 
41731
- // ignore Path Item Objects without a $ref field
41732
- if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(pathItemElement.$ref)) {
41733
- return;
41734
- }
41735
- const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(pathItemElement.$ref);
41736
- const retrievalURI = this.toBaseURI($ref);
41737
- const isInternalReference = this.entryURI === retrievalURI;
41738
- const isExternalReference = !isInternalReference;
41739
- if (isInternalReference) {
41740
- // normalize self-references to a bare fragment so the bundled
41741
- // document stays transferable; bare fragments are left untouched
41742
- pathItemElement.set('$ref', this.normalizeSelfReference($ref));
41743
- return;
41744
- }
41745
-
41746
- // honor the resolve.external switch
41747
- if (!this.options.resolve.external && isExternalReference) {
41748
- return;
41749
- }
41750
- const $refBaseURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_29__.resolve(retrievalURI, $ref);
41751
- const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.URIFragmentIdentifier.fromURIReference($refBaseURI);
41752
- const canonicalKey = `${retrievalURI}#${jsonPointer}`;
41753
-
41754
- // a circular external Path Item reference cannot be inlined without
41755
- // recursing forever; leave the $ref in place to break the cycle
41756
- if (this.inlineStack.has(canonicalKey)) {
41757
- return;
41758
- }
41759
- try {
41760
- // detect maximum depth of bundling
41761
- if (this.reference.depth >= this.options.bundle.maxDepth) {
41762
- throw new _errors_MaximumBundleDepthError_mjs__WEBPACK_IMPORTED_MODULE_27__["default"](`Maximum bundle depth of "${this.options.bundle.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
41763
- maxDepth: this.options.bundle.maxDepth,
41764
- uri: this.reference.uri
41765
- });
41756
+ // ignore Path Item Objects without a $ref field
41757
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(pathItemElement.$ref)) {
41758
+ return;
41759
+ }
41760
+ const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(pathItemElement.$ref);
41761
+ const retrievalURI = this.toBaseURI($ref);
41762
+ const isInternalReference = this.entryURI === retrievalURI;
41763
+ const isExternalReference = !isInternalReference;
41764
+ if (isInternalReference) {
41765
+ // normalize self-references to a bare fragment so the bundled
41766
+ // document stays transferable; bare fragments are left untouched
41767
+ pathItemElement.set('$ref', this.normalizeSelfReference($ref));
41768
+ return;
41766
41769
  }
41767
- const reference = await this.toReference($ref);
41768
- let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.evaluate)(reference.value.result, jsonPointer);
41769
41770
 
41770
- // apply Path Item semantics to the referenced fragment
41771
- if (!(0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_13__.isPathItemElement)(referencedElement)) {
41772
- const cached = this.getRefracted(referencedElement, 'pathItem');
41773
- if (cached !== undefined) {
41774
- referencedElement = cached;
41775
- } else {
41776
- const sourceElement = referencedElement;
41777
- referencedElement = (0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_12__.refractPathItem)(referencedElement);
41778
- this.setRefracted(sourceElement, 'pathItem', referencedElement);
41771
+ // honor the resolve.external switch
41772
+ if (!this.options.resolve.external && isExternalReference) {
41773
+ return;
41774
+ }
41775
+ const $refBaseURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_29__.resolve(retrievalURI, $ref);
41776
+ const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.URIFragmentIdentifier.fromURIReference($refBaseURI);
41777
+ const canonicalKey = `${retrievalURI}#${jsonPointer}`;
41778
+
41779
+ // a circular external Path Item reference cannot be inlined without
41780
+ // recursing forever; leave the $ref in place to break the cycle. It ends
41781
+ // up in the entry document, so it has to resolve from there
41782
+ if (this.inlineStack.has(canonicalKey)) {
41783
+ const targetURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_29__.resolve(this.reference.uri, $ref);
41784
+ if (_util_url_mjs__WEBPACK_IMPORTED_MODULE_29__.resolve(this.entryURI, $ref) !== targetURI) {
41785
+ pathItemElement.set('$ref', _util_url_mjs__WEBPACK_IMPORTED_MODULE_29__.relative(this.entryURI, targetURI));
41779
41786
  }
41787
+ return;
41780
41788
  }
41781
-
41782
- // own a copy and bundle the external references it contains
41783
- const inlinedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneDeep)(referencedElement);
41784
- this.inlineStack.add(canonicalKey);
41785
- const visitor = new OpenAPI3_0BundleVisitor({
41786
- reference,
41787
- options: this.options,
41788
- assignments: this.assignments,
41789
- reservedNames: this.reservedNames,
41790
- refractCache: this.refractCache,
41791
- inlineStack: this.inlineStack
41792
- });
41793
- let bundledElement;
41794
41789
  try {
41795
- bundledElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_9__.traverseAsync)(inlinedElement, visitor, {
41796
- mutable: true
41790
+ // detect maximum depth of bundling
41791
+ if (this.reference.depth >= this.options.bundle.maxDepth) {
41792
+ throw new _errors_MaximumBundleDepthError_mjs__WEBPACK_IMPORTED_MODULE_27__["default"](`Maximum bundle depth of "${this.options.bundle.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
41793
+ maxDepth: this.options.bundle.maxDepth,
41794
+ uri: this.reference.uri
41795
+ });
41796
+ }
41797
+ const reference = await this.toReference($ref);
41798
+ let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.evaluate)(reference.value.result, jsonPointer);
41799
+
41800
+ // apply Path Item semantics to the referenced fragment
41801
+ if (!(0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_13__.isPathItemElement)(referencedElement)) {
41802
+ const cached = this.getRefracted(referencedElement, 'pathItem');
41803
+ if (cached !== undefined) {
41804
+ referencedElement = cached;
41805
+ } else {
41806
+ const sourceElement = referencedElement;
41807
+ referencedElement = (0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_12__.refractPathItem)(referencedElement);
41808
+ this.setRefracted(sourceElement, 'pathItem', referencedElement);
41809
+ }
41810
+ }
41811
+
41812
+ // own a copy and bundle the external references it contains
41813
+ const inlinedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneDeep)(referencedElement);
41814
+ this.inlineStack.add(canonicalKey);
41815
+ const visitor = new OpenAPI3_0BundleVisitor({
41816
+ reference,
41817
+ options: this.options,
41818
+ assignments: this.assignments,
41819
+ reservedNames: this.reservedNames,
41820
+ refractCache: this.refractCache,
41821
+ inlineStack: this.inlineStack
41797
41822
  });
41798
- } finally {
41799
- this.inlineStack.delete(canonicalKey);
41800
- }
41823
+ let bundledElement;
41824
+ try {
41825
+ bundledElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_9__.traverseAsync)(inlinedElement, visitor, {
41826
+ mutable: true
41827
+ });
41828
+ } finally {
41829
+ this.inlineStack.delete(canonicalKey);
41830
+ }
41801
41831
 
41802
- // merge sibling fields from the referencing Path Item over the referenced
41803
- // one. The referencing `$ref` is being resolved away and is skipped; the
41804
- // referenced element keeps its own `$ref` if one survived (i.e. it was
41805
- // left in place to break a circular external Path Item chain).
41806
- pathItemElement.forEach((_value, keyElement, item) => {
41807
- const key = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(keyElement);
41808
- if (key === '$ref') return;
41809
- bundledElement.remove(key);
41810
- bundledElement.content.push(item);
41811
- });
41812
- bundledElement.meta.set('ref-origin', reference.uri);
41813
- path.replaceWith(bundledElement);
41814
- } catch (error) {
41815
- this.handleError(`Error while bundling Path Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, pathItemElement, '$ref', $ref, path);
41832
+ // merge sibling fields from the referencing Path Item over the referenced
41833
+ // one. The referencing `$ref` is being resolved away and is skipped; the
41834
+ // referenced element keeps its own `$ref` if one survived (i.e. it was
41835
+ // left in place to break a circular external Path Item chain).
41836
+ pathItemElement.forEach((_value, keyElement, item) => {
41837
+ const key = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(keyElement);
41838
+ if (key === '$ref') return;
41839
+ bundledElement.remove(key);
41840
+ bundledElement.content.push(item);
41841
+ });
41842
+ bundledElement.meta.set('ref-origin', reference.uri);
41843
+ path.replaceWith(bundledElement);
41844
+ } catch (error) {
41845
+ this.handleError(`Error while bundling Path Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, pathItemElement, '$ref', $ref, path);
41846
+ }
41816
41847
  }
41817
- }
41848
+ };
41818
41849
 
41819
41850
  /**
41820
41851
  * Example Object `externalValue` points at arbitrary external content that
@@ -42474,6 +42505,11 @@ class OpenAPI3_1BundleVisitor {
42474
42505
  };
42475
42506
  async ReferenceElement(path) {
42476
42507
  const referencingElement = path.node;
42508
+
42509
+ // ignore Reference Object without a string $ref, e.g. an empty YAML value
42510
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(referencingElement.$ref)) {
42511
+ return;
42512
+ }
42477
42513
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref);
42478
42514
  const retrievalURI = this.toBaseURI($ref);
42479
42515
  const isInternalReference = this.entryURI === retrievalURI;
@@ -44792,6 +44828,11 @@ class OpenAPI2DereferenceVisitor {
44792
44828
  async ReferenceElement(path) {
44793
44829
  const referencingElement = path.node;
44794
44830
 
44831
+ // ignore Reference Object without a string $ref, e.g. an empty YAML value
44832
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(referencingElement.$ref)) {
44833
+ return;
44834
+ }
44835
+
44795
44836
  // skip current referencing element as it's already been access
44796
44837
  if (this.indirections.includes(referencingElement)) {
44797
44838
  path.skip();
@@ -45095,6 +45136,11 @@ class OpenAPI2DereferenceVisitor {
45095
45136
  async JSONReferenceElement(path) {
45096
45137
  const referencingElement = path.node;
45097
45138
 
45139
+ // ignore Reference Object without a string $ref, e.g. an empty YAML value
45140
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(referencingElement.$ref)) {
45141
+ return;
45142
+ }
45143
+
45098
45144
  // skip current referencing element as it's already been access
45099
45145
  if (this.indirections.includes(referencingElement)) {
45100
45146
  path.skip();
@@ -45588,6 +45634,11 @@ class OpenAPI3_0DereferenceVisitor {
45588
45634
  async ReferenceElement(path) {
45589
45635
  const referencingElement = path.node;
45590
45636
 
45637
+ // ignore Reference Object without a string $ref, e.g. an empty YAML value
45638
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(referencingElement.$ref)) {
45639
+ return;
45640
+ }
45641
+
45591
45642
  // skip current referencing element as it's already been access
45592
45643
  if (this.indirections.includes(referencingElement)) {
45593
45644
  path.skip();
@@ -46772,6 +46823,11 @@ class OpenAPI3_1DereferenceVisitor {
46772
46823
  async ReferenceElement(path) {
46773
46824
  const referencingElement = path.node;
46774
46825
 
46826
+ // ignore Reference Object without a string $ref, e.g. an empty YAML value
46827
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(referencingElement.$ref)) {
46828
+ return;
46829
+ }
46830
+
46775
46831
  // skip current referencing element as it's already been accessed
46776
46832
  if (this.indirections.includes(referencingElement)) {
46777
46833
  path.skip();
@@ -63396,7 +63452,7 @@ const Ast = function fnast() {
63396
63452
  xml += `<root nodes="${records.length / 2}" characters="${chars.length}">\n`;
63397
63453
  xml += `<!-- input string -->\n`;
63398
63454
  xml += indent(depth + 2);
63399
- xml += utils.charsToString(chars);
63455
+ xml += utils.charsToXmlString(chars);
63400
63456
  xml += '\n';
63401
63457
  records.forEach((rec) => {
63402
63458
  if (rec.state === id.SEM_PRE) {
@@ -63404,7 +63460,7 @@ const Ast = function fnast() {
63404
63460
  xml += indent(depth);
63405
63461
  xml += `<node name="${rec.name}" index="${rec.phraseIndex}" length="${rec.phraseLength}">\n`;
63406
63462
  xml += indent(depth + 2);
63407
- xml += utils.charsToString(chars, rec.phraseIndex, rec.phraseLength);
63463
+ xml += utils.charsToXmlString(chars, rec.phraseIndex, rec.phraseLength);
63408
63464
  xml += '\n';
63409
63465
  } else {
63410
63466
  xml += indent(depth);
@@ -63786,6 +63842,14 @@ const utilities = {
63786
63842
  }
63787
63843
  return String.fromCodePoint(...subChars);
63788
63844
  },
63845
+ charsToXmlString: (chars, beg, len) =>
63846
+ utilities
63847
+ .charsToString(chars, beg, len)
63848
+ .replace(/&/g, '&amp;')
63849
+ .replace(/</g, '&lt;')
63850
+ .replace(/>/g, '&gt;')
63851
+ .replace(/'/g, '&apos;')
63852
+ .replace(/"/g, '&quot;'),
63789
63853
  };
63790
63854
 
63791
63855
  const identifiers = {