@swagger-api/apidom-parser-adapter-json 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.
@@ -286,7 +286,7 @@ const isNode = element => (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1
286
286
  const analyze = (cst, {
287
287
  sourceMap = false
288
288
  } = {}) => {
289
- const visitor = (0,_visitors_CstVisitor__WEBPACK_IMPORTED_MODULE_3__["default"])();
289
+ const visitor = new _visitors_CstVisitor__WEBPACK_IMPORTED_MODULE_3__["default"]();
290
290
  const cursor = cst.walk();
291
291
  const iterator = new _TreeCursorIterator__WEBPACK_IMPORTED_MODULE_4__["default"](cursor);
292
292
  const [rootNode] = Array.from(iterator);
@@ -312,178 +312,163 @@ __webpack_require__.r(__webpack_exports__);
312
312
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
313
313
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
314
314
  /* harmony export */ });
315
- /* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6591);
316
- /* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(stampit__WEBPACK_IMPORTED_MODULE_0__);
317
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8355);
318
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6903);
319
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7952);
315
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8355);
316
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6903);
317
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7952);
320
318
  /* harmony import */ var _TreeCursorSyntaxNode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1331);
321
319
 
322
320
 
323
321
 
324
-
325
322
  /* eslint-disable no-underscore-dangle */
326
323
 
