@swagger-api/apidom-parser-adapter-openapi-yaml-2 0.90.0 → 0.92.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.
@@ -28367,8 +28367,8 @@ const analyze = (cst, {
28367
28367
  const cursor = cst.walk();
28368
28368
  const iterator = new _TreeCursorIterator_mjs__WEBPACK_IMPORTED_MODULE_0__["default"](cursor);
28369
28369
  const [rootNode] = Array.from(iterator);
28370
- const cstVisitor = (0,_visitors_CstVisitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])();
28371
- const astVisitor = (0,_visitors_YamlAstVisitor_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])();
28370
+ const cstVisitor = new _visitors_CstVisitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
28371
+ const astVisitor = new _visitors_YamlAstVisitor_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]();
28372
28372
  const schema = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])();
28373
28373
  const yamlAst = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__.visit)(rootNode, cstVisitor, {
28374
28374
  // @ts-ignore
@@ -28403,25 +28403,23 @@ __webpack_require__.r(__webpack_exports__);
28403
28403
  /* harmony export */ isNode: () => (/* binding */ isNode),
28404
28404
  /* harmony export */ keyMap: () => (/* binding */ keyMap)
28405
28405
  /* harmony export */ });
28406
- /* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(86591);
28407
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51394);
28408
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(87127);
28409
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(37837);
28410
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(20860);
28411
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(94093);
28412
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4314);
28413
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(78681);
28414
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(84768);
28415
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(69348);
28416
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(75795);
28417
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(55676);
28418
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(13856);
28419
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(49873);
28420
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(10914);
28421
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(40968);
28422
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(5773);
28423
- /* harmony import */ var _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6411);
28424
-
28406
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51394);
28407
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87127);
28408
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(37837);
28409
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(20860);
28410
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(94093);
28411
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4314);
28412
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(84768);
28413
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(69348);
28414
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(75795);
28415
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(55676);
28416
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(13856);
28417
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(49873);
28418
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(10914);
28419
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(40968);
28420
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(78681);
28421
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(5773);
28422
+ /* harmony import */ var _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(6411);
28425
28423
 
28426
28424
 
28427
28425
  const keyMap = {
@@ -28432,526 +28430,524 @@ const keyMap = {
28432
28430
  sequence: ['children'],
28433
28431
  error: ['children']
28434
28432
  };
28435
-
28436
- // @ts-ignore
28437
- const isNode = node => Array.isArray(node) || (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.isNode)(node);
28433
+ const isNode = node => Array.isArray(node) || (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__.isNode)(node);
28438
28434
 
28439
28435
  /* eslint-disable no-param-reassign */
28440
28436
 
28441
- const CstVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
28442
- props: {
28443
- schema: null
28444
- },
28445
- init() {
28446
- /**
28447
- * Private API.
28448
- */
28437
+ class CstVisitor {
28438
+ static isScalar = this.isKind('scalar');
28439
+ static isMapping = this.isKind('mapping');
28440
+ static isSequence = this.isKind('sequence');
28441
+ static isKind(ending) {
28442
+ return node => node != null && typeof node === 'object' && 'type' in node && typeof node.type === 'string' && node.type.endsWith(ending);
28443
+ }
28444
+ static toPosition(node) {
28445
+ const start = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
28446
+ row: node.startPosition.row,
28447
+ column: node.startPosition.column,
28448
+ char: node.startIndex
28449
+ });
28450
+ const end = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
28451
+ row: node.endPosition.row,
28452
+ column: node.endPosition.column,
28453
+ char: node.endIndex
28454
+ });
28455
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
28456
+ start,
28457
+ end
28458
+ });
28459
+ }
28460
+ static hasKeyValuePairEmptyKey(node) {
28461
+ if (node.type !== 'block_mapping_pair' && node.type !== 'flow_pair') {
28462
+ return false;
28463
+ }
28464
+ // keyNode was not explicitly provided; tag and anchor are missing too
28465
+ return typeof node.keyNode === 'undefined';
28466
+ }
28467
+ static hasKeyValuePairEmptyValue(node) {
28468
+ if (node.type !== 'block_mapping_pair' && node.type !== 'flow_pair') {
28469
+ return false;
28470
+ }
28471
+ // valueNode was not explicitly provided; tag and anchor are missing too
28472
+ return typeof node.valueNode === 'undefined';
28473
+ }
28474
+ static kindNodeToYamlTag(node) {
28475
+ const {
28476
+ tag: tagNode
28477
+ } = node;
28478
+ const explicitName = (tagNode === null || tagNode === void 0 ? void 0 : tagNode.text) || (node.type === 'plain_scalar' ? '?' : '!');
28479
+ const kind = node.type.endsWith('mapping') ? _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.YamlNodeKind.Mapping : node.type.endsWith('sequence') ? _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.YamlNodeKind.Sequence : _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.YamlNodeKind.Scalar;
28480
+ const position = tagNode ? CstVisitor.toPosition(tagNode) : null;
28481
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
28482
+ explicitName,
28483
+ kind,
28484
+ position
28485
+ });
28486
+ }
28487
+ static kindNodeToYamlAnchor(node) {
28488
+ const {
28489
+ anchor: anchorNode
28490
+ } = node;
28491
+ if (typeof anchorNode === 'undefined') return null;
28492
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
28493
+ name: anchorNode.text,
28494
+ position: CstVisitor.toPosition(anchorNode)
28495
+ });
28496
+ }
28497
+ static createKeyValuePairEmptyKey(node) {
28498
+ const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
28499
+ row: node.startPosition.row,
28500
+ column: node.startPosition.column,
28501
+ char: node.startIndex
28502
+ });
28503
+ const {
28504
+ keyNode
28505
+ } = node;
28506
+ const children = (keyNode === null || keyNode === void 0 ? void 0 : keyNode.children) || [];
28507
+ const tagNode = children.find(CstVisitor.isKind('tag'));
28508
+ const anchorNode = children.find(CstVisitor.isKind('anchor'));
28509
+ const tag = typeof tagNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
28510
+ explicitName: tagNode.text,
28511
+ kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.YamlNodeKind.Scalar,
28512
+ position: CstVisitor.toPosition(tagNode)
28513
+ }) : (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
28514
+ explicitName: '?',
28515
+ kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.YamlNodeKind.Scalar
28516
+ });
28517
+ const anchor = typeof anchorNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
28518
+ name: anchorNode.text,
28519
+ position: CstVisitor.toPosition(anchorNode)
28520
+ }) : null;
28521
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
28522
+ content: '',
28523
+ position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
28524
+ start: emptyPoint,
28525
+ end: emptyPoint
28526
+ }),
28527
+ tag,
28528
+ anchor,
28529
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
28530
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Plain
28531
+ });
28532
+ }
28533
+ static createKeyValuePairEmptyValue(node) {
28534
+ const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
28535
+ row: node.endPosition.row,
28536
+ column: node.endPosition.column,
28537
+ char: node.endIndex
28538
+ });
28539
+ const {
28540
+ valueNode
28541
+ } = node;
28542
+ const children = (valueNode === null || valueNode === void 0 ? void 0 : valueNode.children) || [];
28543
+ const tagNode = children.find(CstVisitor.isKind('tag'));
28544
+ const anchorNode = children.find(CstVisitor.isKind('anchor'));
28545
+ const tag = typeof tagNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
28546
+ explicitName: tagNode.text,
28547
+ kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.YamlNodeKind.Scalar,
28548
+ position: CstVisitor.toPosition(tagNode)
28549
+ }) : (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
28550
+ explicitName: '?',
28551
+ kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.YamlNodeKind.Scalar
28552
+ });
28553
+ const anchor = typeof anchorNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
28554
+ name: anchorNode.text,
28555
+ position: CstVisitor.toPosition(anchorNode)
28556
+ }) : null;
28557
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
28558
+ content: '',
28559
+ position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
28560
+ start: emptyPoint,
28561
+ end: emptyPoint
28562
+ }),
28563
+ tag,
28564
+ anchor,
28565
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
28566
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Plain
28567
+ });
28568
+ }
28569
+
28570
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28449
28571
 
