@swagger-api/apidom-parser-adapter-openapi-json-3-1 0.91.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.
@@ -34157,7 +34157,7 @@ const isNode = element => (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1
34157
34157
  const analyze = (cst, {
34158
34158
  sourceMap = false
34159
34159
  } = {}) => {
34160
- const visitor = (0,_visitors_CstVisitor_mjs__WEBPACK_IMPORTED_MODULE_3__["default"])();
34160
+ const visitor = new _visitors_CstVisitor_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]();
34161
34161
  const cursor = cst.walk();
34162
34162
  const iterator = new _TreeCursorIterator_mjs__WEBPACK_IMPORTED_MODULE_4__["default"](cursor);
34163
34163
  const [rootNode] = Array.from(iterator);
@@ -34183,175 +34183,161 @@ __webpack_require__.r(__webpack_exports__);
34183
34183
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
34184
34184
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
34185
34185
  /* harmony export */ });
34186
- /* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(86591);
34187
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(48355);
34188
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(36903);
34189
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(67952);
34186
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(48355);
34187
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(36903);
34188
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(67952);
34190
34189
  /* harmony import */ var _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1288);
34191
34190
 
34192
34191
 
34193
-
34194
34192
  /* eslint-disable no-underscore-dangle */
34195
- const CstVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
34196
- props: {
34197
- sourceMap: false,
34198
- annotations: []
34199
- },
34200
- init() {
34201
- /**
34202
- * Private API.
34203
- */
34193
+ class CstVisitor {
34194
+ static toPosition(node) {
34195
+ const start = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.ArrayElement([node.startPosition.row, node.startPosition.column, node.startIndex]);
34196
+ const end = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.ArrayElement([node.endPosition.row, node.endPosition.column, node.endIndex]);
34197
+ start.classes.push('position');
34198
+ end.classes.push('position');
34199
+ return [start, end];
34200
+ }
34201
+ sourceMap = false;
34202
+ ParseResultElement = {
34203
+ leave: element => {
34204
+ // mark first-non Annotation element as result
34205
+ // @ts-ignore
34206
+ const elements = element.findElements(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.isPrimitiveElement);
34207
+ if (elements.length > 0) {
34208
+ const resultElement = elements[0];
34209
+ resultElement.classes.push('result');
34210
+ }
34204
34211
 
34212
+ // provide annotations
34213
+ this.annotations.forEach(annotationElement => {
34214
+ element.push(annotationElement);
34215
+ });
34216
+ this.annotations = [];
34217
+ }
34218
+ };
34219
+ constructor() {
34205
34220
  this.annotations = [];
34206
- const toPosition = node => {
34207
- const start = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.ArrayElement([node.startPosition.row, node.startPosition.column, node.startIndex]);
34208
- const end = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.ArrayElement([node.endPosition.row, node.endPosition.column, node.endIndex]);
34209
- start.classes.push('position');
34210
- end.classes.push('position');
34211
- return [start, end];
34212
- };
34213
- const maybeAddSourceMap = (node, element) => {
34214
- if (!this.sourceMap) {
34215
- return;
34216
- }
34217
- const sourceMap = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.SourceMapElement();
34218
- const position = toPosition(node);
34219
- if (position !== null) {
34220
- const [start, end] = position;
34221
- sourceMap.push(start);
34222
- sourceMap.push(end);
34223
- }
34224
- // @ts-ignore
34225
- sourceMap.astNode = node;
34226
- element.meta.set('sourceMap', sourceMap);
34227
- };
34221
+ }
34222
+ enter(node) {
34223
+ // missing anonymous literals from CST transformed into AnnotationElements.
34224
+ if (node instanceof _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_2__["default"] && !node.isNamed && node.isMissing) {
34225
+ // collect annotations from missing literals
34226
+ const value = node.type || node.text;
34227
+ const message = `(Missing ${value})`;
34228
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.AnnotationElement(message);
34229
+ element.classes.push('warning');
34230
+ this.maybeAddSourceMap(node, element);
34231
+ this.annotations.push(element);
34232
+ }
34233
+ return null; // remove everything unrecognized
34234
+ }
34235
+ document(node) {
34236
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.ParseResultElement();
34237
+ // @ts-ignore
34238
+ element._content = node.children;
34239
+ this.maybeAddSourceMap(node, element);
34240
+ return element;
34241
+ }
34242
+ object(node) {
34243
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.ObjectElement();
34244
+ // @ts-ignore
34245
+ element._content = node.children;
34246
+ this.maybeAddSourceMap(node, element);
34247
+ return element;
34248
+ }
34249
+ array(node) {
34250
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.ArrayElement();
34251
+ // @ts-ignore
34252
+ element._content = node.children;
34253
+ this.maybeAddSourceMap(node, element);
34254
+ return element;
34255
+ }
34256
+ pair(node) {
34257
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.MemberElement();
34258
+ // @ts-ignore
34259
+ element.content.key = node.keyNode;
34260
+ // @ts-ignore
34261
+ element.content.value = node.valueNode;
34262
+ this.maybeAddSourceMap(node, element);
34228
34263
 
34229
34264
  /**
34230
- * Public API.
34265
+ * Process possible errors here that may be present in pair node children as we're using direct field access.
34266
+ * There are usually 3 children here found: "key", ":", "value".
34231
34267
  */
34268
+ if (node.children.length > 3) {
34269
+ node.children.filter(child => child.type === 'ERROR').forEach(errorNode => {
34270
+ this.ERROR(errorNode, node, [], [node]);
34271
+ });
34272
+ }
34273
+ return element;
34274
+ }
34275
+ string(node) {
34276
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.StringElement(JSON.parse(node.text));
34277
+ this.maybeAddSourceMap(node, element);
34278
+ return element;
34279
+ }
34280
+ number(node) {
34281
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.NumberElement(Number(node.text));
34282
+ this.maybeAddSourceMap(node, element);
34283
+ return element;
34284
+ }
34232
34285
 
34233
- this.enter = function enter(node) {
34234
- // missing anonymous literals from CST transformed into AnnotationElements.
34235
- if (node instanceof _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_2__["default"] && !node.isNamed && node.isMissing) {
34236
- // collect annotations from missing literals
34237
- const value = node.type || node.text;
34238
- const message = `(Missing ${value})`;
34239
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.AnnotationElement(message);
34240
- element.classes.push('warning');
34241
- maybeAddSourceMap(node, element);
34242
- this.annotations.push(element);
34243
- }
34244
- return null; // remove everything unrecognized
34245
- };
34246
- this.document = function document(node) {
34247
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.ParseResultElement();
34248
- // @ts-ignore
34249
- element._content = node.children;
34250
- maybeAddSourceMap(node, element);
34251
- return element;
34252
- };
34253
- this.ParseResultElement = {
34254
- leave(element) {
34255
- // mark first-non Annotation element as result
34256
- // @ts-ignore
34257
- const elements = element.findElements(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_3__.isPrimitiveElement);
34258
- if (elements.length > 0) {
34259
- const resultElement = elements[0];
34260
- resultElement.classes.push('result');
34261
- }
34262
-
34263
- // provide annotations
34264
- this.annotations.forEach(annotationElement => {
34265
- element.push(annotationElement);
34266
- });
34267
- this.annotations = [];
34268
- }
34269
- };
34270
- this.object = function object(node) {
34271
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.ObjectElement();
34272
- // @ts-ignore
34273
- element._content = node.children;
34274
- maybeAddSourceMap(node, element);
34275
- return element;
34276
- };
34277
- this.array = function array(node) {
34278
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.ArrayElement();
34279
- // @ts-ignore
34280
- element._content = node.children;
34281
- maybeAddSourceMap(node, element);
34282
- return element;
34283
- };
34284
- this.pair = function pair(node) {
34285
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_4__.MemberElement();
34286
- // @ts-ignore
34287
- element.content.key = node.keyNode;
34288
- // @ts-ignore
34289
- element.content.value = node.valueNode;
34290
- maybeAddSourceMap(node, element);
34291
-
34292
- /**
34293
- * Process possible errors here that may be present in pair node children as we're using direct field access.
34294
- * There are usually 3 children here found: "key", ":", "value".
34295
- */
34296
- if (node.children.length > 3) {
34297
- node.children.filter(child => child.type === 'ERROR').forEach(errorNode => {
34298
- this.ERROR(errorNode, node, [], [node]);
34299
- });
34300
- }
34301
- return element;
34302
- };
34303
- this.string = function string(node) {
34304
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.StringElement(JSON.parse(node.text));
34305
- maybeAddSourceMap(node, element);
34306
- return element;
34307
- };
34308
- this.number = function number(node) {
34309
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.NumberElement(Number(node.text));
34310
- maybeAddSourceMap(node, element);
34311
- return element;
34312
- };
34313
-
34314
- // eslint-disable-next-line @typescript-eslint/naming-convention
34315
- this.null = function _null(node) {
34316
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.NullElement();
34317
- maybeAddSourceMap(node, element);
34318
- return element;
34319
- };
34320
-
34321
- // eslint-disable-next-line @typescript-eslint/naming-convention
34322
- this.true = function _true(node) {
34323
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.BooleanElement(true);
34324
- maybeAddSourceMap(node, element);
34325
- return element;
34326
- };
34286
+ // eslint-disable-next-line @typescript-eslint/naming-convention
34287
+ null(node) {
34288
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.NullElement();
34289
+ this.maybeAddSourceMap(node, element);
34290
+ return element;
34291
+ }
34327
34292
 
34328
- // eslint-disable-next-line @typescript-eslint/naming-convention
34329
- this.false = function _false(node) {
34330
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.BooleanElement(false);
34331
- maybeAddSourceMap(node, element);
34332
- return element;
34333
- };
34334
- this.ERROR = function ERROR(node, key, parent, path) {
34335
- // collect errors as annotations
34336
- const isUnexpected = !node.hasError;
34337
- const value = node.text;
34338
- const message = isUnexpected ? `(Unexpected ${value})` : `(Error ${value})`;
34339
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.AnnotationElement(message);
34340
- element.classes.push('error');
34341
- maybeAddSourceMap(node, element);
34342
- if (path.length === 0) {
34343
- // no document to visit, only error is present in CST
34344
- const parseResultElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_1__.ParseResultElement();
34345
- parseResultElement.push(element);
34346
- return parseResultElement;
34347
- }
34293
+ // eslint-disable-next-line @typescript-eslint/naming-convention
34294
+ true(node) {
34295
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.BooleanElement(true);
34296
+ this.maybeAddSourceMap(node, element);
34297
+ return element;
34298
+ }
34348
34299
 
34349
- // we have CST node for document
34350
- this.annotations.push(element);
34351
- return null;
34352
- };
34300
+ // eslint-disable-next-line @typescript-eslint/naming-convention
34301
+ false(node) {
34302
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.BooleanElement(false);
34303
+ this.maybeAddSourceMap(node, element);
34304
+ return element;
34353
34305
  }
34354
- });
34306
+ ERROR(node, key, parent, path) {
34307
+ // collect errors as annotations
34308
+ const isUnexpected = !node.hasError;
34309
+ const value = node.text;
34310
+ const message = isUnexpected ? `(Unexpected ${value})` : `(Error ${value})`;
34311
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.AnnotationElement(message);
34312
+ element.classes.push('error');
34313
+ this.maybeAddSourceMap(node, element);
34314
+ if (path.length === 0) {
34315
+ // no document to visit, only error is present in CST
34316
+ const parseResultElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.ParseResultElement();
34317
+ parseResultElement.push(element);
34318
+ return parseResultElement;
34319
+ }
34320
+
34321
+ // we have CST node for document
34322
+ this.annotations.push(element);
34323
+ return null;
34324
+ }
34325
+ maybeAddSourceMap(node, element) {
34326
+ if (!this.sourceMap) {
34327
+ return;
34328
+ }
34329
+ const sourceMap = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_0__.SourceMapElement();
34330
+ const position = CstVisitor.toPosition(node);
34331
+ if (position !== null) {
34332
+ const [start, end] = position;
34333
+ sourceMap.push(start);
34334
+ sourceMap.push(end);
34335
+ }
34336
+ // @ts-ignore
34337
+ sourceMap.astNode = node;
34338
+ element.meta.set('sourceMap', sourceMap);
34339
+ }
34340
+ }
34355
34341
 