327
- const CstVisitor = stampit__WEBPACK_IMPORTED_MODULE_0___default()({
328
- props: {
329
- sourceMap: false,
330
- annotations: []
331
- },
332
- init() {
333
- /**
334
- * Private API.
335
- */
324
+ class CstVisitor {
325
+ static toPosition(node) {
326
+ const start = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.ArrayElement([node.startPosition.row, node.startPosition.column, node.startIndex]);
327
+ const end = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.ArrayElement([node.endPosition.row, node.endPosition.column, node.endIndex]);
328
+ start.classes.push('position');
329
+ end.classes.push('position');
330
+ return [start, end];
331
+ }
332
+ sourceMap = false;
333
+ ParseResultElement = {
334
+ leave: element => {
335
+ // mark first-non Annotation element as result
336
+ // @ts-ignore
337
+ const elements = element.findElements(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.isPrimitiveElement);
338
+ if (elements.length > 0) {
339
+ const resultElement = elements[0];
340
+ resultElement.classes.push('result');
341
+ }
336
342
 
343
+ // provide annotations
344
+ this.annotations.forEach(annotationElement => {
345
+ element.push(annotationElement);
346
+ });
347
+ this.annotations = [];
348
+ }
349
+ };
350
+ constructor() {
337
351
  this.annotations = [];
338
- const toPosition = node => {
339
- const start = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.ArrayElement([node.startPosition.row, node.startPosition.column, node.startIndex]);
340
- const end = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.ArrayElement([node.endPosition.row, node.endPosition.column, node.endIndex]);
341
- start.classes.push('position');
342
- end.classes.push('position');
343
- return [start, end];
344
- };
345
- const maybeAddSourceMap = (node, element) => {
346
- if (!this.sourceMap) {
347
- return;
348
- }
349
- const sourceMap = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.SourceMapElement();
350
- const position = toPosition(node);
351
- if (position !== null) {
352
- const [start, end] = position;
353
- sourceMap.push(start);
354
- sourceMap.push(end);
355
- }
356
- // @ts-ignore
357
- sourceMap.astNode = node;
358
- element.meta.set('sourceMap', sourceMap);
359
- };
352
+ }
353
+ enter(node) {
354
+ // missing anonymous literals from CST transformed into AnnotationElements.
355
+ if (node instanceof _TreeCursorSyntaxNode__WEBPACK_IMPORTED_MODULE_2__["default"] && !node.isNamed && node.isMissing) {
356
+ // collect annotations from missing literals
357
+ const value = node.type || node.text;
358
+ const message = `(Missing ${value})`;
359
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.AnnotationElement(message);
360
+ element.classes.push('warning');
361
+ this.maybeAddSourceMap(node, element);
362
+ this.annotations.push(element);
363
+ }
364
+ return null; // remove everything unrecognized
365
+ }
366
+ document(node) {
367
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.ParseResultElement();
368
+ // @ts-ignore
369
+ element._content = node.children;
370
+ this.maybeAddSourceMap(node, element);
371
+ return element;
372
+ }
373
+ object(node) {
374
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.ObjectElement();
375
+ // @ts-ignore
376
+ element._content = node.children;
377
+ this.maybeAddSourceMap(node, element);
378
+ return element;
379
+ }
380
+ array(node) {
381
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.ArrayElement();
382
+ // @ts-ignore
383
+ element._content = node.children;
384
+ this.maybeAddSourceMap(node, element);
385
+ return element;
386
+ }
387
+ pair(node) {
388
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.MemberElement();
389
+ // @ts-ignore
390
+ element.content.key = node.keyNode;
391
+ // @ts-ignore
392
+ element.content.value = node.valueNode;
393
+ this.maybeAddSourceMap(node, element);
360
394
 
361
395
  /**
362
- * Public API.
396
+ * Process possible errors here that may be present in pair node children as we're using direct field access.
397
+ * There are usually 3 children here found: "key", ":", "value".
363
398
  */
399
+ if (node.children.length > 3) {
400
+ node.children.filter(child => child.type === 'ERROR').forEach(errorNode => {
401
+ this.ERROR(errorNode, node, [], [node]);
402
+ });
403
+ }
404
+ return element;
405
+ }
406
+ string(node) {
407
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.StringElement(JSON.parse(node.text));
408
+ this.maybeAddSourceMap(node, element);
409
+ return element;
410
+ }
411
+ number(node) {
412
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.NumberElement(Number(node.text));
413
+ this.maybeAddSourceMap(node, element);
414
+ return element;
415
+ }
364
416
 
365
- this.enter = function enter(node) {
366
- // missing anonymous literals from CST transformed into AnnotationElements.
367
- if (node instanceof _TreeCursorSyntaxNode__WEBPACK_IMPORTED_MODULE_2__["default"] && !node.isNamed && node.isMissing) {
368
- // collect annotations from missing literals
369
- const value = node.type || node.text;
370
- const message = `(Missing ${value})`;
371
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.AnnotationElement(message);
372
- element.classes.push('warning');
373
- maybeAddSourceMap(node, element);
374
- this.annotations.push(element);
375
- }
376
- return null; // remove everything unrecognized
377
- };
378
- this.document = function document(node) {
379
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.ParseResultElement();
380
- // @ts-ignore
381
- element._content = node.children;
382
- maybeAddSourceMap(node, element);
383
- return element;
384
- };
385
- this.ParseResultElement = {
386
- leave(element) {
387
- // mark first-non Annotation element as result
388
- // @ts-ignore
389
- const elements = element.findElements(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.isPrimitiveElement);
390
- if (elements.length > 0) {
391
- const resultElement = elements[0];
392
- resultElement.classes.push('result');
393
- }
394
-
395
- // provide annotations
396
- this.annotations.forEach(annotationElement => {
397
- element.push(annotationElement);
398
- });
399
- this.annotations = [];
400
- }
401
- };
402
- this.object = function object(node) {
403
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.ObjectElement();
404
- // @ts-ignore
405
- element._content = node.children;
406
- maybeAddSourceMap(node, element);
407
- return element;
408
- };
409
- this.array = function array(node) {
410
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.ArrayElement();
411
- // @ts-ignore
412
- element._content = node.children;
413
- maybeAddSourceMap(node, element);
414
- return element;
415
- };
416
- this.pair = function pair(node) {
417
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.MemberElement();
418
- // @ts-ignore
419
- element.content.key = node.keyNode;
420
- // @ts-ignore
421
- element.content.value = node.valueNode;
422
- maybeAddSourceMap(node, element);
423
-
424
- /**
425
- * Process possible errors here that may be present in pair node children as we're using direct field access.
426
- * There are usually 3 children here found: "key", ":", "value".
427
- */
428
- if (node.children.length > 3) {
429
- node.children.filter(child => child.type === 'ERROR').forEach(errorNode => {
430
- this.ERROR(errorNode, node, [], [node]);
431
- });
432
- }
433
- return element;
434
- };
435
- this.string = function string(node) {
436
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.StringElement(JSON.parse(node.text));
437
- maybeAddSourceMap(node, element);
438
- return element;
439
- };
440
- this.number = function number(node) {
441
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.NumberElement(Number(node.text));
442
- maybeAddSourceMap(node, element);
443
- return element;
444
- };
445
-
446
- // eslint-disable-next-line @typescript-eslint/naming-convention
447
- this.null = function _null(node) {
448
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.NullElement();
449
- maybeAddSourceMap(node, element);
450
- return element;
451
- };
417
+ // eslint-disable-next-line @typescript-eslint/naming-convention
418
+ null(node) {
419
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.NullElement();
420
+ this.maybeAddSourceMap(node, element);
421
+ return element;
422
+ }
452
423
 
453
- // eslint-disable-next-line @typescript-eslint/naming-convention
454
- this.true = function _true(node) {
455
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.BooleanElement(true);
456
- maybeAddSourceMap(node, element);
457
- return element;
458
- };
424
+ // eslint-disable-next-line @typescript-eslint/naming-convention
425
+ true(node) {
426
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.BooleanElement(true);
427
+ this.maybeAddSourceMap(node, element);
428
+ return element;
429
+ }
459
430
 
460
- // eslint-disable-next-line @typescript-eslint/naming-convention
461
- this.false = function _false(node) {
462
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.BooleanElement(false);
463
- maybeAddSourceMap(node, element);
464
- return element;
465
- };
466
- this.ERROR = function ERROR(node, key, parent, path) {
467
- // collect errors as annotations
468
- const isUnexpected = !node.hasError;
469
- const value = node.text;
470
- const message = isUnexpected ? `(Unexpected ${value})` : `(Error ${value})`;
471
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.AnnotationElement(message);
472
- element.classes.push('error');
473
- maybeAddSourceMap(node, element);
474
- if (path.length === 0) {
475
- // no document to visit, only error is present in CST
476
- const parseResultElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.ParseResultElement();
477
- parseResultElement.push(element);
478
- return parseResultElement;
479
- }
431
+ // eslint-disable-next-line @typescript-eslint/naming-convention
432
+ false(node) {
433
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.BooleanElement(false);
434
+ this.maybeAddSourceMap(node, element);
435
+ return element;
436
+ }
437
+ ERROR(node, key, parent, path) {
438
+ // collect errors as annotations
439
+ const isUnexpected = !node.hasError;
440
+ const value = node.text;
441
+ const message = isUnexpected ? `(Unexpected ${value})` : `(Error ${value})`;
442
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.AnnotationElement(message);
443
+ element.classes.push('error');
444
+ this.maybeAddSourceMap(node, element);
445
+ if (path.length === 0) {
446
+ // no document to visit, only error is present in CST
447
+ const parseResultElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.ParseResultElement();
448
+ parseResultElement.push(element);
449
+ return parseResultElement;
450
+ }
480
451
 
481
- // we have CST node for document
482
- this.annotations.push(element);
483
- return null;
484
- };
452
+ // we have CST node for document
453
+ this.annotations.push(element);
454
+ return null;
485
455
  }
486
- });
456
+ maybeAddSourceMap(node, element) {
457
+ if (!this.sourceMap) {
458
+ return;
459
+ }
460
+ const sourceMap = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.SourceMapElement();
461
+ const position = CstVisitor.toPosition(node);
462
+ if (position !== null) {
463
+ const [start, end] = position;
464
+ sourceMap.push(start);
465
+ sourceMap.push(end);
466
+ }
467
+ // @ts-ignore
468
+ sourceMap.astNode = node;
469
+ element.meta.set('sourceMap', sourceMap);
470
+ }
471
+ }
487
472
 
488
473
  /* eslint-enable no-underscore-dangle */
489
474
 
@@ -528,8 +513,8 @@ const analyze = (cst, {
528
513
  const cursor = cst.walk();
529
514
  const iterator = new _TreeCursorIterator__WEBPACK_IMPORTED_MODULE_0__["default"](cursor);
530
515
  const [rootNode] = Array.from(iterator);
531
- const cstVisitor = (0,_visitors_CstVisitor__WEBPACK_IMPORTED_MODULE_1__["default"])();
532
- const astVisitor = (0,_visitors_JsonAstVisitor__WEBPACK_IMPORTED_MODULE_2__["default"])();
516
+ const cstVisitor = new _visitors_CstVisitor__WEBPACK_IMPORTED_MODULE_1__["default"]();
517
+ const astVisitor = new _visitors_JsonAstVisitor__WEBPACK_IMPORTED_MODULE_2__["default"]();
533
518
  const jsonAst = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.visit)(rootNode, cstVisitor, {
534
519
  // @ts-ignore
535
520
  keyMap: _visitors_CstVisitor__WEBPACK_IMPORTED_MODULE_1__.keyMap,
@@ -560,25 +545,22 @@ __webpack_require__.r(__webpack_exports__);
560
545
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
561
546
  /* harmony export */ keyMap: () => (/* binding */ keyMap)
562
547
  /* harmony export */ });
563
- /* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6591);
564
- /* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(stampit__WEBPACK_IMPORTED_MODULE_0__);
565
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7127);
566
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8681);
567
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8529);
568
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9348);
569
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(451);
570
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3278);
571
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(7418);
572
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(5393);
573
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(891);
574
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(9443);
575
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(9974);
576
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(6227);
577
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(7073);
578
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(3094);
579
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(5773);
580
- /* harmony import */ var _TreeCursorSyntaxNode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1331);
581
-
548
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7127);
549
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8529);
550
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9348);
551
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8681);
552
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(451);
553
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(3278);
554
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(7418);
555
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(5393);
556
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(891);
557
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(9443);
558
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(9974);
559
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(6227);
560
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(7073);
561
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(3094);
562
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(5773);
563
+ /* harmony import */ var _TreeCursorSyntaxNode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1331);
582
564
 
