@swagger-api/apidom-parser-adapter-api-design-systems-yaml 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.
@@ -21084,8 +21084,8 @@ const analyze = (cst, {
21084
21084
  const cursor = cst.walk();
21085
21085
  const iterator = new _TreeCursorIterator_mjs__WEBPACK_IMPORTED_MODULE_0__["default"](cursor);
21086
21086
  const [rootNode] = Array.from(iterator);
21087
- const cstVisitor = (0,_visitors_CstVisitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])();
21088
- const astVisitor = (0,_visitors_YamlAstVisitor_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])();
21087
+ const cstVisitor = new _visitors_CstVisitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
21088
+ const astVisitor = new _visitors_YamlAstVisitor_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]();
21089
21089
  const schema = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])();
21090
21090
  const yamlAst = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__.visit)(rootNode, cstVisitor, {
21091
21091
  // @ts-ignore
@@ -21120,25 +21120,23 @@ __webpack_require__.r(__webpack_exports__);
21120
21120
  /* harmony export */ isNode: () => (/* binding */ isNode),
21121
21121
  /* harmony export */ keyMap: () => (/* binding */ keyMap)
21122
21122
  /* harmony export */ });
21123
- /* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(86591);
21124
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51394);
21125
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(87127);
21126
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(37837);
21127
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(20860);
21128
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(94093);
21129
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4314);
21130
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(78681);
21131
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(84768);
21132
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(69348);
21133
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(75795);
21134
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(55676);
21135
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(13856);
21136
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(49873);
21137
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(10914);
21138
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(40968);
21139
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(5773);
21140
- /* harmony import */ var _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6411);
21141
-
21123
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51394);
21124
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87127);
21125
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(37837);
21126
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(20860);
21127
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(94093);
21128
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4314);
21129
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(84768);
21130
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(69348);
21131
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(75795);
21132
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(55676);
21133
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(13856);
21134
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(49873);
21135
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(10914);
21136
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(40968);
21137
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(78681);
21138
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(5773);
21139
+ /* harmony import */ var _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(6411);
21142
21140
 
21143
21141
 
21144
21142
  const keyMap = {
@@ -21149,526 +21147,524 @@ const keyMap = {
21149
21147
  sequence: ['children'],
21150
21148
  error: ['children']
21151
21149
  };
21152
-
21153
- // @ts-ignore
21154
- const isNode = node => Array.isArray(node) || (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.isNode)(node);
21150
+ const isNode = node => Array.isArray(node) || (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__.isNode)(node);
21155
21151
 
21156
21152
  /* eslint-disable no-param-reassign */
21157
21153
 
21158
- const CstVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
21159
- props: {
21160
- schema: null
21161
- },
21162
- init() {
21163
- /**
21164
- * Private API.
21165
- */
21154
+ class CstVisitor {
21155
+ static isScalar = this.isKind('scalar');
21156
+ static isMapping = this.isKind('mapping');
21157
+ static isSequence = this.isKind('sequence');
21158
+ static isKind(ending) {
21159
+ return node => node != null && typeof node === 'object' && 'type' in node && typeof node.type === 'string' && node.type.endsWith(ending);
21160
+ }
21161
+ static toPosition(node) {
21162
+ const start = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
21163
+ row: node.startPosition.row,
21164
+ column: node.startPosition.column,
21165
+ char: node.startIndex
21166
+ });
21167
+ const end = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
21168
+ row: node.endPosition.row,
21169
+ column: node.endPosition.column,
21170
+ char: node.endIndex
21171
+ });
21172
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
21173
+ start,
21174
+ end
21175
+ });
21176
+ }
21177
+ static hasKeyValuePairEmptyKey(node) {
21178
+ if (node.type !== 'block_mapping_pair' && node.type !== 'flow_pair') {
21179
+ return false;
21180
+ }
21181
+ // keyNode was not explicitly provided; tag and anchor are missing too
21182
+ return typeof node.keyNode === 'undefined';
21183
+ }
21184
+ static hasKeyValuePairEmptyValue(node) {
21185
+ if (node.type !== 'block_mapping_pair' && node.type !== 'flow_pair') {
21186
+ return false;
21187
+ }
21188
+ // valueNode was not explicitly provided; tag and anchor are missing too
21189
+ return typeof node.valueNode === 'undefined';
21190
+ }
21191
+ static kindNodeToYamlTag(node) {
21192
+ const {
21193
+ tag: tagNode
21194
+ } = node;
21195
+ const explicitName = (tagNode === null || tagNode === void 0 ? void 0 : tagNode.text) || (node.type === 'plain_scalar' ? '?' : '!');
21196
+ 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;
21197
+ const position = tagNode ? CstVisitor.toPosition(tagNode) : null;
21198
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
21199
+ explicitName,
21200
+ kind,
21201
+ position
21202
+ });
21203
+ }
21204
+ static kindNodeToYamlAnchor(node) {
21205
+ const {
21206
+ anchor: anchorNode
21207
+ } = node;
21208
+ if (typeof anchorNode === 'undefined') return null;
21209
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
21210
+ name: anchorNode.text,
21211
+ position: CstVisitor.toPosition(anchorNode)
21212
+ });
21213
+ }
21214
+ static createKeyValuePairEmptyKey(node) {
21215
+ const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
21216
+ row: node.startPosition.row,
21217
+ column: node.startPosition.column,
21218
+ char: node.startIndex
21219
+ });
21220
+ const {
21221
+ keyNode
21222
+ } = node;
21223
+ const children = (keyNode === null || keyNode === void 0 ? void 0 : keyNode.children) || [];
21224
+ const tagNode = children.find(CstVisitor.isKind('tag'));
21225
+ const anchorNode = children.find(CstVisitor.isKind('anchor'));
21226
+ const tag = typeof tagNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
21227
+ explicitName: tagNode.text,
21228
+ kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.YamlNodeKind.Scalar,
21229
+ position: CstVisitor.toPosition(tagNode)
21230
+ }) : (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
21231
+ explicitName: '?',
21232
+ kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.YamlNodeKind.Scalar
21233
+ });
21234
+ const anchor = typeof anchorNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
21235
+ name: anchorNode.text,
21236
+ position: CstVisitor.toPosition(anchorNode)
21237
+ }) : null;
21238
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
21239
+ content: '',
21240
+ position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
21241
+ start: emptyPoint,
21242
+ end: emptyPoint
21243
+ }),
21244
+ tag,
21245
+ anchor,
21246
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
21247
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Plain
21248
+ });
21249
+ }
21250
+ static createKeyValuePairEmptyValue(node) {
21251
+ const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
21252
+ row: node.endPosition.row,
21253
+ column: node.endPosition.column,
21254
+ char: node.endIndex
21255
+ });
21256
+ const {
21257
+ valueNode
21258
+ } = node;
21259
+ const children = (valueNode === null || valueNode === void 0 ? void 0 : valueNode.children) || [];
21260
+ const tagNode = children.find(CstVisitor.isKind('tag'));
21261
+ const anchorNode = children.find(CstVisitor.isKind('anchor'));
21262
+ const tag = typeof tagNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
21263
+ explicitName: tagNode.text,
21264
+ kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.YamlNodeKind.Scalar,
21265
+ position: CstVisitor.toPosition(tagNode)
21266
+ }) : (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
21267
+ explicitName: '?',
21268
+ kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.YamlNodeKind.Scalar
21269
+ });
21270
+ const anchor = typeof anchorNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
21271
+ name: anchorNode.text,
21272
+ position: CstVisitor.toPosition(anchorNode)
21273
+ }) : null;
21274
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
21275
+ content: '',
21276
+ position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
21277
+ start: emptyPoint,
21278
+ end: emptyPoint
21279
+ }),
21280
+ tag,
21281
+ anchor,
21282
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
21283
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Plain
21284
+ });
21285
+ }
21286
+
21287
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21166
21288
 