34356
34342
  /* eslint-enable no-underscore-dangle */
34357
34343
 
@@ -34396,8 +34382,8 @@ const analyze = (cst, {
34396
34382
  const cursor = cst.walk();
34397
34383
  const iterator = new _TreeCursorIterator_mjs__WEBPACK_IMPORTED_MODULE_0__["default"](cursor);
34398
34384
  const [rootNode] = Array.from(iterator);
34399
- const cstVisitor = (0,_visitors_CstVisitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])();
34400
- const astVisitor = (0,_visitors_JsonAstVisitor_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])();
34385
+ const cstVisitor = new _visitors_CstVisitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]();
34386
+ const astVisitor = new _visitors_JsonAstVisitor_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]();
34401
34387
  const jsonAst = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__.visit)(rootNode, cstVisitor, {
34402
34388
  // @ts-ignore
34403
34389
  keyMap: _visitors_CstVisitor_mjs__WEBPACK_IMPORTED_MODULE_1__.keyMap,
@@ -34428,24 +34414,22 @@ __webpack_require__.r(__webpack_exports__);
34428
34414
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
34429
34415
  /* harmony export */ keyMap: () => (/* binding */ keyMap)
34430
34416
  /* harmony export */ });
34431
- /* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(86591);
34432
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87127);
34433
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(78681);
34434
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28529);
34435
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(69348);
34436
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(30451);
34437
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(33278);
34438
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(57418);
34439
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(57087);
34440
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(40891);
34441
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(81846);
34442
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(29974);
34443
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(6227);
34444
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(57073);
34445
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(93094);
34446
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(5773);
34447
- /* harmony import */ var _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1288);
34448
-
34417
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(87127);
34418
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28529);
34419
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(69348);
34420
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78681);
34421
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(30451);
34422
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(33278);
34423
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(57418);
34424
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(57087);
34425
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(40891);
34426
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(81846);
34427
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(29974);
34428
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(6227);
34429
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(57073);
34430
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(93094);
34431
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(5773);
34432
+ /* harmony import */ var _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1288);
34449
34433
 