583
565
 
584
566
  const keyMap = {
@@ -590,168 +572,160 @@ const keyMap = {
590
572
  key: ['children'],
591
573
  error: ['children']
592
574
  };
593
- const CstVisitor = stampit__WEBPACK_IMPORTED_MODULE_0___default()({
594
- init() {
595
- /**
596
- * Private API.
597
- */
598
575
 
599
- const toPosition = node => {
600
- const start = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
601
- row: node.startPosition.row,
602
- column: node.startPosition.column,
603
- char: node.startIndex
604
- });
605
- const end = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
606
- row: node.endPosition.row,
607
- column: node.endPosition.column,
608
- char: node.endIndex
609
- });
610
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
611
- start,
612
- end
613
- });
614
- };
576
+ /* eslint-disable class-methods-use-this */
615
577
 
616
- /**
617
- * Public API.
618
- */
619
-
620
- this.enter = function enter(node) {
621
- // anonymous literals from CST transformed into AST literal nodes
622
- if (node instanceof _TreeCursorSyntaxNode__WEBPACK_IMPORTED_MODULE_2__["default"] && !node.isNamed) {
623
- const position = toPosition(node);
624
- const value = node.type || node.text;
625
- const {
626
- isMissing
627
- } = node;
628
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
629
- value,
630
- position,
631
- isMissing
632
- });
633
- }
634
- return undefined;
635
- };
636
- this.document = {
637
- enter(node) {
638
- const position = toPosition(node);
639
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
640
- children: node.children,
641
- position,
642
- isMissing: node.isMissing
643
- });
644
- },
645
- leave(document) {
646
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
647
- children: [document]
648
- });
649
- }
650
- };
651
- this.object = function object(node) {
652
- const position = toPosition(node);
653
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__["default"])({
578
+ class CstVisitor {
579
+ static toPosition(node) {
580
+ const start = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__.Point)({
581
+ row: node.startPosition.row,
582
+ column: node.startPosition.column,
583
+ char: node.startIndex
584
+ });
585
+ const end = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__.Point)({
586
+ row: node.endPosition.row,
587
+ column: node.endPosition.column,
588
+ char: node.endIndex
589
+ });
590
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__["default"])({
591
+ start,
592
+ end
593
+ });
594
+ }
595
+ document = {
596
+ enter: node => {
597
+ const position = CstVisitor.toPosition(node);
598
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
654
599
  children: node.children,
655
600
  position,
656
601
  isMissing: node.isMissing
657
602
  });
