Skip to content

Commit ddee593

Browse files
committed
fix: update version, spec-version, api-version meta
1 parent 81440fe commit ddee593

File tree

14 files changed

+242
-32
lines changed

14 files changed

+242
-32
lines changed

packages/apidom-ls/src/services/semantic-tokens/semantic-tokens-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ export class DefaultSemanticTokensService implements SemanticTokensService {
3737
private static allClasses(): string[] {
3838
return [
3939
'parameter',
40+
'api-version',
41+
'spec-version',
4042
'specVersion',
41-
'version',
4243
'info',
4344
'operation',
4445
'pathItem',
@@ -62,7 +63,6 @@ export class DefaultSemanticTokensService implements SemanticTokensService {
6263
'server',
6364
'servers',
6465
'title',
65-
'asyncApiVersion',
6666
'channelItem',
6767
'channels',
6868
'reference-element',

packages/apidom-ls/src/services/symbols/symbols-service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ export class DefaultSymbolsService implements SymbolsService {
4242
// TODO remove
4343
const allClasses = [
4444
'info',
45-
'version',
45+
'api-version',
46+
'spec-version',
4647
'specVersion',
4748
'license',
4849
'operation',

packages/apidom-ls/test/asyncapi-json.ts

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,20 +279,55 @@ describe('apidom-ls-async', function () {
279279
const result = await languageService.doFindDocumentSymbols(doc);
280280

281281
const expected: SymbolInformation[] = [
282+
{
283+
name: 'spec-version',
284+
kind: 7,
285+
location: {
286+
uri: '',
287+
range: {
288+
start: {
289+
line: 2,
290+
character: 2,
291+
},
292+
end: {
293+
line: 2,
294+
character: 12,
295+
},
296+
},
297+
},
298+
},
282299
{
283300
name: 'info',
284301
kind: 7,
285302
location: {
286303
uri: '',
287-
range: { start: { line: 4, character: 2 }, end: { line: 4, character: 8 } },
304+
range: {
305+
start: {
306+
line: 4,
307+
character: 2,
308+
},
309+
end: {
310+
line: 4,
311+
character: 8,
312+
},
313+
},
288314
},
289315
},
290316
{
291-
name: 'version',
317+
name: 'api-version',
292318
kind: 7,
293319
location: {
294320
uri: '',
295-
range: { start: { line: 8, character: 4 }, end: { line: 8, character: 13 } },
321+
range: {
322+
start: {
323+
line: 8,
324+
character: 4,
325+
},
326+
end: {
327+
line: 8,
328+
character: 13,
329+
},
330+
},
296331
},
297332
},
298333
];
@@ -331,12 +366,11 @@ describe('apidom-ls-async', function () {
331366
);
332367
}
333368
}
334-
335369
assert.deepEqual(tokens, {
336370
data: [
337-
1, 2, 10, 26, 0, 1, 2, 6, 3, 0, 1, 4, 9, 2, 0, 2, 2, 9, 24, 0, 1, 4, 6, 23, 0, 0, 9, 5, 10,
338-
0, 2, 2, 10, 28, 0, 1, 4, 3, 27, 0, 1, 6, 11, 4, 16, 1, 8, 9, 35, 64, 0, 11, 19, 32, 64, 1,
339-
8, 9, 35, 64, 1, 10, 9, 22, 0, 1, 12, 6, 35, 64, 0, 8, 8, 32, 64,
371+
1, 2, 10, 2, 0, 1, 2, 6, 4, 0, 1, 4, 9, 1, 0, 2, 2, 9, 25, 0, 1, 4, 6, 24, 0, 0, 9, 5, 11,
372+
0, 2, 2, 10, 28, 0, 1, 4, 3, 27, 0, 1, 6, 11, 5, 16, 1, 8, 9, 35, 64, 0, 11, 19, 32, 64, 1,
373+
8, 9, 35, 64, 1, 10, 9, 23, 0, 1, 12, 6, 35, 64, 0, 8, 8, 32, 64,
340374
],
341375
});
342376
});

packages/apidom-ls/test/asyncapi-yaml.ts

Lines changed: 75 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,20 +249,89 @@ describe('apidom-ls-async-yaml', function () {
249249

250250
// console.log(JSON.stringify(result));
251251
const expected: SymbolInformation[] = [
252+
{
253+
name: 'spec-version',
254+
kind: 7,
255+
location: {
256+
uri: '',
257+
range: {
258+
start: {
259+
line: 0,
260+
character: 0,
261+
},
262+
end: {
263+
line: 0,
264+
character: 8,
265+
},
266+
},
267+
},
268+
},
252269
{
253270
name: 'info',
254271
kind: 7,
255272
location: {
256273
uri: '',
257-
range: { start: { line: 1, character: 0 }, end: { line: 1, character: 4 } },
274+
range: {
275+
start: {
276+
line: 1,
277+
character: 0,
278+
},
279+
end: {
280+
line: 1,
281+
character: 4,
282+
},
283+
},
258284
},
259285
},
260286
{
261-
name: 'version',
287+
name: 'api-version',
262288
kind: 7,
263289
location: {
264290
uri: '',
265-
range: { start: { line: 5, character: 2 }, end: { line: 5, character: 9 } },
291+
range: {
292+
start: {
293+
line: 5,
294+
character: 2,
295+
},
296+
end: {
297+
line: 5,
298+
character: 9,
299+
},
300+
},
301+
},
302+
},
303+
{
304+
name: 'components',
305+
kind: 7,
306+
location: {
307+
uri: '',
308+
range: {
309+
start: {
310+
line: 6,
311+
character: 0,
312+
},
313+
end: {
314+
line: 6,
315+
character: 10,
316+
},
317+
},
318+
},
319+
},
320+
{
321+
name: 'components-schemas',
322+
kind: 7,
323+
location: {
324+
uri: '',
325+
range: {
326+
start: {
327+
line: 7,
328+
character: 2,
329+
},
330+
end: {
331+
line: 7,
332+
character: 9,
333+
},
334+
},
266335
},
267336
},
268337
];
@@ -303,9 +372,9 @@ describe('apidom-ls-async-yaml', function () {
303372
}
304373
assert.deepEqual(tokens, {
305374
data: [
306-
0, 0, 8, 26, 0, 1, 0, 4, 3, 0, 1, 2, 7, 2, 0, 1, 0, 7, 24, 0, 1, 2, 4, 23, 0, 1, 4, 3, 10,
307-
0, 1, 0, 8, 28, 0, 1, 2, 3, 27, 0, 1, 4, 9, 4, 16, 1, 6, 7, 35, 64, 0, 9, 17, 32, 64, 1, 6,
308-
7, 35, 64, 1, 8, 7, 22, 0, 1, 10, 4, 35, 64, 0, 6, 6, 32, 64,
375+
0, 0, 8, 2, 0, 1, 0, 4, 4, 0, 1, 2, 7, 1, 0, 1, 0, 7, 25, 0, 1, 2, 4, 24, 0, 1, 4, 3, 11, 0,
376+
1, 0, 8, 28, 0, 1, 2, 3, 27, 0, 1, 4, 9, 5, 16, 1, 6, 7, 35, 64, 0, 9, 17, 32, 64, 1, 6, 7,
377+
35, 64, 1, 8, 7, 23, 0, 1, 10, 4, 35, 64, 0, 6, 6, 32, 64,
309378
],
310379
});
311380
});

packages/apidom-ls/test/openapi-json.ts

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -683,20 +683,55 @@ describe('apidom-ls', function () {
683683

684684
// console.log(JSON.stringify(result));
685685
const expected: SymbolInformation[] = [
686+
{
687+
name: 'spec-version',
688+
kind: 7,
689+
location: {
690+
uri: '',
691+
range: {
692+
start: {
693+
line: 2,
694+
character: 2,
695+
},
696+
end: {
697+
line: 2,
698+
character: 11,
699+
},
700+
},
701+
},
702+
},
686703
{
687704
name: 'info',
688705
kind: 7,
689706
location: {
690707
uri: '',
691-
range: { start: { line: 4, character: 2 }, end: { line: 4, character: 8 } },
708+
range: {
709+
start: {
710+
line: 4,
711+
character: 2,
712+
},
713+
end: {
714+
line: 4,
715+
character: 8,
716+
},
717+
},
692718
},
693719
},
694720
{
695-
name: 'version',
721+
name: 'api-version',
696722
kind: 7,
697723
location: {
698724
uri: '',
699-
range: { start: { line: 8, character: 4 }, end: { line: 8, character: 13 } },
725+
range: {
726+
start: {
727+
line: 8,
728+
character: 4,
729+
},
730+
end: {
731+
line: 8,
732+
character: 13,
733+
},
734+
},
700735
},
701736
},
702737
];
@@ -737,10 +772,10 @@ describe('apidom-ls', function () {
737772
}
738773
assert.deepEqual(tokens, {
739774
data: [
740-
1, 2, 9, 15, 0, 1, 2, 6, 3, 0, 1, 4, 9, 2, 0, 2, 2, 9, 24, 0, 1, 5, 5, 10, 0, 2, 2, 7, 17,
741-
0, 1, 4, 4, 5, 0, 1, 6, 5, 4, 16, 1, 8, 13, 35, 64, 0, 15, 6, 32, 64, 2, 6, 6, 4, 32, 1, 8,
742-
13, 35, 64, 0, 15, 7, 32, 64, 3, 4, 4, 5, 0, 1, 6, 6, 4, 32, 1, 8, 13, 35, 64, 0, 15, 7, 32,
743-
64, 3, 4, 4, 5, 0, 1, 6, 5, 4, 16, 1, 8, 13, 35, 64, 0, 15, 6, 32, 64,
775+
1, 2, 9, 16, 0, 0, 0, 9, 2, 0, 1, 2, 6, 4, 0, 1, 4, 9, 1, 0, 2, 2, 9, 25, 0, 1, 5, 5, 11, 0,
776+
2, 2, 7, 18, 0, 1, 4, 4, 6, 0, 1, 6, 5, 5, 16, 1, 8, 13, 35, 64, 0, 15, 6, 32, 64, 2, 6, 6,
777+
5, 32, 1, 8, 13, 35, 64, 0, 15, 7, 32, 64, 3, 4, 4, 6, 0, 1, 6, 6, 5, 32, 1, 8, 13, 35, 64,
778+
0, 15, 7, 32, 64, 3, 4, 4, 6, 0, 1, 6, 5, 5, 16, 1, 8, 13, 35, 64, 0, 15, 6, 32, 64,
744779
],
745780
});
746781
});

packages/apidom-ls/test/openapi-yaml.ts

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -483,20 +483,55 @@ describe('apidom-ls-yaml', function () {
483483
const result = await languageService.doFindDocumentSymbols(doc);
484484

485485
const expected: SymbolInformation[] = [
486+
{
487+
name: 'spec-version',
488+
kind: 7,
489+
location: {
490+
uri: '',
491+
range: {
492+
start: {
493+
line: 0,
494+
character: 0,
495+
},
496+
end: {
497+
line: 0,
498+
character: 7,
499+
},
500+
},
501+
},
502+
},
486503
{
487504
name: 'info',
488505
kind: 7,
489506
location: {
490507
uri: '',
491-
range: { start: { line: 1, character: 0 }, end: { line: 1, character: 4 } },
508+
range: {
509+
start: {
510+
line: 1,
511+
character: 0,
512+
},
513+
end: {
514+
line: 1,
515+
character: 4,
516+
},
517+
},
492518
},
493519
},
494520
{
495-
name: 'version',
521+
name: 'api-version',
496522
kind: 7,
497523
location: {
498524
uri: '',
499-
range: { start: { line: 5, character: 2 }, end: { line: 5, character: 9 } },
525+
range: {
526+
start: {
527+
line: 5,
528+
character: 2,
529+
},
530+
end: {
531+
line: 5,
532+
character: 9,
533+
},
534+
},
500535
},
501536
},
502537
];
@@ -537,10 +572,10 @@ describe('apidom-ls-yaml', function () {
537572
}
538573
assert.deepEqual(tokens, {
539574
data: [
540-
0, 0, 7, 15, 0, 1, 0, 4, 3, 0, 1, 2, 7, 2, 0, 1, 0, 7, 24, 0, 1, 4, 3, 10, 0, 1, 0, 5, 17,
541-
0, 1, 2, 2, 5, 0, 1, 4, 3, 4, 16, 1, 6, 11, 35, 64, 0, 13, 4, 32, 64, 1, 4, 4, 4, 32, 1, 6,
542-
11, 35, 64, 0, 13, 5, 32, 64, 1, 2, 2, 5, 0, 1, 4, 4, 4, 32, 1, 6, 11, 35, 64, 0, 13, 5, 32,
543-
64, 1, 2, 2, 5, 0, 1, 4, 3, 4, 16, 1, 6, 11, 35, 64, 0, 13, 4, 32, 64,
575+
0, 0, 7, 16, 0, 0, 0, 7, 2, 0, 1, 0, 4, 4, 0, 1, 2, 7, 1, 0, 1, 0, 7, 25, 0, 1, 4, 3, 11, 0,
576+
1, 0, 5, 18, 0, 1, 2, 2, 6, 0, 1, 4, 3, 5, 16, 1, 6, 11, 35, 64, 0, 13, 4, 32, 64, 1, 4, 4,
577+
5, 32, 1, 6, 11, 35, 64, 0, 13, 5, 32, 64, 1, 2, 2, 6, 0, 1, 4, 4, 5, 32, 1, 6, 11, 35, 64,
578+
0, 13, 5, 32, 64, 1, 2, 2, 6, 0, 1, 4, 3, 5, 16, 1, 6, 11, 35, 64, 0, 13, 4, 32, 64,
544579
],
545580
});
546581
});

packages/apidom-ns-asyncapi-2/src/elements/AsyncApiVersion.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ class AsyncApiVersion extends StringElement {
55
constructor(content?: string, meta?: Meta, attributes?: Attributes) {
66
super(content, meta, attributes);
77
this.element = 'asyncApiVersion';
8+
this.classes.push('spec-version');
9+
this.classes.push('version');
810
}
911
}
1012

packages/apidom-ns-asyncapi-2/src/refractor/visitors/async-api-2/AsyncApiVersionVisitor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const AsyncApiVersionVisitor = stampit(SpecificationVisitor, FallbackVisitor, {
1313
this.copyMetaAndAttributes(stringElement, asyncApiVersionElement);
1414

1515
this.element = asyncApiVersionElement;
16-
this.element.classes.push('spec-version');
1716
return BREAK;
1817
},
1918
},

packages/apidom-ns-asyncapi-2/src/refractor/visitors/async-api-2/info/VersionVisitor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const VersionVisitor = stampit(FallbackVisitor, {
99
this.element = new StringElement(stringElement.toValue());
1010

1111
this.copyMetaAndAttributes(stringElement, this.element);
12+
this.element.classes.push('api-version');
1213
this.element.classes.push('version');
1314

1415
return BREAK;

0 commit comments

Comments
 (0)