34450
34434
 
34451
34435
  const keyMap = {
@@ -34457,168 +34441,160 @@ const keyMap = {
34457
34441
  key: ['children'],
34458
34442
  error: ['children']
34459
34443
  };
34460
- const CstVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
34461
- init() {
34462
- /**
34463
- * Private API.
34464
- */
34465
34444
 
34466
- const toPosition = node => {
34467
- const start = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
34468
- row: node.startPosition.row,
34469
- column: node.startPosition.column,
34470
- char: node.startIndex
34471
- });
34472
- const end = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__.Point)({
34473
- row: node.endPosition.row,
34474
- column: node.endPosition.column,
34475
- char: node.endIndex
34476
- });
34477
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
34478
- start,
34479
- end
34480
- });
34481
- };
34482
-
34483
- /**
34484
- * Public API.
34485
- */
34445
+ /* eslint-disable class-methods-use-this */
34486
34446
 
34487
- this.enter = function enter(node) {
34488
- // anonymous literals from CST transformed into AST literal nodes
34489
- if (node instanceof _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_2__["default"] && !node.isNamed) {
34490
- const position = toPosition(node);
34491
- const value = node.type || node.text;
34492
- const {
34493
- isMissing
34494
- } = node;
34495
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__["default"])({
34496
- value,
34497
- position,
34498
- isMissing
34499
- });
34500
- }
34501
- return undefined;
34502
- };
34503
- this.document = {
34504
- enter(node) {
34505
- const position = toPosition(node);
34506
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
34507
- children: node.children,
34508
- position,
34509
- isMissing: node.isMissing
34510
- });
34511
- },
34512
- leave(document) {
34513
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
34514
- children: [document]
34515
- });
34516
- }
34517
- };
34518
- this.object = function object(node) {
34519
- const position = toPosition(node);
34520
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__["default"])({
34447
+ class CstVisitor {
34448
+ static toPosition(node) {
34449
+ const start = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__.Point)({
34450
+ row: node.startPosition.row,
34451
+ column: node.startPosition.column,
34452
+ char: node.startIndex
34453
+ });
34454
+ const end = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__.Point)({
34455
+ row: node.endPosition.row,
34456
+ column: node.endPosition.column,
34457
+ char: node.endIndex
34458
+ });
34459
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__["default"])({
34460
+ start,
34461
+ end
34462
+ });
34463
+ }
34464
+ document = {
34465
+ enter: node => {
34466
+ const position = CstVisitor.toPosition(node);
34467
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"])({
34521
34468
  children: node.children,
34522
34469
  position,
34523
34470
  isMissing: node.isMissing
34524
34471
  });