658
- };
659
- this.pair = function pair(node) {
660
- const position = toPosition(node);
661
- const children = node.children.slice(1);
603
+ },
604
+ leave: document => {
605
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
606
+ children: [document]
607
+ });
608
+ }
609
+ };
610
+ enter(node) {
611
+ // anonymous literals from CST transformed into AST literal nodes
612
+ if (node instanceof _TreeCursorSyntaxNode__WEBPACK_IMPORTED_MODULE_3__["default"] && !node.isNamed) {
613
+ const position = CstVisitor.toPosition(node);
614
+ const value = node.type || node.text;
662
615
  const {
663
- keyNode
616
+ isMissing
664
617
  } = node;
665
- const key = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__["default"])({
666
- children: keyNode?.children || [],
667
- position: keyNode != null ? toPosition(keyNode) : null,
668
- isMissing: keyNode != null ? keyNode.isMissing : false
669
- });
670
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__["default"])({
671
- children: [key, ...children],
672
- position,
673
- isMissing: node.isMissing
674
- });
675
- };
676
- this.array = function array(node) {
677
- const position = toPosition(node);
678
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__["default"])({
679
- children: node.children,
680
- position,
681
- isMissing: node.isMissing
682
- });
683
- };
684
- this.string = function string(node) {
685
- const position = toPosition(node);
686
- const content = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__["default"])({
687
- value: JSON.parse(node.text)
688
- });
689
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
690
- children: [content],
691
- position,
692
- isMissing: node.isMissing
693
- });
694
- };
695
- this.number = function number(node) {
696
- const position = toPosition(node);
697
- const value = node.text;
698
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__["default"])({
618
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
699
619
  value,
700
620
  position,
701
- isMissing: node.isMissing
621
+ isMissing
702
622
  });