21167
- const toPosition = node => {
21168
- const start = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.Point)({
21169
- row: node.startPosition.row,
21170
- column: node.startPosition.column,
21171
- char: node.startIndex
21289
+ stream = {
21290
+ enter: node => {
21291
+ const position = CstVisitor.toPosition(node);
21292
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__["default"])({
21293
+ children: node.children,
21294
+ position,
21295
+ isMissing: node.isMissing
21172
21296
  });
21173
- const end = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.Point)({
21174
- row: node.endPosition.row,
21175
- column: node.endPosition.column,
21176
- char: node.endIndex
21297
+ },
21298
+ leave: stream => {
21299
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__["default"])({
21300
+ children: [stream]
21301
+ });
21302
+ }
21303
+ };
21304
+ yaml_directive = {
21305
+ enter: node => {
21306
+ var _node$firstNamedChild;
21307
+ const position = CstVisitor.toPosition(node);
21308
+ const version = (node === null || node === void 0 || (_node$firstNamedChild = node.firstNamedChild) === null || _node$firstNamedChild === void 0 ? void 0 : _node$firstNamedChild.text) || null;
21309
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__["default"])({
21310
+ position,
21311
+ name: '%YAML',
21312
+ parameters: {
21313
+ version
21314
+ }
21177
21315
  });
21178
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
21179
- start,
21180
- end
21316
+ }
21317
+ };
21318
+ tag_directive = {
21319
+ enter: node => {
21320
+ const position = CstVisitor.toPosition(node);
21321
+ const tagHandleNode = node.children[0];
21322
+ const tagPrefixNode = node.children[1];
21323
+ const tagDirective = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__["default"])({
21324
+ position,
21325
+ name: '%TAG',
21326
+ parameters: {
21327
+ handle: (tagHandleNode === null || tagHandleNode === void 0 ? void 0 : tagHandleNode.text) || null,
21328
+ prefix: (tagPrefixNode === null || tagPrefixNode === void 0 ? void 0 : tagPrefixNode.text) || null
21329
+ }
21181
21330
  });
21182
- };
21183
- const kindNodeToYamlTag = node => {
21184
- const {
21185
- tag: tagNode
21186
- } = node;
21187
- const explicitName = (tagNode === null || tagNode === void 0 ? void 0 : tagNode.text) || (node.type === 'plain_scalar' ? '?' : '!');
21188
- 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;
21189
- const position = tagNode ? toPosition(tagNode) : null;
21190
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
21191
- explicitName,
21192
- kind,
21193
- position
21331
+ this.schema.registerTagDirective(tagDirective);
21332
+ return tagDirective;
21333
+ }
21334
+ };
21335
+ reserved_directive = {
21336
+ enter: node => {
21337
+ const position = CstVisitor.toPosition(node);
21338
+ const directiveNameNode = node.children[0];
21339
+ const directiveParameter1Node = node.children[1];
21340
+ const directiveParameter2Node = node.children[2];
21341
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__["default"])({
21342
+ position,
21343
+ name: (directiveNameNode === null || directiveNameNode === void 0 ? void 0 : directiveNameNode.text) || null,
21344
+ parameters: {
21345
+ handle: (directiveParameter1Node === null || directiveParameter1Node === void 0 ? void 0 : directiveParameter1Node.text) || null,
21346
+ prefix: (directiveParameter2Node === null || directiveParameter2Node === void 0 ? void 0 : directiveParameter2Node.text) || null
21347
+ }
21194
21348
  });
21195
- };
21196
- const kindNodeToYamlAnchor = node => {
21197
- const {
21198
- anchor: anchorNode
21199
- } = node;
21200
- if (typeof anchorNode === 'undefined') return null;
21201
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
21202
- name: anchorNode.text,
21203
- position: toPosition(anchorNode)
21349
+ }
21350
+ };
21351
+ document = {
21352
+ enter: node => {
21353
+ const position = CstVisitor.toPosition(node);
21354
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__["default"])({
21355
+ children: node.children,
21356
+ position,
21357
+ isMissing: node.isMissing
21204
21358
  });
21205
- };
21206
- const isKind = ending => node => typeof (node === null || node === void 0 ? void 0 : node.type) === 'string' && node.type.endsWith(ending);
21207
- const isScalar = isKind('scalar');
21208
- const isMapping = isKind('mapping');
21209
- const isSequence = isKind('sequence');
21210
- const hasKeyValuePairEmptyKey = node => {
21211
- if (node.type !== 'block_mapping_pair' && node.type !== 'flow_pair') {
21212
- return false;
21213
- }
21214
- // keyNode was not explicitly provided; tag and anchor are missing too
21215
- return typeof node.keyNode === 'undefined';
21216
- };
21217
- const hasKeyValuePairEmptyValue = node => {
21218
- if (node.type !== 'block_mapping_pair' && node.type !== 'flow_pair') {
21219
- return false;
21359
+ },
21360
+ leave: node => {
21361
+ node.children = node.children.flat();
21362
+ }
21363
+ };
21364
+ block_node = {
21365
+ enter: node => {
21366
+ return node.children;
21367
+ }
21368
+ };
21369
+ flow_node = {
21370
+ enter: node => {
21371
+ const [kindCandidate] = node.children.slice(-1);
21372
+
21373
+ // kind node is present in flow node
21374
+ if (CstVisitor.isScalar(kindCandidate) || CstVisitor.isMapping(kindCandidate) || CstVisitor.isSequence(kindCandidate)) {
21375
+ return node.children;
21220
21376
  }
21221
- // valueNode was not explicitly provided; tag and anchor are missing too
21222
- return typeof node.valueNode === 'undefined';
21223
- };
21224
- const createKeyValuePairEmptyKey = node => {
21225
- const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.Point)({
21226
- row: node.startPosition.row,
21227
- column: node.startPosition.column,
21228
- char: node.startIndex
21229
- });
21230
- const {
21231
- keyNode
21232
- } = node;
21233
- const children = (keyNode === null || keyNode === void 0 ? void 0 : keyNode.children) || [];
21234
- const tagNode = children.find(isKind('tag'));
21235
- const anchorNode = children.find(isKind('anchor'));
21236
- const tag = typeof tagNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
21237
- explicitName: tagNode.text,
21238
- kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.YamlNodeKind.Scalar,
21239
- position: toPosition(tagNode)
21240
- }) : (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
21241
- explicitName: '?',
21242
- kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.YamlNodeKind.Scalar
21377
+
21378
+ // kind node not present in flow node, creating empty node
21379
+ const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
21380
+ row: kindCandidate.endPosition.row,
21381
+ column: kindCandidate.endPosition.column,
21382
+ char: kindCandidate.endIndex
21243
21383
  });