34525
- };
34526
- this.pair = function pair(node) {
34527
- const position = toPosition(node);
34528
- const children = node.children.slice(1);
34472
+ },
34473
+ leave: document => {
34474
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
34475
+ children: [document]
34476
+ });
34477
+ }
34478
+ };
34479
+ enter(node) {
34480
+ // anonymous literals from CST transformed into AST literal nodes
34481
+ if (node instanceof _TreeCursorSyntaxNode_mjs__WEBPACK_IMPORTED_MODULE_3__["default"] && !node.isNamed) {
34482
+ const position = CstVisitor.toPosition(node);
34483
+ const value = node.type || node.text;
34529
34484
  const {
34530
- keyNode
34485
+ isMissing
34531
34486
  } = node;
34532
- const key = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__["default"])({
34533
- children: (keyNode === null || keyNode === void 0 ? void 0 : keyNode.children) || [],
34534
- position: keyNode != null ? toPosition(keyNode) : null,
34535
- isMissing: keyNode != null ? keyNode.isMissing : false
34536
- });
34537
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__["default"])({
34538
- children: [key, ...children],
34539
- position,
34540
- isMissing: node.isMissing
34541
- });
34542
- };
34543
- this.array = function array(node) {
34544
- const position = toPosition(node);
34545
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__["default"])({
34546
- children: node.children,
34547
- position,
34548
- isMissing: node.isMissing
34549
- });
34550
- };
34551
- this.string = function string(node) {
34552
- const position = toPosition(node);
34553
- const content = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__["default"])({
34554
- value: JSON.parse(node.text)
34555
- });
34556
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
34557
- children: [content],
34558
- position,
34559
- isMissing: node.isMissing
34560
- });
34561
- };
34562
- this.number = function number(node) {
34563
- const position = toPosition(node);
34564
- const value = node.text;
34565
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__["default"])({
34487
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"])({
34566
34488
  value,
34567
34489
  position,
34568
- isMissing: node.isMissing
34490
+ isMissing
34569
34491
  });