703
- };
623
+ }
624
+ return undefined;
625
+ }
626
+ object(node) {
627
+ const position = CstVisitor.toPosition(node);
628
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
629
+ children: node.children,
630
+ position,
631
+ isMissing: node.isMissing
632
+ });
633
+ }
634
+ pair(node) {
635
+ const position = CstVisitor.toPosition(node);
636
+ const children = node.children.slice(1);
637
+ const {
638
+ keyNode
639
+ } = node;
640
+ const key = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__["default"])({
641
+ children: keyNode?.children || [],
642
+ position: keyNode != null ? CstVisitor.toPosition(keyNode) : null,
643
+ isMissing: keyNode != null ? keyNode.isMissing : false
644
+ });
645
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__["default"])({
646
+ children: [key, ...children],
647
+ position,
648
+ isMissing: node.isMissing
649
+ });
650
+ }
651
+ array(node) {
652
+ const position = CstVisitor.toPosition(node);
653
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__["default"])({
654
+ children: node.children,
655
+ position,
656
+ isMissing: node.isMissing
657
+ });
658
+ }
659
+ string(node) {
660
+ const position = CstVisitor.toPosition(node);
661
+ const content = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__["default"])({
662
+ value: JSON.parse(node.text)
663
+ });
664
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__["default"])({
665
+ children: [content],
666
+ position,
667
+ isMissing: node.isMissing
668
+ });
669
+ }
670
+ number(node) {
671
+ const position = CstVisitor.toPosition(node);
672
+ const value = node.text;
673
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
674
+ value,
675
+ position,
676
+ isMissing: node.isMissing
677
+ });
678
+ }
704
679
 
705
- // eslint-disable-next-line @typescript-eslint/naming-convention
706
- this.null = function _null(node) {
707
- const position = toPosition(node);
708
- const value = node.text;
709
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__["default"])({
710
- value,
711
- position,
712
- isMissing: node.isMissing
713
- });
714
- };
680
+ // eslint-disable-next-line @typescript-eslint/naming-convention
681
+ null(node) {
682
+ const position = CstVisitor.toPosition(node);
683
+ const value = node.text;
684
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__["default"])({
685
+ value,
686
+ position,
687
+ isMissing: node.isMissing
688
+ });
689
+ }
715
690
 
716
- // eslint-disable-next-line @typescript-eslint/naming-convention
717
- this.true = function _true(node) {
718
- const position = toPosition(node);
719
- const value = node.text;
720
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__["default"])({
721
- value,
722
- position,
723
- isMissing: node.isMissing
724
- });
725
- };
691
+ // eslint-disable-next-line @typescript-eslint/naming-convention
692
+ true(node) {
693
+ const position = CstVisitor.toPosition(node);
694
+ const value = node.text;
695
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__["default"])({
696
+ value,
697
+ position,
698
+ isMissing: node.isMissing
699
+ });
700
+ }
726
701
 