28450
- const toPosition = node => {
28451
- const start = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.Point)({
28452
- row: node.startPosition.row,
28453
- column: node.startPosition.column,
28454
- char: node.startIndex
28572
+ stream = {
28573
+ enter: node => {
28574
+ const position = CstVisitor.toPosition(node);
28575
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__["default"])({
28576
+ children: node.children,
28577
+ position,
28578
+ isMissing: node.isMissing
28455
28579
  });
28456
- const end = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.Point)({
28457
- row: node.endPosition.row,
28458
- column: node.endPosition.column,
28459
- char: node.endIndex
28580
+ },
28581
+ leave: stream => {
28582
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__["default"])({
28583
+ children: [stream]
28460
28584
  });
28461
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
28462
- start,
28463
- end
28585
+ }
28586
+ };
28587
+ yaml_directive = {
28588
+ enter: node => {
28589
+ var _node$firstNamedChild;
28590
+ const position = CstVisitor.toPosition(node);
28591
+ const version = (node === null || node === void 0 || (_node$firstNamedChild = node.firstNamedChild) === null || _node$firstNamedChild === void 0 ? void 0 : _node$firstNamedChild.text) || null;
28592
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__["default"])({
28593
+ position,
28594
+ name: '%YAML',
28595
+ parameters: {
28596
+ version
28597
+ }
28464
28598
  });
28465
- };
28466
- const kindNodeToYamlTag = node => {
28467
- const {
28468
- tag: tagNode
28469
- } = node;
28470
- const explicitName = (tagNode === null || tagNode === void 0 ? void 0 : tagNode.text) || (node.type === 'plain_scalar' ? '?' : '!');
28471
- const kind = node.type.endsWith('mapping') ? _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.YamlNodeKind.Mapping : node.type.endsWith('sequence') ? _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.YamlNodeKind.Sequence : _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.YamlNodeKind.Scalar;
28472
- const position = tagNode ? toPosition(tagNode) : null;
28473
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
28474
- explicitName,
28475
- kind,
28476
- position
28599
+ }
28600
+ };
28601
+ tag_directive = {
28602
+ enter: node => {
28603
+ const position = CstVisitor.toPosition(node);
28604
+ const tagHandleNode = node.children[0];
28605
+ const tagPrefixNode = node.children[1];
28606
+ const tagDirective = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__["default"])({
28607
+ position,
28608
+ name: '%TAG',
28609
+ parameters: {
28610
+ handle: (tagHandleNode === null || tagHandleNode === void 0 ? void 0 : tagHandleNode.text) || null,
28611
+ prefix: (tagPrefixNode === null || tagPrefixNode === void 0 ? void 0 : tagPrefixNode.text) || null
28612
+ }
28477
28613
  });
28478
- };
28479
- const kindNodeToYamlAnchor = node => {
28480
- const {
28481
- anchor: anchorNode
28482
- } = node;
28483
- if (typeof anchorNode === 'undefined') return null;
28484
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
28485
- name: anchorNode.text,
28486
- position: toPosition(anchorNode)
28614
+ this.schema.registerTagDirective(tagDirective);
28615
+ return tagDirective;
28616
+ }
28617
+ };
28618
+ reserved_directive = {
28619
+ enter: node => {
28620
+ const position = CstVisitor.toPosition(node);
28621
+ const directiveNameNode = node.children[0];
28622
+ const directiveParameter1Node = node.children[1];
28623
+ const directiveParameter2Node = node.children[2];
28624
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__["default"])({
28625
+ position,
28626
+ name: (directiveNameNode === null || directiveNameNode === void 0 ? void 0 : directiveNameNode.text) || null,
28627
+ parameters: {
28628
+ handle: (directiveParameter1Node === null || directiveParameter1Node === void 0 ? void 0 : directiveParameter1Node.text) || null,
28629
+ prefix: (directiveParameter2Node === null || directiveParameter2Node === void 0 ? void 0 : directiveParameter2Node.text) || null
28630
+ }
28487
28631
  });
28488
- };
28489
- const isKind = ending => node => typeof (node === null || node === void 0 ? void 0 : node.type) === 'string' && node.type.endsWith(ending);
28490
- const isScalar = isKind('scalar');
28491
- const isMapping = isKind('mapping');
28492
- const isSequence = isKind('sequence');
28493
- const hasKeyValuePairEmptyKey = node => {
28494
- if (node.type !== 'block_mapping_pair' && node.type !== 'flow_pair') {
28495
- return false;
28496
- }
28497
- // keyNode was not explicitly provided; tag and anchor are missing too
28498
- return typeof node.keyNode === 'undefined';
28499
- };
28500
- const hasKeyValuePairEmptyValue = node => {
28501
- if (node.type !== 'block_mapping_pair' && node.type !== 'flow_pair') {
28502
- return false;
28503
- }
28504
- // valueNode was not explicitly provided; tag and anchor are missing too
28505
- return typeof node.valueNode === 'undefined';
28506
- };
28507
- const createKeyValuePairEmptyKey = node => {
28508
- const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.Point)({
28509
- row: node.startPosition.row,
28510
- column: node.startPosition.column,
28511
- char: node.startIndex
28632
+ }
28633
+ };
28634
+ document = {
28635
+ enter: node => {
28636
+ const position = CstVisitor.toPosition(node);
28637
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__["default"])({
28638
+ children: node.children,
28639
+ position,
28640
+ isMissing: node.isMissing
28512
28641
  });
28513
- const {
28514
- keyNode
28515
- } = node;
28516
- const children = (keyNode === null || keyNode === void 0 ? void 0 : keyNode.children) || [];
28517
- const tagNode = children.find(isKind('tag'));
28518
- const anchorNode = children.find(isKind('anchor'));
28519
- const tag = typeof tagNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
28520
- explicitName: tagNode.text,
28521
- kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.YamlNodeKind.Scalar,
28522
- position: toPosition(tagNode)
28523
- }) : (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
28524
- explicitName: '?',
28525
- kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.YamlNodeKind.Scalar
28642
+ },
28643
+ leave: node => {
28644
+ node.children = node.children.flat();
28645
+ }
28646
+ };
28647
+ block_node = {
28648
+ enter: node => {
28649
+ return node.children;
28650
+ }
28651
+ };
28652
+ flow_node = {
28653
+ enter: node => {
28654
+ const [kindCandidate] = node.children.slice(-1);
28655
+
28656
+ // kind node is present in flow node
28657
+ if (CstVisitor.isScalar(kindCandidate) || CstVisitor.isMapping(kindCandidate) || CstVisitor.isSequence(kindCandidate)) {
28658
+ return node.children;
28659
+ }
28660
+
28661
+ // kind node not present in flow node, creating empty node
28662
+ const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
28663
+ row: kindCandidate.endPosition.row,
28664
+ column: kindCandidate.endPosition.column,
28665
+ char: kindCandidate.endIndex
28526
28666
  });