34570
- };
34492
+ }
34493
+ return undefined;
34494
+ }
34495
+ object(node) {
34496
+ const position = CstVisitor.toPosition(node);
34497
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
34498
+ children: node.children,
34499
+ position,
34500
+ isMissing: node.isMissing
34501
+ });
34502
+ }
34503
+ pair(node) {
34504
+ const position = CstVisitor.toPosition(node);
34505
+ const children = node.children.slice(1);
34506
+ const {
34507
+ keyNode
34508
+ } = node;
34509
+ const key = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__["default"])({
34510
+ children: (keyNode === null || keyNode === void 0 ? void 0 : keyNode.children) || [],
34511
+ position: keyNode != null ? CstVisitor.toPosition(keyNode) : null,
34512
+ isMissing: keyNode != null ? keyNode.isMissing : false
34513
+ });
34514
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_7__["default"])({
34515
+ children: [key, ...children],
34516
+ position,
34517
+ isMissing: node.isMissing
34518
+ });
34519
+ }
34520
+ array(node) {
34521
+ const position = CstVisitor.toPosition(node);
34522
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__["default"])({
34523
+ children: node.children,
34524
+ position,
34525
+ isMissing: node.isMissing
34526
+ });
34527
+ }
34528
+ string(node) {
34529
+ const position = CstVisitor.toPosition(node);
34530
+ const content = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__["default"])({
34531
+ value: JSON.parse(node.text)
34532
+ });
34533
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_10__["default"])({
34534
+ children: [content],
34535
+ position,
34536
+ isMissing: node.isMissing
34537
+ });
34538
+ }
34539
+ number(node) {
34540
+ const position = CstVisitor.toPosition(node);
34541
+ const value = node.text;
34542
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_11__["default"])({
34543
+ value,
34544
+ position,
34545
+ isMissing: node.isMissing
34546
+ });
34547
+ }
34571
34548
 
34572
- // eslint-disable-next-line @typescript-eslint/naming-convention
34573
- this.null = function _null(node) {
34574
- const position = toPosition(node);
34575
- const value = node.text;
34576
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__["default"])({
34577
- value,
34578
- position,
34579
- isMissing: node.isMissing
34580
- });
34581
- };
34549
+ // eslint-disable-next-line @typescript-eslint/naming-convention
34550
+ null(node) {
34551
+ const position = CstVisitor.toPosition(node);
34552
+ const value = node.text;
34553
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_12__["default"])({
34554
+ value,
34555
+ position,
34556
+ isMissing: node.isMissing
34557
+ });
34558
+ }
34582
34559
 
34583
- // eslint-disable-next-line @typescript-eslint/naming-convention
34584
- this.true = function _true(node) {
34585
- const position = toPosition(node);
34586
- const value = node.text;
34587
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__["default"])({
34588
- value,
34589
- position,
34590
- isMissing: node.isMissing
34591
- });
34592
- };
34560
+ // eslint-disable-next-line @typescript-eslint/naming-convention
34561
+ true(node) {
34562
+ const position = CstVisitor.toPosition(node);
34563
+ const value = node.text;
34564
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_13__["default"])({
34565
+ value,
34566
+ position,
34567
+ isMissing: node.isMissing
34568
+ });
34569
+ }
34593
34570
 