21244
- const anchor = typeof anchorNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
21245
- name: anchorNode.text,
21246
- position: toPosition(anchorNode)
21247
- }) : null;
21248
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
21384
+ const emptyScalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
21249
21385
  content: '',
21250
- position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
21386
+ anchor: CstVisitor.kindNodeToYamlAnchor(kindCandidate),
21387
+ tag: CstVisitor.kindNodeToYamlTag(kindCandidate),
21388
+ position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
21251
21389
  start: emptyPoint,
21252
21390
  end: emptyPoint
21253
21391
  }),
21392
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
21393
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Plain
21394
+ });
21395
+ return [...node.children, emptyScalarNode];
21396
+ }
21397
+ };
21398
+ tag = {
21399
+ enter: () => {
21400
+ return null;
21401
+ }
21402
+ };
21403
+ anchor = {
21404
+ enter: () => {
21405
+ return null;
21406
+ }
21407
+ };
21408
+ block_mapping = {
21409
+ enter: node => {
21410
+ const position = CstVisitor.toPosition(node);
21411
+ const tag = CstVisitor.kindNodeToYamlTag(node);
21412
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
21413
+ const mappingNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__["default"])({
21414
+ children: node.children,
21415
+ position,
21416
+ anchor,
21254
21417
  tag,
21418
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Block,
21419
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.NextLine,
21420
+ isMissing: node.isMissing
21421
+ });
21422
+ return this.schema.resolve(mappingNode);
21423
+ }
21424
+ };
21425
+ block_mapping_pair = {
21426
+ enter: node => {
21427
+ const position = CstVisitor.toPosition(node);
21428
+ const children = [...node.children];
21429
+ if (CstVisitor.hasKeyValuePairEmptyKey(node)) {
21430
+ const keyNode = CstVisitor.createKeyValuePairEmptyKey(node);
21431
+ children.unshift(keyNode);
21432
+ }
21433
+ if (CstVisitor.hasKeyValuePairEmptyValue(node)) {
21434
+ const valueNode = CstVisitor.createKeyValuePairEmptyValue(node);
21435
+ children.push(valueNode);
21436
+ }
21437
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
21438
+ children,
21439
+ position,
21440
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Block,
21441
+ isMissing: node.isMissing
21442
+ });
21443
+ }
21444
+ };
21445
+ flow_mapping = {
21446
+ enter: node => {
21447
+ const position = CstVisitor.toPosition(node);
21448
+ const tag = CstVisitor.kindNodeToYamlTag(node);
21449
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
21450
+ const mappingNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__["default"])({
21451
+ children: node.children,
21452
+ position,
21255
21453
  anchor,
21256
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
21257
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Plain
21454
+ tag,
21455
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
21456
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Explicit,
21457
+ isMissing: node.isMissing
21258
21458
  });
21259
- };
21260
- const createKeyValuePairEmptyValue = node => {
21261
- const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.Point)({
21459
+ return this.schema.resolve(mappingNode);
21460
+ }
21461
+ };
21462
+ flow_pair = {
21463
+ enter: node => {
21464
+ const position = CstVisitor.toPosition(node);
21465
+ const children = [...node.children];
21466
+ if (CstVisitor.hasKeyValuePairEmptyKey(node)) {
21467
+ const keyNode = CstVisitor.createKeyValuePairEmptyKey(node);
21468
+ children.unshift(keyNode);
21469
+ }
21470
+ if (CstVisitor.hasKeyValuePairEmptyValue(node)) {
21471
+ const valueNode = CstVisitor.createKeyValuePairEmptyValue(node);
21472
+ children.push(valueNode);
21473
+ }
21474
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
21475
+ children,
21476
+ position,
21477
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
21478
+ isMissing: node.isMissing
21479
+ });
21480
+ }
21481
+ };
21482
+ keyValuePair = {
21483
+ leave: node => {
21484
+ node.children = node.children.flat();
21485
+ }
21486
+ };
21487
+ block_sequence = {
21488
+ enter: node => {
21489
+ const position = CstVisitor.toPosition(node);
21490
+ const tag = CstVisitor.kindNodeToYamlTag(node);
21491
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
21492
+ const sequenceNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__["default"])({
21493
+ children: node.children,
21494
+ position,
21495
+ anchor,
21496
+ tag,
21497
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Block,
21498
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.NextLine
21499
+ });
21500
+ return this.schema.resolve(sequenceNode);
21501
+ }
21502
+ };
21503
+ block_sequence_item = {
21504
+ enter: node => {
21505
+ // flow or block node present; first node is always `-` literal
21506
+ if (node.children.length > 1) {
21507
+ return node.children;
21508
+ }
21509
+
21510
+ // create empty node
21511
+ const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
21262
21512
  row: node.endPosition.row,
21263
21513
  column: node.endPosition.column,
21264
21514
  char: node.endIndex
21265
21515
  });