28527
- const anchor = typeof anchorNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
28528
- name: anchorNode.text,
28529
- position: toPosition(anchorNode)
28530
- }) : null;
28531
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
28667
+ const emptyScalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
28532
28668
  content: '',
28533
- position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
28669
+ anchor: CstVisitor.kindNodeToYamlAnchor(kindCandidate),
28670
+ tag: CstVisitor.kindNodeToYamlTag(kindCandidate),
28671
+ position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
28534
28672
  start: emptyPoint,
28535
28673
  end: emptyPoint
28536
28674
  }),
28675
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
28676
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Plain
28677
+ });
28678
+ return [...node.children, emptyScalarNode];
28679
+ }
28680
+ };
28681
+ tag = {
28682
+ enter: () => {
28683
+ return null;
28684
+ }
28685
+ };
28686
+ anchor = {
28687
+ enter: () => {
28688
+ return null;
28689
+ }
28690
+ };
28691
+ block_mapping = {
28692
+ enter: node => {
28693
+ const position = CstVisitor.toPosition(node);
28694
+ const tag = CstVisitor.kindNodeToYamlTag(node);
28695
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
28696
+ const mappingNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__["default"])({
28697
+ children: node.children,
28698
+ position,
28699
+ anchor,
28537
28700
  tag,
28701
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Block,
28702
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.NextLine,
28703
+ isMissing: node.isMissing
28704
+ });
28705
+ return this.schema.resolve(mappingNode);
28706
+ }
28707
+ };
28708
+ block_mapping_pair = {
28709
+ enter: node => {
28710
+ const position = CstVisitor.toPosition(node);
28711
+ const children = [...node.children];
28712
+ if (CstVisitor.hasKeyValuePairEmptyKey(node)) {
28713
+ const keyNode = CstVisitor.createKeyValuePairEmptyKey(node);
28714
+ children.unshift(keyNode);
28715
+ }
28716
+ if (CstVisitor.hasKeyValuePairEmptyValue(node)) {
28717
+ const valueNode = CstVisitor.createKeyValuePairEmptyValue(node);
28718
+ children.push(valueNode);
28719
+ }
28720
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
28721
+ children,
28722
+ position,
28723
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Block,
28724
+ isMissing: node.isMissing
28725
+ });
28726
+ }
28727
+ };
28728
+ flow_mapping = {
28729
+ enter: node => {
28730
+ const position = CstVisitor.toPosition(node);
28731
+ const tag = CstVisitor.kindNodeToYamlTag(node);
28732
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
28733
+ const mappingNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__["default"])({
28734
+ children: node.children,
28735
+ position,
28538
28736
  anchor,
28539
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
28540
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Plain
28737
+ tag,
28738
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
28739
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Explicit,
28740
+ isMissing: node.isMissing
28541
28741
  });
28542
- };
28543
- const createKeyValuePairEmptyValue = node => {
28544
- const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.Point)({
28742
+ return this.schema.resolve(mappingNode);
28743
+ }
28744
+ };
28745
+ flow_pair = {
28746
+ enter: node => {
28747
+ const position = CstVisitor.toPosition(node);
28748
+ const children = [...node.children];
28749
+ if (CstVisitor.hasKeyValuePairEmptyKey(node)) {
28750
+ const keyNode = CstVisitor.createKeyValuePairEmptyKey(node);
28751
+ children.unshift(keyNode);
28752
+ }
28753
+ if (CstVisitor.hasKeyValuePairEmptyValue(node)) {
28754
+ const valueNode = CstVisitor.createKeyValuePairEmptyValue(node);
28755
+ children.push(valueNode);
28756
+ }
28757
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
28758
+ children,
28759
+ position,
28760
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
28761
+ isMissing: node.isMissing
28762
+ });
28763
+ }
28764
+ };
28765
+ keyValuePair = {
28766
+ leave: node => {
28767
+ node.children = node.children.flat();
28768
+ }
28769
+ };
28770
+ block_sequence = {
28771
+ enter: node => {
28772
+ const position = CstVisitor.toPosition(node);
28773
+ const tag = CstVisitor.kindNodeToYamlTag(node);
28774
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
28775
+ const sequenceNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__["default"])({
28776
+ children: node.children,
28777
+ position,
28778
+ anchor,
28779
+ tag,
28780
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Block,
28781
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.NextLine
28782
+ });
28783
+ return this.schema.resolve(sequenceNode);
28784
+ }
28785
+ };
28786
+ block_sequence_item = {
28787
+ enter: node => {
28788
+ // flow or block node present; first node is always `-` literal
28789
+ if (node.children.length > 1) {
28790
+ return node.children;
28791
+ }
28792
+
28793
+ // create empty node
28794
+ const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
28545
28795
  row: node.endPosition.row,
28546
28796
  column: node.endPosition.column,
28547
28797
  char: node.endIndex
28548
28798
  });