34594
- // eslint-disable-next-line @typescript-eslint/naming-convention
34595
- this.false = function _false(node) {
34596
- const position = toPosition(node);
34597
- const value = node.text;
34598
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__["default"])({
34599
- value,
34600
- position,
34601
- isMissing: node.isMissing
34602
- });
34603
- };
34604
- this.ERROR = function ERROR(node, key, parent, path) {
34605
- const position = toPosition(node);
34606
- const errorNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_16__["default"])({
34607
- children: node.children,
34608
- position,
34609
- isUnexpected: !node.hasError,
34610
- isMissing: node.isMissing,
34611
- value: node.text
34571
+ // eslint-disable-next-line @typescript-eslint/naming-convention
34572
+ false(node) {
34573
+ const position = CstVisitor.toPosition(node);
34574
+ const value = node.text;
34575
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_14__["default"])({
34576
+ value,
34577
+ position,
34578
+ isMissing: node.isMissing
34579
+ });
34580
+ }
34581
+ ERROR(node, key, parent, path) {
34582
+ const position = CstVisitor.toPosition(node);
34583
+ const errorNode = (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_15__["default"])({
34584
+ children: node.children,
34585
+ position,
34586
+ isUnexpected: !node.hasError,
34587
+ isMissing: node.isMissing,
34588
+ value: node.text
34589
+ });
34590
+ if (path.length === 0) {
34591
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__["default"])({
34592
+ children: [errorNode]
34612
34593
  });
34613
- if (path.length === 0) {
34614
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"])({
34615
- children: [errorNode]
34616
- });
34617
- }
34618
- return errorNode;
34619
- };
34594
+ }
34595
+ return errorNode;
34620
34596
  }
34621
- });
34597
+ }
34622
34598
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CstVisitor);
34623
34599
 
34624
34600
  /***/ }),
@@ -34634,22 +34610,22 @@ __webpack_require__.r(__webpack_exports__);
34634
34610
  /* harmony export */ isNode: () => (/* binding */ isNode),
34635
34611
  /* harmony export */ keyMap: () => (/* binding */ keyMap)
34636
34612
  /* harmony export */ });
34637
- /* harmony import */ var stampit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(86591);
34638
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(69348);
34639
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28529);
34640
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(30451);
34641
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(57418);
34642
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(57087);
34643
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5773);
34644
- /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(51394);
34645
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(50821);
34646
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(36903);
34647
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(48355);
34648
- /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(67952);
34649
-
34613
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69348);
34614
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28529);
34615
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30451);
34616
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(57418);
34617
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(57087);
34618
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5773);
34619
+ /* harmony import */ var _swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(51394);
34620
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(50821);
34621
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(36903);
34622
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(48355);
34623
+ /* harmony import */ var _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(67952);
34650
34624
 
34651
34625
 
34652
34626
  const keyMap = {
34627
+ // @ts-ignore
34628
+ [_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_0__["default"].type]: ['children'],
34653
34629
  // @ts-ignore
34654
34630
  [_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_1__["default"].type]: ['children'],
34655
34631
  // @ts-ignore
@@ -34660,169 +34636,161 @@ const keyMap = {
34660
34636
  [_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_4__["default"].type]: ['children'],
34661
34637
  // @ts-ignore
34662
34638
  [_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_5__["default"].type]: ['children'],
34663
- // @ts-ignore
34664
- [_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_6__["default"].type]: ['children'],
34665
- ..._swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.keyMapDefault
34639
+ ..._swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.keyMapDefault
34666
34640
  };
34667
34641
  const getNodeType = node => {
34668
- if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_8__.isParseResultElement)(node)) {
34642
+ if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.isParseResultElement)(node)) {
34669
34643
  return 'ParseResultElement';
34670
34644
  }
34671
- if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_8__.isElement)(node)) {
34672
- return (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.getNodeType)(node);
34645
+ if ((0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.isElement)(node)) {
34646
+ return (0,_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_6__.getNodeType)(node);
34673
34647
  }
34674
- return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_9__.getNodeType)(node);
34648
+ return (0,_swagger_api_apidom_ast__WEBPACK_IMPORTED_MODULE_8__.getNodeType)(node);
34675
34649
  };
34676
- 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);
34650
+ 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);
34677
34651
 
34678
34652
  /* eslint-disable no-underscore-dangle */
34679
34653
 