21266
- const {
21267
- valueNode
21268
- } = node;
21269
- const children = (valueNode === null || valueNode === void 0 ? void 0 : valueNode.children) || [];
21270
- const tagNode = children.find(isKind('tag'));
21271
- const anchorNode = children.find(isKind('anchor'));
21272
- const tag = typeof tagNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
21273
- explicitName: tagNode.text,
21274
- kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.YamlNodeKind.Scalar,
21275
- position: toPosition(tagNode)
21276
- }) : (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
21277
- explicitName: '?',
21278
- kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.YamlNodeKind.Scalar
21279
- });
21280
- const anchor = typeof anchorNode !== 'undefined' ? (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
21281
- name: anchorNode.text,
21282
- position: toPosition(anchorNode)
21283
- }) : null;
21284
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
21516
+ const emptyScalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
21285
21517
  content: '',
21286
- position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
21518
+ anchor: null,
21519
+ tag: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
21520
+ explicitName: '?',
21521
+ kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.YamlNodeKind.Scalar
21522
+ }),
21523
+ position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
21287
21524
  start: emptyPoint,
21288
21525
  end: emptyPoint
21289
21526
  }),
21527
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
21528
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Plain
21529
+ });
21530
+ return [emptyScalarNode];
21531
+ }
21532
+ };
21533
+ flow_sequence = {
21534
+ enter: node => {
21535
+ const position = CstVisitor.toPosition(node);
21536
+ const tag = CstVisitor.kindNodeToYamlTag(node);
21537
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
21538
+ const sequenceNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__["default"])({
21539
+ children: node.children.flat(),
21540
+ position,
21541
+ anchor,
21542
+ tag,
21543
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
21544
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Explicit
21545
+ });
21546
+ return this.schema.resolve(sequenceNode);
21547
+ }
21548
+ };
21549
+ sequence = {
21550
+ leave: node => {
21551
+ node.children = node.children.flat(+Infinity);
21552
+ }
21553
+ };
21554
+ plain_scalar = {
21555
+ enter: node => {
21556
+ const position = CstVisitor.toPosition(node);
21557
+ const tag = CstVisitor.kindNodeToYamlTag(node);
21558
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
21559
+ const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
21560
+ content: node.text,
21561
+ anchor,
21290
21562
  tag,
21563
+ position,
21564
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
21565
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.Plain
21566
+ });
21567
+ return this.schema.resolve(scalarNode);
21568
+ }
21569
+ };
21570
+ single_quote_scalar = {
21571
+ enter: node => {
21572
+ const position = CstVisitor.toPosition(node);
21573
+ const tag = CstVisitor.kindNodeToYamlTag(node);
21574
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
21575
+ const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
21576
+ content: node.text,
21291
21577
  anchor,
21292
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
21293
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Plain
21578
+ tag,
21579
+ position,
21580
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
21581
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.SingleQuoted
21294
21582
  });