727
- // eslint-disable-next-line @typescript-eslint/naming-convention
728
- this.false = function _false(node) {
729
- const position = toPosition(node);
730
- const value = node.text;
731
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__["default"])({
732
- value,
733
- position,
734
- isMissing: node.isMissing
735
- });
736
- };
737
- this.ERROR = function ERROR(node, key, parent, path) {
738
- const position = toPosition(node);
739
- const errorNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_16__["default"])({
740
- children: node.children,
741
- position,
742
- isUnexpected: !node.hasError,
743
- isMissing: node.isMissing,
744
- value: node.text
702
+ // eslint-disable-next-line @typescript-eslint/naming-convention
703
+ false(node) {
704
+ const position = CstVisitor.toPosition(node);
705
+ const value = node.text;
706
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__["default"])({
707
+ value,
708
+ position,
709
+ isMissing: node.isMissing
710
+ });
711
+ }
712
+ ERROR(node, key, parent, path) {
713
+ const position = CstVisitor.toPosition(node);
714
+ const errorNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__["default"])({
715
+ children: node.children,
716
+ position,
717
+ isUnexpected: !node.hasError,
718
+ isMissing: node.isMissing,
719
+ value: node.text
720
+ });
721
+ if (path.length === 0) {
722
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
723
+ children: [errorNode]
745
724
  });
746
- if (path.length === 0) {
747
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
748
- children: [errorNode]
749
- });
750
- }
751
- return errorNode;
752
- };
725
+ }
726
+ return errorNode;
753
727
  }
754
- });
728
+ }
755
729
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CstVisitor);
756
730
 
757
731
  /***/ }),
@@ -767,23 +741,22 @@ __webpack_require__.r(__webpack_exports__);
767
741
  /* harmony export */ isNode: () => (/* binding */ isNode),
768
742
  /* harmony export */ keyMap: () => (/* binding */ keyMap)
769
743
  /* harmony export */ });
770
- /* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6591);
771
- /* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(stampit__WEBPACK_IMPORTED_MODULE_0__);
772
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9348);
773
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8529);
774
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(451);
775
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7418);
776
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5393);
777
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5773);
778
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(1394);
779
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(821);
780
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(6903);
781
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(8355);
782
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(7952);
783
-
744
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9348);
745
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8529);
746
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(451);
747
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7418);
748
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5393);
749
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5773);
750
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1394);
751
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(821);
752
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6903);
753
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(8355);
754
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(7952);
784
755
 
785
756
 
786
757
  const keyMap = {
758
+ // @ts-ignore
759
+ [_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__["default"].type]: ['children'],
787
760
  // @ts-ignore
788
761
  [_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"].type]: ['children'],
789
762
  // @ts-ignore
@@ -794,169 +767,161 @@ const keyMap = {
794
767
  [_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"].type]: ['children'],
795
768
  // @ts-ignore
796
769
  [_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"].type]: ['children'],
797
- // @ts-ignore
798
- [_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__["default"].type]: ['children'],
799
- ..._swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.keyMapDefault
770
+ ..._swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.keyMapDefault
800
771
  };
801
772
  const getNodeType = node => {
802
- if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_8__.isParseResultElement)(node)) {
773
+ if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.isParseResultElement)(node)) {
803
774
  return 'ParseResultElement';
804
775
  }
805
- if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_8__.isElement)(node)) {
806
- return (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.getNodeType)(node);
776
+ if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.isElement)(node)) {
777
+ return (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.getNodeType)(node);
807
778
  }
808
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__.getNodeType)(node);
779
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__.getNodeType)(node);
809
780
  };
810
- const isNode = element => (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_8__.isElement)(element) || (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__.isNode)(element);
781
+ const isNode = element => (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.isElement)(element) || (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__.isNode)(element);
811
782
 
812
783
  /* eslint-disable no-underscore-dangle */
813
784
 