34680
- const JsonAstVisitor = stampit__WEBPACK_IMPORTED_MODULE_0__({
34681
- props: {
34682
- sourceMap: false,
34683
- annotations: []
34684
- },
34685
- init() {
34686
- /**
34687
- * Private API.
34688
- */
34689
-
34690
- this.annotation = [];
34691
- const maybeAddSourceMap = (node, element) => {
34692
- if (!this.sourceMap) {
34693
- return;
34694
- }
34695
- const sourceMap = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.SourceMapElement();
34654
+ class JsonAstVisitor {
34655
+ sourceMap = false;
34656
+ ParseResultElement = {
34657
+ leave: element => {
34658
+ // mark first-non Annotation element as result
34696
34659
  // @ts-ignore
34697
- sourceMap.position = node.position;
34698
- // @ts-ignore
34699
- sourceMap.astNode = node;
34700
- element.meta.set('sourceMap', sourceMap);
34701
- };
34702
-
34703
- /**
34704
- * Public API.
34705
- */
34660
+ const elements = element.findElements(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_7__.isPrimitiveElement);
34661
+ if (elements.length > 0) {
34662
+ const resultElement = elements[0];
34663
+ resultElement.classes.push('result');
34664
+ }
34706
34665
 
34707
- this.document = function document(node) {
34708
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.ParseResultElement();
34709
- // @ts-ignore
34710
- element._content = node.children;
34711
- return element;
34712
- };
34713
- this.ParseResultElement = {
34714
- leave(element) {
34715
- // mark first-non Annotation element as result
34716
- // @ts-ignore
34717
- const elements = element.findElements(_swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_8__.isPrimitiveElement);
34718
- if (elements.length > 0) {
34719
- const resultElement = elements[0];
34720
- resultElement.classes.push('result');
34721
- }
34666
+ // provide annotations
34667
+ this.annotations.forEach(annotationElement => {
34668
+ element.push(annotationElement);
34669
+ });
34670
+ this.annotations = [];
34671
+ }
34672
+ };
34673
+ constructor() {
34674
+ this.annotations = [];
34675
+ }
34722
34676
 
34723
- // provide annotations
34724
- this.annotations.forEach(annotationElement => {
34725
- element.push(annotationElement);
34726
- });
34727
- this.annotations = [];
34728
- }
34729
- };
34730
- this.object = function object(node) {
34731
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.ObjectElement();
34732
- // @ts-ignore
34733
- element._content = node.children;
34734
- maybeAddSourceMap(node, element);
34735
- return element;
34736
- };
34737
- this.property = function property(node) {
34738
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_11__.MemberElement();
34677
+ // eslint-disable-next-line class-methods-use-this
34678
+ document(node) {
34679
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.ParseResultElement();
34680
+ // @ts-ignore
34681
+ element._content = node.children;
34682
+ return element;
34683
+ }
34684
+ object(node) {
34685
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.ObjectElement();
34686
+ // @ts-ignore
34687
+ element._content = node.children;
34688
+ this.maybeAddSourceMap(node, element);
34689
+ return element;
34690
+ }
34691
+ property(node) {
34692
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.MemberElement();
34739
34693
 
34740
- // @ts-ignore
34741
- element.content.key = node.key;
34742
- // @ts-ignore
34743
- element.content.value = node.value;
34744
- maybeAddSourceMap(node, element);
34694
+ // @ts-ignore
34695
+ element.content.key = node.key;
34696
+ // @ts-ignore
34697
+ element.content.value = node.value;
34698
+ this.maybeAddSourceMap(node, element);
34745
34699
 
34746
- /**
34747
- * Process possible errors here that may be present in pair node children as we're using direct field access.
34748
- * There are usually 3 children here found: "key", ":", "value".
34749
- */
34750
- if (node.children.length > 3) {
34751
- node.children.filter(child => child.type === 'error').forEach(errorNode => {
34752
- this.error(errorNode, node, [], [node]);
34753
- });
34754
- }
34755
- return element;
34756
- };
34757
- this.key = function key(node) {
34758
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.StringElement(node.value);
34759
- maybeAddSourceMap(node, element);
34760
- return element;
34761
- };
34762
- this.array = function array(node) {
34763
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.ArrayElement();
34764
- // @ts-ignore
34765
- element._content = node.children;
34766
- maybeAddSourceMap(node, element);
34767
- return element;
34768
- };
34769
- this.string = function string(node) {
34770
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.StringElement(node.value);
34771
- maybeAddSourceMap(node, element);
34772
- return element;
34773
- };
34774
- this.number = function number(node) {
34775
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.NumberElement(Number(node.value));
34776
- maybeAddSourceMap(node, element);
34777
- return element;
34778
- };
34700
+ /**
34701
+ * Process possible errors here that may be present in pair node children as we're using direct field access.
34702
+ * There are usually 3 children here found: "key", ":", "value".
34703
+ */
34704
+ if (node.children.length > 3) {
34705
+ node.children
34706
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34707
+ .filter(child => child.type === 'error')
34708
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34709
+ .forEach(errorNode => {
34710
+ this.error(errorNode, node, [], [node]);
34711
+ });
34712
+ }
34713
+ return element;
34714
+ }
34715
+ key(node) {
34716
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.StringElement(node.value);
34717
+ this.maybeAddSourceMap(node, element);
34718
+ return element;
34719
+ }
34720
+ array(node) {
34721
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.ArrayElement();
34722
+ // @ts-ignore
34723
+ element._content = node.children;
34724
+ this.maybeAddSourceMap(node, element);
34725
+ return element;
34726
+ }
34727
+ string(node) {
34728
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.StringElement(node.value);
34729
+ this.maybeAddSourceMap(node, element);
34730
+ return element;
34731
+ }
34732
+ number(node) {
34733
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.NumberElement(Number(node.value));
34734
+ this.maybeAddSourceMap(node, element);
34735
+ return element;
34736
+ }
34779
34737
 
34780
- // eslint-disable-next-line @typescript-eslint/naming-convention
34781
- this.null = function _null(node) {
34782
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.NullElement();
34783
- maybeAddSourceMap(node, element);
34784
- return element;
34785
- };
34738
+ // eslint-disable-next-line @typescript-eslint/naming-convention
34739
+ null(node) {
34740
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.NullElement();
34741
+ this.maybeAddSourceMap(node, element);
34742
+ return element;
34743
+ }
34786
34744
 
34787
- // eslint-disable-next-line @typescript-eslint/naming-convention
34788
- this.true = function _true(node) {
34789
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.BooleanElement(true);
34790
- maybeAddSourceMap(node, element);
34791
- return element;
34792
- };
34745
+ // eslint-disable-next-line @typescript-eslint/naming-convention
34746
+ true(node) {
34747
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.BooleanElement(true);
34748
+ this.maybeAddSourceMap(node, element);
34749
+ return element;
34750
+ }
34793
34751
 
34794
- // eslint-disable-next-line @typescript-eslint/naming-convention
34795
- this.false = function _false(node) {
34796
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.BooleanElement(false);
34797
- maybeAddSourceMap(node, element);
34798
- return element;
34799
- };
34800
- this.literal = function literal(node) {
34801
- if (node.isMissing) {
34802
- const message = `(Missing ${node.value})`;
34803
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.AnnotationElement(message);
34804
- element.classes.push('warning');
34805
- maybeAddSourceMap(node, element);
34806
- this.annotations.push(element);
34807
- }
34808
- return null;
34809
- };
34810
- this.error = function error(node, key, parent, path) {
34811
- const message = node.isUnexpected ? `(Unexpected ${node.value})` : `(Error ${node.value})`;
34812
- const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.AnnotationElement(message);
34813
- element.classes.push('error');
34814
- maybeAddSourceMap(node, element);
34815
- if (path.length === 0) {
34816
- // no document to visit, only error is present in CST
34817
- const parseResultElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_10__.ParseResultElement();
34818
- parseResultElement.push(element);
34819
- return parseResultElement;
34820
- }
34752
+ // eslint-disable-next-line @typescript-eslint/naming-convention
34753
+ false(node) {
34754
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.BooleanElement(false);
34755
+ this.maybeAddSourceMap(node, element);
34756
+ return element;
34757
+ }
34758
+ literal(node) {
34759
+ if (node.isMissing) {
34760
+ const message = `(Missing ${node.value})`;
34761
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.AnnotationElement(message);
34762
+ element.classes.push('warning');
34763
+ this.maybeAddSourceMap(node, element);
34821
34764
  this.annotations.push(element);
34822
- return null;
34823
- };
34765
+ }
34766
+ return null;
34824
34767
  }
34825
- });
34768
+ error(node, key, parent, path) {
34769
+ const message = node.isUnexpected ? `(Unexpected ${node.value})` : `(Error ${node.value})`;
34770
+ const element = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.AnnotationElement(message);
34771
+ element.classes.push('error');
34772
+ this.maybeAddSourceMap(node, element);
34773
+ if (path.length === 0) {
34774
+ // no document to visit, only error is present in CST
34775
+ const parseResultElement = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.ParseResultElement();
34776
+ parseResultElement.push(element);
34777
+ return parseResultElement;
34778
+ }
34779
+ this.annotations.push(element);
34780
+ return null;
34781
+ }
34782
+ maybeAddSourceMap(node, element) {
34783
+ if (!this.sourceMap) {
34784
+ return;
34785
+ }
34786
+ const sourceMap = new _swagger_api_apidom_core__WEBPACK_IMPORTED_MODULE_9__.SourceMapElement();
34787
+ // @ts-ignore
34788
+ sourceMap.position = node.position;
34789
+ // @ts-ignore
34790
+ sourceMap.astNode = node;
34791
+ element.meta.set('sourceMap', sourceMap);
34792
+ }
34793
+ }
34826
34794
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (JsonAstVisitor);
34827
34795
 
34828
34796
  /***/ })