28549
- const {
28550
- valueNode
28551
- } = node;
28552
- const children = (valueNode === null || valueNode === void 0 ? void 0 : valueNode.children) || [];
28553
- const tagNode = children.find(isKind('tag'));
28554
- const anchorNode = children.find(isKind('anchor'));
28555
- const tag = typeof tagNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
28556
- explicitName: tagNode.text,
28557
- kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.YamlNodeKind.Scalar,
28558
- position: toPosition(tagNode)
28559
- }) : (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
28560
- explicitName: '?',
28561
- kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.YamlNodeKind.Scalar
28562
- });
28563
- const anchor = typeof anchorNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
28564
- name: anchorNode.text,
28565
- position: toPosition(anchorNode)
28566
- }) : null;
28567
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
28799
+ const emptyScalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
28568
28800
  content: '',
28569
- position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
28801
+ anchor: null,
28802
+ tag: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
28803
+ explicitName: '?',
28804
+ kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.YamlNodeKind.Scalar
28805
+ }),
28806
+ position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
28570
28807
  start: emptyPoint,
28571
28808
  end: emptyPoint
28572
28809
  }),
28810
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
28811
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Plain
28812
+ });
28813
+ return [emptyScalarNode];
28814
+ }
28815
+ };
28816
+ flow_sequence = {
28817
+ enter: node => {
28818
+ const position = CstVisitor.toPosition(node);
28819
+ const tag = CstVisitor.kindNodeToYamlTag(node);
28820
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
28821
+ const sequenceNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__["default"])({
28822
+ children: node.children.flat(),
28823
+ position,
28824
+ anchor,
28825
+ tag,
28826
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
28827
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Explicit
28828
+ });
28829
+ return this.schema.resolve(sequenceNode);
28830
+ }
28831
+ };
28832
+ sequence = {
28833
+ leave: node => {
28834
+ node.children = node.children.flat(+Infinity);
28835
+ }
28836
+ };
28837
+ plain_scalar = {
28838
+ enter: node => {
28839
+ const position = CstVisitor.toPosition(node);
28840
+ const tag = CstVisitor.kindNodeToYamlTag(node);
28841
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
28842
+ const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
28843
+ content: node.text,
28844
+ anchor,
28573
28845
  tag,
28846
+ position,
28847
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
28848
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Plain
28849
+ });
28850
+ return this.schema.resolve(scalarNode);
28851
+ }
28852
+ };
28853
+ single_quote_scalar = {
28854
+ enter: node => {
28855
+ const position = CstVisitor.toPosition(node);
28856
+ const tag = CstVisitor.kindNodeToYamlTag(node);
28857
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
28858
+ const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
28859
+ content: node.text,
28574
28860
  anchor,
28575
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
28576
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Plain
28861
+ tag,
28862
+ position,
28863
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
28864
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.SingleQuoted
28577
28865
  });