21295
- };
21296
-
21297
- /**
21298
- * Public API.
21299
- */
21300
-
21301
- this.enter = function enter(node) {
21302
- // missing anonymous literals from CST transformed into AST literal nodes
21303
- if (node instanceof _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_7__["default"] && !node.isNamed) {
21304
- const position = toPosition(node);
21305
- const value = node.type || node.text;
21306
- const {
21307
- isMissing
21308
- } = node;
21309
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__["default"])({
21310
- value,
21311
- position,
21312
- isMissing
21313
- });
21314
- }
21315
- return undefined;
21316
- };
21317
- this.stream = {
21318
- enter(node) {
21319
- const position = toPosition(node);
21320
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__["default"])({
21321
- children: node.children,
21322
- position,
21323
- isMissing: node.isMissing
21324
- });
21325
- },
21326
- leave(stream) {
21327
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__["default"])({
21328
- children: [stream]
21329
- });
21330
- }
21331
- };
21332
- this.yaml_directive = {
21333
- enter(node) {
21334
- var _node$firstNamedChild;
21335
- const position = toPosition(node);
21336
- const version = (node === null || node === void 0 || (_node$firstNamedChild = node.firstNamedChild) === null || _node$firstNamedChild === void 0 ? void 0 : _node$firstNamedChild.text) || null;
21337
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
21338
- position,
21339
- name: '%YAML',
21340
- parameters: {
21341
- version
21342
- }
21343
- });
21344
- }
21345
- };
21346
- this.tag_directive = {
21347
- enter(node) {
21348
- const position = toPosition(node);
21349
- const tagHandleNode = node.children[0];
21350
- const tagPrefixNode = node.children[1];
21351
- const tagDirective = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
21352
- position,
21353
- name: '%TAG',
21354
- parameters: {
21355
- handle: (tagHandleNode === null || tagHandleNode === void 0 ? void 0 : tagHandleNode.text) || null,
21356
- prefix: (tagPrefixNode === null || tagPrefixNode === void 0 ? void 0 : tagPrefixNode.text) || null
21357
- }
21358
- });
21359
- this.schema.registerTagDirective(tagDirective);
21360
- return tagDirective;
21361
- }
21362
- };
21363
- this.reserved_directive = {
21364
- enter(node) {
21365
- const position = toPosition(node);
21366
- const directiveNameNode = node.children[0];
21367
- const directiveParameter1Node = node.children[1];
21368
- const directiveParameter2Node = node.children[2];
21369
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
21370
- position,
21371
- name: (directiveNameNode === null || directiveNameNode === void 0 ? void 0 : directiveNameNode.text) || null,
21372
- parameters: {
21373
- handle: (directiveParameter1Node === null || directiveParameter1Node === void 0 ? void 0 : directiveParameter1Node.text) || null,
21374
- prefix: (directiveParameter2Node === null || directiveParameter2Node === void 0 ? void 0 : directiveParameter2Node.text) || null
21375
- }
21376
- });
21377
- }
21378
- };
21379
- this.document = {
21380
- enter(node) {
21381
- const position = toPosition(node);
21382
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__["default"])({
21383
- children: node.children,
21384
- position,
21385
- isMissing: node.isMissing
21386
- });
21387
- },
21388
- leave(node) {
21389
- node.children = node.children.flat();
21390
- }
21391
- };
21392
- this.block_node = {
21393
- enter(node) {
21394
- return node.children;
21395
- }
21396
- };
21397
- this.flow_node = {
21398
- enter(node) {
21399
- const [kindCandidate] = node.children.slice(-1);
21400
-
21401
- // kind node is present in flow node
21402
- if (isScalar(kindCandidate) || isMapping(kindCandidate) || isSequence(kindCandidate)) {
21403
- return node.children;
21404
- }
21583
+ return this.schema.resolve(scalarNode);
21584
+ }
21585
+ };
21586
+ double_quote_scalar = {
21587
+ enter: node => {
21588
+ const position = CstVisitor.toPosition(node);
21589
+ const tag = CstVisitor.kindNodeToYamlTag(node);
21590
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
21591
+ const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
21592
+ content: node.text,
21593
+ anchor,
21594
+ tag,
21595
+ position,
21596
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Flow,
21597
+ style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyle.DoubleQuoted
21598
+ });
21599
+ return this.schema.resolve(scalarNode);
21600
+ }
21601
+ };
21602
+ block_scalar = {
21603
+ enter: node => {
21604
+ const position = CstVisitor.toPosition(node);
21605
+ const tag = CstVisitor.kindNodeToYamlTag(node);
21606
+ const anchor = CstVisitor.kindNodeToYamlAnchor(node);
21607
+ 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;
21608
+ const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
21609
+ content: node.text,
21610
+ anchor,
21611
+ tag,
21612
+ position,
21613
+ styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__.YamlStyleGroup.Block,
21614
+ style
21615
+ });
21616
+ return this.schema.resolve(scalarNode);
21617
+ }
21618
+ };
21619
+ comment = {
21620
+ enter: node => {
21621
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__["default"])({
21622
+ content: node.text
21623
+ });
21624
+ }
21625
+ };
21405
21626
 