814
- const JsonAstVisitor = stampit__WEBPACK_IMPORTED_MODULE_0___default()({
815
- props: {
816
- sourceMap: false,
817
- annotations: []
818
- },
819
- init() {
820
- /**
821
- * Private API.
822
- */
823
-
824
- this.annotation = [];
825
- const maybeAddSourceMap = (node, element) => {
826
- if (!this.sourceMap) {
827
- return;
828
- }
829
- const sourceMap = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.SourceMapElement();
830
- // @ts-ignore
831
- sourceMap.position = node.position;
785
+ class JsonAstVisitor {
786
+ sourceMap = false;
787
+ ParseResultElement = {
788
+ leave: element => {
789
+ // mark first-non Annotation element as result
832
790
  // @ts-ignore
833
- sourceMap.astNode = node;
834
- element.meta.set('sourceMap', sourceMap);
835
- };
791
+ const elements = element.findElements(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.isPrimitiveElement);
792
+ if (elements.length > 0) {
793
+ const resultElement = elements[0];
794
+ resultElement.classes.push('result');
795
+ }
836
796
 
837
- /**
838
- * Public API.
839
- */
797
+ // provide annotations
798
+ this.annotations.forEach(annotationElement => {
799
+ element.push(annotationElement);
800
+ });
801
+ this.annotations = [];
802
+ }
803
+ };
804
+ constructor() {
805
+ this.annotations = [];
806
+ }
840
807
 
841
- this.document = function document(node) {
842
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.ParseResultElement();
843
- // @ts-ignore
844
- element._content = node.children;
845
- return element;
846
- };
847
- this.ParseResultElement = {
848
- leave(element) {
849
- // mark first-non Annotation element as result
850
- // @ts-ignore
851
- const elements = element.findElements(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_8__.isPrimitiveElement);
852
- if (elements.length > 0) {
853
- const resultElement = elements[0];
854
- resultElement.classes.push('result');
855
- }
808
+ // eslint-disable-next-line class-methods-use-this
809
+ document(node) {
810
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.ParseResultElement();
811
+ // @ts-ignore
812
+ element._content = node.children;
813
+ return element;
814
+ }
815
+ object(node) {
816
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.ObjectElement();
817
+ // @ts-ignore
818
+ element._content = node.children;
819
+ this.maybeAddSourceMap(node, element);
820
+ return element;
821
+ }
822
+ property(node) {
823
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.MemberElement();
856
824
 
857
- // provide annotations
858
- this.annotations.forEach(annotationElement => {
859
- element.push(annotationElement);
860
- });
861
- this.annotations = [];
862
- }
863
- };
864
- this.object = function object(node) {
865
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.ObjectElement();
866
- // @ts-ignore
867
- element._content = node.children;
868
- maybeAddSourceMap(node, element);
869
- return element;
870
- };
871
- this.property = function property(node) {
872
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_11__.MemberElement();
825
+ // @ts-ignore
826
+ element.content.key = node.key;
827
+ // @ts-ignore
828
+ element.content.value = node.value;
829
+ this.maybeAddSourceMap(node, element);
873
830
 
874
- // @ts-ignore
875
- element.content.key = node.key;
876
- // @ts-ignore
877
- element.content.value = node.value;
878
- maybeAddSourceMap(node, element);
879
-
880
- /**
881
- * Process possible errors here that may be present in pair node children as we're using direct field access.
882
- * There are usually 3 children here found: "key", ":", "value".
883
- */
884
- if (node.children.length > 3) {
885
- node.children.filter(child => child.type === 'error').forEach(errorNode => {
886
- this.error(errorNode, node, [], [node]);
887
- });
888
- }
889
- return element;
890
- };
891
- this.key = function key(node) {
892
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.StringElement(node.value);
893
- maybeAddSourceMap(node, element);
894
- return element;
895
- };
896
- this.array = function array(node) {
897
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.ArrayElement();
898
- // @ts-ignore
899
- element._content = node.children;
900
- maybeAddSourceMap(node, element);
901
- return element;
902
- };
903
- this.string = function string(node) {
904
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.StringElement(node.value);
905
- maybeAddSourceMap(node, element);
906
- return element;
907
- };
908
- this.number = function number(node) {
909
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.NumberElement(Number(node.value));
910
- maybeAddSourceMap(node, element);
911
- return element;
912
- };
831
+ /**
832
+ * Process possible errors here that may be present in pair node children as we're using direct field access.
833
+ * There are usually 3 children here found: "key", ":", "value".
834
+ */
835
+ if (node.children.length > 3) {
836
+ node.children
837
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
838
+ .filter(child => child.type === 'error')
839
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
840
+ .forEach(errorNode => {
841
+ this.error(errorNode, node, [], [node]);
842
+ });
843
+ }
844
+ return element;
845
+ }
846
+ key(node) {
847
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.StringElement(node.value);
848
+ this.maybeAddSourceMap(node, element);
849
+ return element;
850
+ }
851
+ array(node) {
852
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.ArrayElement();
853
+ // @ts-ignore
854
+ element._content = node.children;
855
+ this.maybeAddSourceMap(node, element);
856
+ return element;
857
+ }
858
+ string(node) {
859
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.StringElement(node.value);
860
+ this.maybeAddSourceMap(node, element);
861
+ return element;
862
+ }
863
+ number(node) {
864
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.NumberElement(Number(node.value));
865
+ this.maybeAddSourceMap(node, element);
866
+ return element;
867
+ }
913
868
 
914
- // eslint-disable-next-line @typescript-eslint/naming-convention
915
- this.null = function _null(node) {
916
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.NullElement();
917
- maybeAddSourceMap(node, element);
918
- return element;
919
- };
869
+ // eslint-disable-next-line @typescript-eslint/naming-convention
870
+ null(node) {
871
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.NullElement();
872
+ this.maybeAddSourceMap(node, element);
873
+ return element;
874
+ }
920
875
 
921
- // eslint-disable-next-line @typescript-eslint/naming-convention
922
- this.true = function _true(node) {
923
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.BooleanElement(true);
924
- maybeAddSourceMap(node, element);
925
- return element;
926
- };
876
+ // eslint-disable-next-line @typescript-eslint/naming-convention
877
+ true(node) {
878
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.BooleanElement(true);
879
+ this.maybeAddSourceMap(node, element);
880
+ return element;
881
+ }
927
882
 
928
- // eslint-disable-next-line @typescript-eslint/naming-convention
929
- this.false = function _false(node) {
930
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.BooleanElement(false);
931
- maybeAddSourceMap(node, element);
932
- return element;
933
- };
934
- this.literal = function literal(node) {
935
- if (node.isMissing) {
936
- const message = `(Missing ${node.value})`;
937
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.AnnotationElement(message);
938
- element.classes.push('warning');
939
- maybeAddSourceMap(node, element);
940
- this.annotations.push(element);
941
- }
942
- return null;
943
- };
944
- this.error = function error(node, key, parent, path) {
945
- const message = node.isUnexpected ? `(Unexpected ${node.value})` : `(Error ${node.value})`;
946
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.AnnotationElement(message);
947
- element.classes.push('error');
948
- maybeAddSourceMap(node, element);
949
- if (path.length === 0) {
950
- // no document to visit, only error is present in CST
951
- const parseResultElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.ParseResultElement();
952
- parseResultElement.push(element);
953
- return parseResultElement;
954
- }
883
+ // eslint-disable-next-line @typescript-eslint/naming-convention
884
+ false(node) {
885
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.BooleanElement(false);
886
+ this.maybeAddSourceMap(node, element);
887
+ return element;
888
+ }
889
+ literal(node) {
890
+ if (node.isMissing) {
891
+ const message = `(Missing ${node.value})`;
892
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.AnnotationElement(message);
893
+ element.classes.push('warning');
894
+ this.maybeAddSourceMap(node, element);
955
895
  this.annotations.push(element);
956
- return null;
957
- };
896
+ }
897
+ return null;
958
898
  }
959
- });
899
+ error(node, key, parent, path) {
900
+ const message = node.isUnexpected ? `(Unexpected ${node.value})` : `(Error ${node.value})`;
901
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.AnnotationElement(message);
902
+ element.classes.push('error');
903
+ this.maybeAddSourceMap(node, element);
904
+ if (path.length === 0) {
905
+ // no document to visit, only error is present in CST
906
+ const parseResultElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.ParseResultElement();
907
+ parseResultElement.push(element);
908
+ return parseResultElement;
909
+ }
910
+ this.annotations.push(element);
911
+ return null;
912
+ }
913
+ maybeAddSourceMap(node, element) {
914
+ if (!this.sourceMap) {
915
+ return;
916
+ }
917
+ const sourceMap = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.SourceMapElement();
918
+ // @ts-ignore
919
+ sourceMap.position = node.position;
920
+ // @ts-ignore
921
+ sourceMap.astNode = node;
922
+ element.meta.set('sourceMap', sourceMap);
923
+ }
924
+ }
960
925
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (JsonAstVisitor);
961
926
 
962
927
  /***/ }),