28578
- };
28579
-
28580
- /**
28581
- * Public API.
28582
- */
28583
-
28584
- this.enter = function enter(node) {
28585
- // missing anonymous literals from CST transformed into AST literal nodes
28586
- if (node instanceof _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_7__["default"] && !node.isNamed) {
28587
- const position = toPosition(node);
28588
- const value = node.type || node.text;
28589
- const {
28590
- isMissing
28591
- } = node;
28592
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__["default"])({
28593
- value,
28594
- position,
28595
- isMissing
28596
- });
28597
- }
28598
- return undefined;
28599
- };
28600
- this.stream = {
28601
- enter(node) {
28602
- const position = toPosition(node);
28603
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__["default"])({
28604
- children: node.children,
28605
- position,
28606
- isMissing: node.isMissing
28607
- });
28608
- },
28609
- leave(stream) {
28610
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__["default"])({
28611
- children: [stream]
28612
- });
28613
- }
28614
- };
28615
- this.yaml_directive = {
28616
- enter(node) {
28617
- var _node$firstNamedChild;
28618
- const position = toPosition(node);
28619
- const version = (node === null || node === void 0 || (_node$firstNamedChild = node.firstNamedChild) === null || _node$firstNamedChild === void 0 ? void 0 : _node$firstNamedChild.text) || null;
28620
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
28621
- position,
28622
- name: '%YAML',
28623
- parameters: {
28624
- version
28625
- }
28626
- });
28627
- }
28628
- };
28629
- this.tag_directive = {
28630
- enter(node) {
28631
- const position = toPosition(node);
28632
- const tagHandleNode = node.children[0];
28633
- const tagPrefixNode = node.children[1];
28634
- const tagDirective = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
28635
- position,
28636
- name: '%TAG',
28637
- parameters: {
28638
- handle: (tagHandleNode === null || tagHandleNode === void 0 ? void 0 : tagHandleNode.text) || null,
28639
- prefix: (tagPrefixNode === null || tagPrefixNode === void 0 ? void 0 : tagPrefixNode.text) || null
28640
- }
28641
- });
28642
- this.schema.registerTagDirective(tagDirective);
28643
- return tagDirective;
28644
- }
28645
- };
28646
- this.reserved_directive = {
28647
- enter(node) {
28648
- const position = toPosition(node);
28649
- const directiveNameNode = node.children[0];
28650
- const directiveParameter1Node = node.children[1];
28651
- const directiveParameter2Node = node.children[2];
28652
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
28653
- position,
28654
- name: (directiveNameNode === null || directiveNameNode === void 0 ? void 0 : directiveNameNode.text) || null,
28655
- parameters: {
28656
- handle: (directiveParameter1Node === null || directiveParameter1Node === void 0 ? void 0 : directiveParameter1Node.text) || null,
28657
- prefix: (directiveParameter2Node === null || directiveParameter2Node === void 0 ? void 0 : directiveParameter2Node.text) || null
28658
- }
28659
- });
28660
- }
28661
- };
28662
- this.document = {
28663
- enter(node) {
28664
- const position = toPosition(node);
28665
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__["default"])({
28666
- children: node.children,
28667
- position,
28668
- isMissing: node.isMissing
28669
- });
28670
- },
28671
- leave(node) {
28672
- node.children = node.children.flat();
28673
- }
28674
- };
28675
- this.block_node = {
28676
- enter(node) {
28677
- return node.children;
28678
- }
28679
- };
28680
- this.flow_node = {
28681
- enter(node) {
28682
- const [kindCandidate] = node.children.slice(-1);
28683
-
28684
- // kind node is present in flow node
28685
- if (isScalar(kindCandidate) || isMapping(kindCandidate) || isSequence(kindCandidate)) {
28686
- return node.children;
28687
- }
28866
+ return this.schema.resolve(scalarNode);
28867
+ }
28868
+ };
28869
+ double_quote_scalar = {
28870
+ enter: node => {
28871
+ const position = CstVisitor.toPosition(node);
28872
+ const tag = CstVisitor.kindNodeToYamlTag(node);
28873
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
28874
+ const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
28875
+ content: node.text,
28876
+ anchor,
28877
+ tag,
28878
+ position,
28879
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
28880
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.DoubleQuoted
28881
+ });
28882
+ return this.schema.resolve(scalarNode);
28883
+ }
28884
+ };
28885
+ block_scalar = {
28886
+ enter: node => {
28887
+ const position = CstVisitor.toPosition(node);
28888
+ const tag = CstVisitor.kindNodeToYamlTag(node);
28889
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
28890
+ const style = node.text.startsWith('|') ? _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Literal : node.text.startsWith('>') ? _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Folded : null;
28891
+ const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
28892
+ content: node.text,
28893
+ anchor,
28894
+ tag,
28895
+ position,
28896
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Block,
28897
+ style
28898
+ });
28899
+ return this.schema.resolve(scalarNode);
28900
+ }
28901
+ };
28902
+ comment = {
28903
+ enter: node => {
28904
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__["default"])({
28905
+ content: node.text
28906
+ });
28907
+ }
28908
+ };
28688
28909
 