21406
- // kind node not present in flow node, creating empty node
21407
- const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.Point)({
21408
- row: kindCandidate.endPosition.row,
21409
- column: kindCandidate.endPosition.column,
21410
- char: kindCandidate.endIndex
21411
- });
21412
- const emptyScalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
21413
- content: '',
21414
- anchor: kindNodeToYamlAnchor(kindCandidate),
21415
- tag: kindNodeToYamlTag(kindCandidate),
21416
- position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
21417
- start: emptyPoint,
21418
- end: emptyPoint
21419
- }),
21420
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
21421
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Plain
21422
- });
21423
- return [...node.children, emptyScalarNode];
21424
- }
21425
- };
21426
- this.tag = {
21427
- enter() {
21428
- return null;
21429
- }
21430
- };
21431
- this.anchor = {
21432
- enter() {
21433
- return null;
21434
- }
21435
- };
21436
- this.block_mapping = {
21437
- enter(node) {
21438
- const position = toPosition(node);
21439
- const tag = kindNodeToYamlTag(node);
21440
- const anchor = kindNodeToYamlAnchor(node);
21441
- const mappingNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__["default"])({
21442
- children: node.children,
21443
- position,
21444
- anchor,
21445
- tag,
21446
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Block,
21447
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.NextLine,
21448
- isMissing: node.isMissing
21449
- });
21450
- return this.schema.resolve(mappingNode);
21451
- }
21452
- };
21453
- this.block_mapping_pair = {
21454
- enter(node) {
21455
- const position = toPosition(node);
21456
- const children = [...node.children];
21457
- if (hasKeyValuePairEmptyKey(node)) {
21458
- const keyNode = createKeyValuePairEmptyKey(node);
21459
- children.unshift(keyNode);
21460
- }
21461
- if (hasKeyValuePairEmptyValue(node)) {
21462
- const valueNode = createKeyValuePairEmptyValue(node);
21463
- children.push(valueNode);
21464
- }
21465
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__["default"])({
21466
- children,
21467
- position,
21468
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Block,
21469
- isMissing: node.isMissing
21470
- });
21471
- }
21472
- };
21473
- this.flow_mapping = {
21474
- enter(node) {
21475
- const position = toPosition(node);
21476
- const tag = kindNodeToYamlTag(node);
21477
- const anchor = kindNodeToYamlAnchor(node);
21478
- const mappingNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__["default"])({
21479
- children: node.children,
21480
- position,
21481
- anchor,
21482
- tag,
21483
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
21484
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Explicit,
21485
- isMissing: node.isMissing
21486
- });
21487
- return this.schema.resolve(mappingNode);
21488
- }
21489
- };
21490
- this.flow_pair = {
21491
- enter(node) {
21492
- const position = toPosition(node);
21493
- const children = [...node.children];
21494
- if (hasKeyValuePairEmptyKey(node)) {
21495
- const keyNode = createKeyValuePairEmptyKey(node);
21496
- children.unshift(keyNode);
21497
- }
21498
- if (hasKeyValuePairEmptyValue(node)) {
21499
- const valueNode = createKeyValuePairEmptyValue(node);
21500
- children.push(valueNode);
21501
- }
21502
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__["default"])({
21503
- children,
21504
- position,
21505
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
21506
- isMissing: node.isMissing
21507
- });
21508
- }
21509
- };
21510
- this.keyValuePair = {
21511
- leave(node) {
21512
- node.children = node.children.flat();
21513
- }
21514
- };
21515
- this.block_sequence = {
21516
- enter(node) {
21517
- const position = toPosition(node);
21518
- const tag = kindNodeToYamlTag(node);
21519
- const anchor = kindNodeToYamlAnchor(node);
21520
- const sequenceNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__["default"])({
21521
- children: node.children,
21522
- position,
21523
- anchor,
21524
- tag,
21525
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Block,
21526
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.NextLine
21527
- });
21528
- return this.schema.resolve(sequenceNode);
21529
- }
21530
- };
21531
- this.block_sequence_item = {
21532
- enter(node) {
21533
- // flow or block node present; first node is always `-` literal
21534
- if (node.children.length > 1) {
21535
- return node.children;
21536
- }
21627
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21628
+ constructor(schema) {
21629
+ this.schema = schema;
21630
+ }
21537
21631
 
21538
- // create empty node
21539
- const emptyPoint = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.Point)({
21540
- row: node.endPosition.row,
21541
- column: node.endPosition.column,
21542
- char: node.endIndex
21543
- });
21544
- const emptyScalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
21545
- content: '',
21546
- anchor: null,
21547
- tag: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
21548
- explicitName: '?',
21549
- kind: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.YamlNodeKind.Scalar
21550
- }),
21551
- position: (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
21552
- start: emptyPoint,
21553
- end: emptyPoint
21554
- }),
21555
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
21556
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Plain
21557
- });
21558
- return [emptyScalarNode];
21559
- }
21560
- };
21561
- this.flow_sequence = {
21562
- enter(node) {
21563
- const position = toPosition(node);
21564
- const tag = kindNodeToYamlTag(node);
21565
- const anchor = kindNodeToYamlAnchor(node);
21566
- const sequenceNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__["default"])({
21567
- children: node.children.flat(),
21568
- position,
21569
- anchor,
21570
- tag,
21571
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
21572
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Explicit
21573
- });
21574
- return this.schema.resolve(sequenceNode);
21575
- }
21576
- };
21577
- this.sequence = {
21578
- leave(node) {
21579
- node.children = node.children.flat(+Infinity);
21580
- }
21581
- };
21582
- this.plain_scalar = {
21583
- enter(node) {
21584
- const position = toPosition(node);
21585
- const tag = kindNodeToYamlTag(node);
21586
- const anchor = kindNodeToYamlAnchor(node);
21587
- const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
21588
- content: node.text,
21589
- anchor,
21590
- tag,
21591
- position,
21592
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
21593
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Plain
21594
- });
21595
- return this.schema.resolve(scalarNode);
21596
- }
21597
- };
21598
- this.single_quote_scalar = {
21599
- enter(node) {
21600
- const position = toPosition(node);
21601
- const tag = kindNodeToYamlTag(node);
21602
- const anchor = kindNodeToYamlAnchor(node);
21603
- const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
21604
- content: node.text,
21605
- anchor,
21606
- tag,
21607
- position,
21608
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
21609
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.SingleQuoted
21610
- });
21611
- return this.schema.resolve(scalarNode);
21612
- }
21613
- };
21614
- this.double_quote_scalar = {
21615
- enter(node) {
21616
- const position = toPosition(node);
21617
- const tag = kindNodeToYamlTag(node);
21618
- const anchor = kindNodeToYamlAnchor(node);
21619
- const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
21620
- content: node.text,
21621
- anchor,
21622
- tag,
21623
- position,
21624
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Flow,
21625
- style: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.DoubleQuoted
21626
- });
21627
- return this.schema.resolve(scalarNode);
21628
- }
21629
- };
21630
- this.block_scalar = {
21631
- enter(node) {
21632
- const position = toPosition(node);
21633
- const tag = kindNodeToYamlTag(node);
21634
- const anchor = kindNodeToYamlAnchor(node);
21635
- 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;
21636
- const scalarNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
21637
- content: node.text,
21638
- anchor,
21639
- tag,
21640
- position,
21641
- styleGroup: _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyleGroup.Block,
21642
- style
21643
- });
21644
- return this.schema.resolve(scalarNode);
21645
- }
21646
- };
21647
- this.comment = {
21648
- enter(node) {
21649
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_16__["default"])({
21650
- content: node.text
21651
- });
21652
- }
21653
- };
21654
- this.ERROR = function ERROR(node, key, parent, path) {
21655
- const position = toPosition(node);
21656
- const errorNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_17__["default"])({
21657
- children: node.children,
21632
+ // eslint-disable-next-line class-methods-use-this
21633
+ enter(node) {
21634
+ // missing anonymous literals from CST transformed into AST literal nodes
21635
+ if (node instanceof _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_14__["default"] && !node.isNamed) {
21636
+ const position = CstVisitor.toPosition(node);
21637
+ const value = node.type || node.text;
21638
+ const {
21639
+ isMissing
21640
+ } = node;
21641
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__["default"])({
21642
+ value,
21658
21643
  position,
21659
- isUnexpected: !node.hasError,
21660
- isMissing: node.isMissing,
21661
- value: node.text
21644
+ isMissing
21662
21645
  });
21663
- if (path.length === 0) {
21664
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__["default"])({
21665
- children: [errorNode]
21666
- });
21667
- }
21668
- return errorNode;
21669
- };
21646
+ }
21647
+ return undefined;
21670
21648
  }
21671
- });
21649
+
21650
+ // eslint-disable-next-line class-methods-use-this
21651
+ ERROR(node, key, parent, path) {
21652
+ const position = CstVisitor.toPosition(node);
21653
+ const errorNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_16__["default"])({
21654
+ children: node.children,
21655
+ position,
21656
+ isUnexpected: !node.hasError,
21657
+ isMissing: node.isMissing,
21658
+ value: node.text
21659
+ });
21660
+ if (path.length === 0) {
21661
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__["default"])({
21662
+ children: [errorNode]
21663
+ });
21664
+ }
21665
+ return errorNode;
21666
+ }
21667
+ }
21672
21668
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CstVisitor);
21673
21669
 
21674
21670
  /***/ }),
@@ -21684,15 +21680,13 @@ __webpack_require__.r(__webpack_exports__);
21684
21680
  /* harmony export */ isNode: () => (/* binding */ isNode),
21685
21681
  /* harmony export */ keyMap: () => (/* binding */ keyMap)
21686
21682
  /* harmony export */ });
21687
- /* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(86591);
21688
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(51394);
21689
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(4314);
21690
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(50821);
21691
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(36903);
21692
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(48355);
21693
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(84651);
21694
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(67952);
21695
-
21683
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(51394);
21684
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4314);
21685
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(50821);
21686
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(36903);
21687
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(48355);
21688
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84651);
21689
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(67952);
21696
21690
 
21697
21691
 
21698
21692
  const keyMap = {
@@ -21702,164 +21696,155 @@ const keyMap = {
21702
21696
  keyValuePair: ['children'],
21703
21697
  sequence: ['children'],
21704
21698
  error: ['children'],
21705
- ..._swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.keyMapDefault
21699
+ ..._swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.keyMapDefault
21706
21700
  };
21707
21701
  const getNodeType = node => {
21708
- if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__.isElement)(node)) {
21709
- return (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.getNodeType)(node);
21702
+ if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.isElement)(node)) {
21703
+ return (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.getNodeType)(node);
21710
21704
  }
21711
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.getNodeType)(node);
21705
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__.getNodeType)(node);
21712
21706
  };
21713
- 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);
21707
+ 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);
21714
21708
 
21715
21709
  /* eslint-disable no-underscore-dangle */
21716
21710
 