28689
- // kind node not present in flow node, creating empty node
28690
- const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.Point)({
28691
- row: kindCandidate.endPosition.row,
28692
- column: kindCandidate.endPosition.column,
28693
- char: kindCandidate.endIndex
28694
- });
28695
- const emptyScalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
28696
- content: '',
28697
- anchor: kindNodeToYamlAnchor(kindCandidate),
28698
- tag: kindNodeToYamlTag(kindCandidate),
28699
- position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
28700
- start: emptyPoint,
28701
- end: emptyPoint
28702
- }),
28703
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
28704
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Plain
28705
- });
28706
- return [...node.children, emptyScalarNode];
28707
- }
28708
- };
28709
- this.tag = {
28710
- enter() {
28711
- return null;
28712
- }
28713
- };
28714
- this.anchor = {
28715
- enter() {
28716
- return null;
28717
- }
28718
- };
28719
- this.block_mapping = {
28720
- enter(node) {
28721
- const position = toPosition(node);
28722
- const tag = kindNodeToYamlTag(node);
28723
- const anchor = kindNodeToYamlAnchor(node);
28724
- const mappingNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__["default"])({
28725
- children: node.children,
28726
- position,
28727
- anchor,
28728
- tag,
28729
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Block,
28730
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.NextLine,
28731
- isMissing: node.isMissing
28732
- });
28733
- return this.schema.resolve(mappingNode);
28734
- }
28735
- };
28736
- this.block_mapping_pair = {
28737
- enter(node) {
28738
- const position = toPosition(node);
28739
- const children = [...node.children];
28740
- if (hasKeyValuePairEmptyKey(node)) {
28741
- const keyNode = createKeyValuePairEmptyKey(node);
28742
- children.unshift(keyNode);
28743
- }
28744
- if (hasKeyValuePairEmptyValue(node)) {
28745
- const valueNode = createKeyValuePairEmptyValue(node);
28746
- children.push(valueNode);
28747
- }
28748
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__["default"])({
28749
- children,
28750
- position,
28751
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Block,
28752
- isMissing: node.isMissing
28753
- });
28754
- }
28755
- };
28756
- this.flow_mapping = {
28757
- enter(node) {
28758
- const position = toPosition(node);
28759
- const tag = kindNodeToYamlTag(node);
28760
- const anchor = kindNodeToYamlAnchor(node);
28761
- const mappingNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__["default"])({
28762
- children: node.children,
28763
- position,
28764
- anchor,
28765
- tag,
28766
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
28767
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Explicit,
28768
- isMissing: node.isMissing
28769
- });
28770
- return this.schema.resolve(mappingNode);
28771
- }
28772
- };
28773
- this.flow_pair = {
28774
- enter(node) {
28775
- const position = toPosition(node);
28776
- const children = [...node.children];
28777
- if (hasKeyValuePairEmptyKey(node)) {
28778
- const keyNode = createKeyValuePairEmptyKey(node);
28779
- children.unshift(keyNode);
28780
- }
28781
- if (hasKeyValuePairEmptyValue(node)) {
28782
- const valueNode = createKeyValuePairEmptyValue(node);
28783
- children.push(valueNode);
28784
- }
28785
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__["default"])({
28786
- children,
28787
- position,
28788
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
28789
- isMissing: node.isMissing
28790
- });
28791
- }
28792
- };
28793
- this.keyValuePair = {
28794
- leave(node) {
28795
- node.children = node.children.flat();
28796
- }
28797
- };
28798
- this.block_sequence = {
28799
- enter(node) {
28800
- const position = toPosition(node);
28801
- const tag = kindNodeToYamlTag(node);
28802
- const anchor = kindNodeToYamlAnchor(node);
28803
- const sequenceNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__["default"])({
28804
- children: node.children,
28805
- position,
28806
- anchor,
28807
- tag,
28808
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Block,
28809
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.NextLine
28810
- });
28811
- return this.schema.resolve(sequenceNode);
28812
- }
28813
- };
28814
- this.block_sequence_item = {
28815
- enter(node) {
28816
- // flow or block node present; first node is always `-` literal
28817
- if (node.children.length > 1) {
28818
- return node.children;
28819
- }
28910
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28911
+ constructor(schema) {
28912
+ this.schema = schema;
28913
+ }
28820
28914
 
28821
- // create empty node
28822
- const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.Point)({
28823
- row: node.endPosition.row,
28824
- column: node.endPosition.column,
28825
- char: node.endIndex
28826
- });
28827
- const emptyScalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
28828
- content: '',
28829
- anchor: null,
28830
- tag: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
28831
- explicitName: '?',
28832
- kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.YamlNodeKind.Scalar
28833
- }),
28834
- position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
28835
- start: emptyPoint,
28836
- end: emptyPoint
28837
- }),
28838
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
28839
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Plain
28840
- });
28841
- return [emptyScalarNode];
28842
- }
28843
- };
28844
- this.flow_sequence = {
28845
- enter(node) {
28846
- const position = toPosition(node);
28847
- const tag = kindNodeToYamlTag(node);
28848
- const anchor = kindNodeToYamlAnchor(node);
28849
- const sequenceNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__["default"])({
28850
- children: node.children.flat(),
28851
- position,
28852
- anchor,
28853
- tag,
28854
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
28855
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Explicit
28856
- });
28857
- return this.schema.resolve(sequenceNode);
28858
- }
28859
- };
28860
- this.sequence = {
28861
- leave(node) {
28862
- node.children = node.children.flat(+Infinity);
28863
- }
28864
- };
28865
- this.plain_scalar = {
28866
- enter(node) {
28867
- const position = toPosition(node);
28868
- const tag = kindNodeToYamlTag(node);
28869
- const anchor = kindNodeToYamlAnchor(node);
28870
- const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
28871
- content: node.text,
28872
- anchor,
28873
- tag,
28874
- position,
28875
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
28876
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Plain
28877
- });
28878
- return this.schema.resolve(scalarNode);
28879
- }
28880
- };
28881
- this.single_quote_scalar = {
28882
- enter(node) {
28883
- const position = toPosition(node);
28884
- const tag = kindNodeToYamlTag(node);
28885
- const anchor = kindNodeToYamlAnchor(node);
28886
- const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
28887
- content: node.text,
28888
- anchor,
28889
- tag,
28890
- position,
28891
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
28892
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.SingleQuoted
28893
- });
28894
- return this.schema.resolve(scalarNode);
28895
- }
28896
- };
28897
- this.double_quote_scalar = {
28898
- enter(node) {
28899
- const position = toPosition(node);
28900
- const tag = kindNodeToYamlTag(node);
28901
- const anchor = kindNodeToYamlAnchor(node);
28902
- const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
28903
- content: node.text,
28904
- anchor,
28905
- tag,
28906
- position,
28907
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
28908
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.DoubleQuoted
28909
- });
28910
- return this.schema.resolve(scalarNode);
28911
- }
28912
- };
28913
- this.block_scalar = {
28914
- enter(node) {
28915
- const position = toPosition(node);
28916
- const tag = kindNodeToYamlTag(node);
28917
- const anchor = kindNodeToYamlAnchor(node);
28918
- const style = node.text.startsWith('|') ? _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Literal : node.text.startsWith('>') ? _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Folded : null;
28919
- const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
28920
- content: node.text,
28921
- anchor,
28922
- tag,
28923
- position,
28924
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Block,
28925
- style
28926
- });
28927
- return this.schema.resolve(scalarNode);
28928
- }
28929
- };
28930
- this.comment = {
28931
- enter(node) {
28932
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_16__["default"])({
28933
- content: node.text
28934
- });
28935
- }
28936
- };
28937
- this.ERROR = function ERROR(node, key, parent, path) {
28938
- const position = toPosition(node);
28939
- const errorNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_17__["default"])({
28940
- children: node.children,
28915
+ // eslint-disable-next-line class-methods-use-this
28916
+ enter(node) {
28917
+ // missing anonymous literals from CST transformed into AST literal nodes
28918
+ if (node instanceof _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_14__["default"] && !node.isNamed) {
28919
+ const position = CstVisitor.toPosition(node);
28920
+ const value = node.type || node.text;
28921
+ const {
28922
+ isMissing
28923
+ } = node;
28924
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__["default"])({
28925
+ value,
28941
28926
  position,
28942
- isUnexpected: !node.hasError,
28943
- isMissing: node.isMissing,
28944
- value: node.text
28927
+ isMissing
28945
28928
  });
28946
- if (path.length === 0) {
28947
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__["default"])({
28948
- children: [errorNode]
28949
- });
28950
- }
28951
- return errorNode;
28952
- };
28929
+ }
28930
+ return undefined;
28953
28931
  }
28954
- });
28932
+
28933
+ // eslint-disable-next-line class-methods-use-this
28934
+ ERROR(node, key, parent, path) {
28935
+ const position = CstVisitor.toPosition(node);
28936
+ const errorNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_16__["default"])({
28937
+ children: node.children,
28938
+ position,
28939
+ isUnexpected: !node.hasError,
28940
+ isMissing: node.isMissing,
28941
+ value: node.text
28942
+ });
28943
+ if (path.length === 0) {
28944
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__["default"])({
28945
+ children: [errorNode]
28946
+ });
28947
+ }
28948
+ return errorNode;
28949
+ }
28950
+ }
28955
28951
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CstVisitor);
28956
28952
 