21717
- const YamlAstVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
21718
- props: {
21719
- sourceMap: false,
21720
- processedDocumentCount: 0,
21721
- annotations: [],
21722
- namespace: null
21723
- },
21724
- init() {
21725
- /**
21726
- * Private API.
21727
- */
21728
-
21729
- const maybeAddSourceMap = (node, element) => {
21730
- if (!this.sourceMap) {
21731
- return;
21732
- }
21733
- const sourceMap = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.SourceMapElement();
21734
- // @ts-ignore
21735
- sourceMap.position = node.position;
21711
+ class YamlAstVisitor {
21712
+ sourceMap = false;
21713
+ processedDocumentCount = 0;
21714
+ stream = {
21715
+ leave: node => {
21716
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.ParseResultElement();
21736
21717
  // @ts-ignore
21737
- sourceMap.astNode = node;
21738
- element.meta.set('sourceMap', sourceMap);
21739
- };
21740
-
21741
- /**
21742
- * Public API.
21743
- */
21744
-
21745
- this.namespace = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.createNamespace)();
21746
- this.annotations = [];
21747
- this.stream = {
21748
- leave(node) {
21749
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.ParseResultElement();
21750
- // @ts-ignore
21751
- element._content = node.children.flat(1);
21752
-
21753
- // mark first-non Annotation element as result
21754
- // @ts-ignore
21755
- const elements = element.findElements(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_2__.isPrimitiveElement);
21756
- if (elements.length > 0) {
21757
- const resultElement = elements[0];
21758
- resultElement.classes.push('result');
21759
- }
21718
+ element._content = node.children.flat(1);
21760
21719
 
21761
- // provide annotations
21762
- this.annotations.forEach(annotationElement => {
21763
- element.push(annotationElement);
21764
- });
21765
- this.annotations = [];
21766
- return element;
21767
- }
21768
- };
21769
- this.comment = function comment(node) {
21770
- const isStreamComment = this.processedDocumentCount === 0;
21771
-
21772
- // we're only interested of stream comments before the first document
21773
- if (isStreamComment) {
21774
- // @ts-ignore
21775
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.CommentElement(node.content);
21776
- maybeAddSourceMap(node, element);
21777
- return element;
21778
- }
21779
- return null;
21780
- };
21781
- this.document = function document(node) {
21782
- const shouldWarnAboutMoreDocuments = this.processedDocumentCount === 1;
21783
- const shouldSkipVisitingMoreDocuments = this.processedDocumentCount >= 1;
21784
- if (shouldWarnAboutMoreDocuments) {
21785
- const message = 'Only first document within YAML stream will be used. Rest will be discarded.';
21786
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.AnnotationElement(message);
21787
- element.classes.push('warning');
21788
- maybeAddSourceMap(node, element);
21789
- this.annotations.push(element);
21790
- }
21791
- if (shouldSkipVisitingMoreDocuments) {
21792
- return null;
21793
- }
21794
- this.processedDocumentCount += 1;
21795
- return node.children;
21796
- };
21797
- this.mapping = function mapping(node) {
21798
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.ObjectElement();
21720
+ // mark first-non Annotation element as result
21799
21721
  // @ts-ignore
21800
- element._content = node.children;
21801
- maybeAddSourceMap(node, element);
21802
- return element;
21803
- };
21804
- this.keyValuePair = function keyValuePair(node) {
21805
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.MemberElement();
21806
-
21807
- // @ts-ignore
21808
- element.content.key = node.key;
21809
- // @ts-ignore
21810
- element.content.value = node.value;
21811
- maybeAddSourceMap(node, element);
21722
+ const elements = element.findElements(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.isPrimitiveElement);
21723
+ if (elements.length > 0) {
21724
+ const resultElement = elements[0];
21725
+ resultElement.classes.push('result');
21726
+ }
21812
21727
 
21813
- // process possible errors here that may be present in property node children as we're using direct field access
21814
- node.children.filter(child => child.type === 'error').forEach(errorNode => {
21815
- this.error(errorNode, node, [], [node]);
21728
+ // provide annotations
21729
+ this.annotations.forEach(annotationElement => {
21730
+ element.push(annotationElement);
21816
21731
  });
21732
+ this.annotations = [];
21817
21733
  return element;
21818
- };
21819
- this.sequence = function sequence(node) {
21820
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.ArrayElement();
21821
- // @ts-ignore
21822
- element._content = node.children;
21823
- maybeAddSourceMap(node, element);
21824
- return element;
21825
- };
21826
- this.scalar = function scalar(node) {
21827
- const element = this.namespace.toElement(node.content);
21734
+ }
21735
+ };
21736
+ constructor() {
21737
+ this.annotations = [];
21738
+ this.namespace = (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.createNamespace)();
21739
+ }
21740
+ comment(node) {
21741
+ const isStreamComment = this.processedDocumentCount === 0;
21828
21742
 
21829
- // translate style information about empty nodes
21830
- if (node.content === '' && node.style === _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__.YamlStyle.Plain) {
21831
- element.classes.push('yaml-e-node');
21832
- element.classes.push('yaml-e-scalar');
21833
- }
21834
- maybeAddSourceMap(node, element);
21743
+ // we're only interested of stream comments before the first document
21744
+ if (isStreamComment) {
21745
+ // @ts-ignore
21746
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.CommentElement(node.content);
21747
+ this.maybeAddSourceMap(node, element);
21835
21748
  return element;
21836
- };
21837
- this.literal = function literal(node) {
21838
- if (node.isMissing) {
21839
- const message = `(Missing ${node.value})`;
21840
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.AnnotationElement(message);
21841
- element.classes.push('warning');
21842
- maybeAddSourceMap(node, element);
21843
- this.annotations.push(element);
21844
- }
21845
- return null;
21846
- };
21847
- this.error = function error(node, key, parent, path) {
21848
- const message = node.isUnexpected ? '(Unexpected YAML syntax error)' : '(Error YAML syntax error)';
21849
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.AnnotationElement(message);
21850
- element.classes.push('error');
21851
- maybeAddSourceMap(node, element);
21852
- if (path.length === 0) {
21853
- // no document to visit, only error is present in CST
21854
- const parseResultElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.ParseResultElement();
21855
- parseResultElement.push(element);
21856
- return parseResultElement;
21857
- }
21749
+ }
21750
+ return null;
21751
+ }
21752
+ document(node) {
21753
+ const shouldWarnAboutMoreDocuments = this.processedDocumentCount === 1;
21754
+ const shouldSkipVisitingMoreDocuments = this.processedDocumentCount >= 1;
21755
+ if (shouldWarnAboutMoreDocuments) {
21756
+ const message = 'Only first document within YAML stream will be used. Rest will be discarded.';
21757
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.AnnotationElement(message);
21758
+ element.classes.push('warning');
21759
+ this.maybeAddSourceMap(node, element);
21858
21760
  this.annotations.push(element);
21761
+ }
21762
+ if (shouldSkipVisitingMoreDocuments) {
21859
21763
  return null;
21860
- };
21764
+ }
21765
+ this.processedDocumentCount += 1;
21766
+ return node.children;
21861
21767
  }
21862
- });
21768
+ mapping(node) {
21769
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.ObjectElement();
21770
+ // @ts-ignore
21771
+ element._content = node.children;
21772
+ this.maybeAddSourceMap(node, element);
21773
+ return element;
21774
+ }
21775
+ keyValuePair(node) {
21776
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_5__.MemberElement();
21777
+
21778
+ // @ts-ignore
21779
+ element.content.key = node.key;
21780
+ // @ts-ignore
21781
+ element.content.value = node.value;
21782
+ this.maybeAddSourceMap(node, element);
21783
+
21784
+ // process possible errors here that may be present in property node children as we're using direct field access
21785
+ node.children
21786
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21787
+ .filter(child => child.type === 'error')
21788
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21789
+ .forEach(errorNode => {
21790
+ this.error(errorNode, node, [], [node]);
21791
+ });
21792
+ return element;
21793
+ }
21794
+ sequence(node) {
21795
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.ArrayElement();
21796
+ // @ts-ignore
21797
+ element._content = node.children;
21798
+ this.maybeAddSourceMap(node, element);
21799
+ return element;
21800
+ }
21801
+ scalar(node) {
21802
+ const element = this.namespace.toElement(node.content);
21803
+
21804
+ // translate style information about empty nodes
21805
+ if (node.content === '' && node.style === _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__.YamlStyle.Plain) {
21806
+ element.classes.push('yaml-e-node');
21807
+ element.classes.push('yaml-e-scalar');
21808
+ }
21809
+ this.maybeAddSourceMap(node, element);
21810
+ return element;
21811
+ }
21812
+ literal(node) {
21813
+ if (node.isMissing) {
21814
+ const message = `(Missing ${node.value})`;
21815
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.AnnotationElement(message);
21816
+ element.classes.push('warning');
21817
+ this.maybeAddSourceMap(node, element);
21818
+ this.annotations.push(element);
21819
+ }
21820
+ return null;
21821
+ }
21822
+ error(node, key, parent, path) {
21823
+ const message = node.isUnexpected ? '(Unexpected YAML syntax error)' : '(Error YAML syntax error)';
21824
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.AnnotationElement(message);
21825
+ element.classes.push('error');
21826
+ this.maybeAddSourceMap(node, element);
21827
+ if (path.length === 0) {
21828
+ // no document to visit, only error is present in CST
21829
+ const parseResultElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.ParseResultElement();
21830
+ parseResultElement.push(element);
21831
+ return parseResultElement;
21832
+ }
21833
+ this.annotations.push(element);
21834
+ return null;
21835
+ }
21836
+ maybeAddSourceMap(node, element) {
21837
+ if (!this.sourceMap) {
21838
+ return;
21839
+ }
21840
+ const sourceMap = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.SourceMapElement();
21841
+ // @ts-ignore
21842
+ sourceMap.position = node.position;
21843
+ // @ts-ignore
21844
+ sourceMap.astNode = node;
21845
+ element.meta.set('sourceMap', sourceMap);
21846
+ }
21847
+ }
21863
21848
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (YamlAstVisitor);
21864
21849
 
21865
21850
  /***/ })