28957
28953
  /***/ }),
@@ -28967,15 +28963,13 @@ __webpack_require__.r(__webpack_exports__);
28967
28963
  /* harmony export */ isNode: () => (/* binding */ isNode),
28968
28964
  /* harmony export */ keyMap: () => (/* binding */ keyMap)
28969
28965
  /* harmony export */ });
28970
- /* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(86591);
28971
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(51394);
28972
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(4314);
28973
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(50821);
28974
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(36903);
28975
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(48355);
28976
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(84651);
28977
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(67952);
28978
-
28966
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(51394);
28967
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4314);
28968
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(50821);
28969
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(36903);
28970
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(48355);
28971
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84651);
28972
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(67952);
28979
28973
 
28980
28974
 
28981
28975
  const keyMap = {
@@ -28985,164 +28979,155 @@ const keyMap = {
28985
28979
  keyValuePair: ['children'],
28986
28980
  sequence: ['children'],
28987
28981
  error: ['children'],
28988
- ..._swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.keyMapDefault
28982
+ ..._swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.keyMapDefault
28989
28983
  };
28990
28984
  const getNodeType = node => {
28991
- if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__.isElement)(node)) {
28992
- return (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.getNodeType)(node);
28985
+ if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.isElement)(node)) {
28986
+ return (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.getNodeType)(node);
28993
28987
  }
28994
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.getNodeType)(node);
28988
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.getNodeType)(node);
28995
28989
  };
28996
- const isNode = node => (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__.isElement)(node) || (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.isNode)(node) || Array.isArray(node);
28990
+ const isNode = node => (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.isElement)(node) || (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.isNode)(node) || Array.isArray(node);
28997
28991
 
28998
28992
  /* eslint-disable no-underscore-dangle */
28999
28993
 
29000
- const YamlAstVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
29001
- props: {
29002
- sourceMap: false,
29003
- processedDocumentCount: 0,
29004
- annotations: [],
29005
- namespace: null
29006
- },
29007
- init() {
29008
- /**
29009
- * Private API.
29010
- */
29011
-
29012
- const maybeAddSourceMap = (node, element) => {
29013
- if (!this.sourceMap) {
29014
- return;
29015
- }
29016
- const sourceMap = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.SourceMapElement();
28994
+ class YamlAstVisitor {
28995
+ sourceMap = false;
28996
+ processedDocumentCount = 0;
28997
+ stream = {
28998
+ leave: node => {
28999
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.ParseResultElement();
29017
29000
  // @ts-ignore
29018
- sourceMap.position = node.position;
29019
- // @ts-ignore
29020
- sourceMap.astNode = node;
29021
- element.meta.set('sourceMap', sourceMap);
29022
- };
29023
-
29024
- /**
29025
- * Public API.
29026
- */
29027
-
29028
- this.namespace = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.createNamespace)();
29029
- this.annotations = [];
29030
- this.stream = {
29031
- leave(node) {
29032
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.ParseResultElement();
29033
- // @ts-ignore
29034
- element._content = node.children.flat(1);
29035
-
29036
- // mark first-non Annotation element as result
29037
- // @ts-ignore
29038
- const elements = element.findElements(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__.isPrimitiveElement);
29039
- if (elements.length > 0) {
29040
- const resultElement = elements[0];
29041
- resultElement.classes.push('result');
29042
- }
29001
+ element._content = node.children.flat(1);
29043
29002
 
29044
- // provide annotations
29045
- this.annotations.forEach(annotationElement => {
29046
- element.push(annotationElement);
29047
- });
29048
- this.annotations = [];
29049
- return element;
29050
- }
29051
- };
29052
- this.comment = function comment(node) {
29053
- const isStreamComment = this.processedDocumentCount === 0;
29054
-
29055
- // we're only interested of stream comments before the first document
29056
- if (isStreamComment) {
29057
- // @ts-ignore
29058
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.CommentElement(node.content);
29059
- maybeAddSourceMap(node, element);
29060
- return element;
29061
- }
29062
- return null;
29063
- };
29064
- this.document = function document(node) {
29065
- const shouldWarnAboutMoreDocuments = this.processedDocumentCount === 1;
29066
- const shouldSkipVisitingMoreDocuments = this.processedDocumentCount >= 1;
29067
- if (shouldWarnAboutMoreDocuments) {
29068
- const message = 'Only first document within YAML stream will be used. Rest will be discarded.';
29069
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.AnnotationElement(message);
29070
- element.classes.push('warning');
29071
- maybeAddSourceMap(node, element);
29072
- this.annotations.push(element);
29073
- }
29074
- if (shouldSkipVisitingMoreDocuments) {
29075
- return null;
29076
- }
29077
- this.processedDocumentCount += 1;
29078
- return node.children;
29079
- };
29080
- this.mapping = function mapping(node) {
29081
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.ObjectElement();
29082
- // @ts-ignore
29083
- element._content = node.children;
29084
- maybeAddSourceMap(node, element);
29085
- return element;
29086
- };
29087
- this.keyValuePair = function keyValuePair(node) {
29088
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.MemberElement();
29089
-
29090
- // @ts-ignore
29091
- element.content.key = node.key;
29003
+ // mark first-non Annotation element as result
29092
29004
  // @ts-ignore
29093
- element.content.value = node.value;
29094
- maybeAddSourceMap(node, element);
29005
+ const elements = element.findElements(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.isPrimitiveElement);
29006
+ if (elements.length > 0) {
29007
+ const resultElement = elements[0];
29008
+ resultElement.classes.push('result');
29009
+ }
29095
29010
 
29096
- // process possible errors here that may be present in property node children as we're using direct field access
29097
- node.children.filter(child => child.type === 'error').forEach(errorNode => {
29098
- this.error(errorNode, node, [], [node]);
29011
+ // provide annotations
29012
+ this.annotations.forEach(annotationElement => {
29013
+ element.push(annotationElement);
29099
29014
  });
29015
+ this.annotations = [];
29100
29016
  return element;
29101
- };
29102
- this.sequence = function sequence(node) {
29103
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.ArrayElement();
29104
- // @ts-ignore
29105
- element._content = node.children;
29106
- maybeAddSourceMap(node, element);
29107
- return element;
29108
- };
29109
- this.scalar = function scalar(node) {
29110
- const element = this.namespace.toElement(node.content);
29017
+ }
29018
+ };
29019
+ constructor() {
29020
+ this.annotations = [];
29021
+ this.namespace = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.createNamespace)();
29022
+ }
29023
+ comment(node) {
29024
+ const isStreamComment = this.processedDocumentCount === 0;
29111
29025
 
29112
- // translate style information about empty nodes
29113
- if (node.content === '' && node.style === _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__.YamlStyle.Plain) {
29114
- element.classes.push('yaml-e-node');
29115
- element.classes.push('yaml-e-scalar');
29116
- }
29117
- maybeAddSourceMap(node, element);
29026
+ // we're only interested of stream comments before the first document
29027
+ if (isStreamComment) {
29028
+ // @ts-ignore
29029
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.CommentElement(node.content);
29030
+ this.maybeAddSourceMap(node, element);
29118
29031
  return element;
29119
- };
29120
- this.literal = function literal(node) {
29121
- if (node.isMissing) {
29122
- const message = `(Missing ${node.value})`;
29123
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.AnnotationElement(message);
29124
- element.classes.push('warning');
29125
- maybeAddSourceMap(node, element);
29126
- this.annotations.push(element);
29127
- }
29128
- return null;
29129
- };
29130
- this.error = function error(node, key, parent, path) {
29131
- const message = node.isUnexpected ? '(Unexpected YAML syntax error)' : '(Error YAML syntax error)';
29132
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.AnnotationElement(message);
29133
- element.classes.push('error');
29134
- maybeAddSourceMap(node, element);
29135
- if (path.length === 0) {
29136
- // no document to visit, only error is present in CST
29137
- const parseResultElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.ParseResultElement();
29138
- parseResultElement.push(element);
29139
- return parseResultElement;
29140
- }
29032
+ }
29033
+ return null;
29034
+ }
29035
+ document(node) {
29036
+ const shouldWarnAboutMoreDocuments = this.processedDocumentCount === 1;
29037
+ const shouldSkipVisitingMoreDocuments = this.processedDocumentCount >= 1;
29038
+ if (shouldWarnAboutMoreDocuments) {
29039
+ const message = 'Only first document within YAML stream will be used. Rest will be discarded.';
29040
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.AnnotationElement(message);
29041
+ element.classes.push('warning');
29042
+ this.maybeAddSourceMap(node, element);
29141
29043
  this.annotations.push(element);
29044
+ }
29045
+ if (shouldSkipVisitingMoreDocuments) {
29142
29046
  return null;
29143
- };
29047
+ }
29048
+ this.processedDocumentCount += 1;
29049
+ return node.children;
29144
29050
  }
29145
- });
29051
+ mapping(node) {
29052
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.ObjectElement();
29053
+ // @ts-ignore
29054
+ element._content = node.children;
29055
+ this.maybeAddSourceMap(node, element);
29056
+ return element;
29057
+ }
29058
+ keyValuePair(node) {
29059
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.MemberElement();
29060
+
29061
+ // @ts-ignore
29062
+ element.content.key = node.key;
29063
+ // @ts-ignore
29064
+ element.content.value = node.value;
29065
+ this.maybeAddSourceMap(node, element);
29066
+
29067
+ // process possible errors here that may be present in property node children as we're using direct field access
29068
+ node.children
29069
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29070
+ .filter(child => child.type === 'error')
29071
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29072
+ .forEach(errorNode => {
29073
+ this.error(errorNode, node, [], [node]);
29074
+ });
29075
+ return element;
29076
+ }
29077
+ sequence(node) {
29078
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.ArrayElement();
29079
+ // @ts-ignore
29080
+ element._content = node.children;
29081
+ this.maybeAddSourceMap(node, element);
29082
+ return element;
29083
+ }
29084
+ scalar(node) {
29085
+ const element = this.namespace.toElement(node.content);
29086
+
29087
+ // translate style information about empty nodes
29088
+ if (node.content === '' && node.style === _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Plain) {
29089
+ element.classes.push('yaml-e-node');
29090
+ element.classes.push('yaml-e-scalar');
29091
+ }
29092
+ this.maybeAddSourceMap(node, element);
29093
+ return element;
29094
+ }
29095
+ literal(node) {
29096
+ if (node.isMissing) {
29097
+ const message = `(Missing ${node.value})`;
29098
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.AnnotationElement(message);
29099
+ element.classes.push('warning');
29100
+ this.maybeAddSourceMap(node, element);
29101
+ this.annotations.push(element);
29102
+ }
29103
+ return null;
29104
+ }
29105
+ error(node, key, parent, path) {
29106
+ const message = node.isUnexpected ? '(Unexpected YAML syntax error)' : '(Error YAML syntax error)';
29107
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.AnnotationElement(message);
29108
+ element.classes.push('error');
29109
+ this.maybeAddSourceMap(node, element);
29110
+ if (path.length === 0) {
29111
+ // no document to visit, only error is present in CST
29112
+ const parseResultElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.ParseResultElement();
29113
+ parseResultElement.push(element);
29114
+ return parseResultElement;
29115
+ }
29116
+ this.annotations.push(element);
29117
+ return null;
29118
+ }
29119
+ maybeAddSourceMap(node, element) {
29120
+ if (!this.sourceMap) {
29121
+ return;
29122
+ }
29123
+ const sourceMap = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.SourceMapElement();
29124
+ // @ts-ignore
29125
+ sourceMap.position = node.position;
29126
+ // @ts-ignore
29127
+ sourceMap.astNode = node;
29128
+ element.meta.set('sourceMap', sourceMap);
29129
+ }
29130
+ }
29146
29131
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (YamlAstVisitor);
29147
29132
 
29148
29133
  /***/ })