Skip to content

Commit 384e358

Browse files
authored
feat(ls): add AsyncAPI 3 completion for compatible keywords (#5101)
1 parent d20f206 commit 384e358

File tree

34 files changed

+2333
-115
lines changed

34 files changed

+2333
-115
lines changed

packages/apidom-ls/src/config/asyncapi/asyncapi2/completion.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
CompletionFormat,
44
CompletionType,
55
} from '../../../apidom-language-types.ts';
6+
import { AsyncAPI2 } from '../target-specs.ts';
67

78
const completion: ApidomCompletionItem[] = [
89
{
@@ -17,6 +18,7 @@ const completion: ApidomCompletionItem[] = [
1718
value:
1819
'[AsyncAPI Version String](https://www.asyncapi.com/docs/reference/specification/v2.6.0#A2SVersionString)\n\\\n\\\n**REQUIRED.** Specifies the AsyncAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (1.0.*). Patch versions will correspond to patches of this document.',
1920
},
21+
targetSpecs: AsyncAPI2,
2022
},
2123
{
2224
label: 'id',
@@ -30,6 +32,7 @@ const completion: ApidomCompletionItem[] = [
3032
value:
3133
'[Identifier](https://www.asyncapi.com/docs/reference/specification/v2.6.0#A2SIdString)\n\\\n\\\nIdentifier of the [application](https://www.asyncapi.com/docs/reference/specification/v2.6.0#definitionsApplication) the AsyncAPI document is defining. This field represents a unique universal identifier of the [application](#definitionsApplication) the AsyncAPI document is defining. It must conform to the URI format, according to [RFC3986](https://tools.ietf.org/html/rfc3986).\n\\\n\\\nIt is RECOMMENDED to use a [URN](https://tools.ietf.org/html/rfc8141) to globally and uniquely identify the application during long periods of time, even after it becomes unavailable or ceases to exist.',
3234
},
35+
targetSpecs: AsyncAPI2,
3336
},
3437
{
3538
label: 'info',
@@ -43,6 +46,7 @@ const completion: ApidomCompletionItem[] = [
4346
value:
4447
'[Info Object](https://www.asyncapi.com/docs/reference/specification/v2.6.0#infoObject)\n\\\n\\\n**REQUIRED.** Provides metadata about the API. The metadata can be used by the clients if needed.',
4548
},
49+
targetSpecs: AsyncAPI2,
4650
},
4751
{
4852
label: 'servers',
@@ -56,6 +60,7 @@ const completion: ApidomCompletionItem[] = [
5660
value:
5761
'[Servers Object](https://www.asyncapi.com/docs/reference/specification/v2.6.0#serversObject)\n\\\n\\\nProvides connection details of servers. The Servers Object is a map of [Server Objects](https://www.asyncapi.com/docs/reference/specification/v2.6.0#serverObject).',
5862
},
63+
targetSpecs: AsyncAPI2,
5964
},
6065
{
6166
label: 'defaultContentType',
@@ -69,6 +74,7 @@ const completion: ApidomCompletionItem[] = [
6974
value:
7075
"[Default Content Type](https://www.asyncapi.com/docs/reference/specification/v2.6.0#defaultContentTypeString)\n\\\n\\\nDefault content type to use when encoding/decoding a message's payload.\n\\\n\\\nIt's a string representing the default content type to use when encoding/decoding a message's payload. The value MUST be a specific media type (e.g. `application/json`). This value MUST be used by schema parsers when the [contentType](https://www.asyncapi.com/docs/reference/specification/v2.6.0#messageObjectContentType) property is omitted.\n\nIn case a message can't be encoded/decoded using this value, schema parsers MUST use their default content type.",
7176
},
77+
targetSpecs: AsyncAPI2,
7278
},
7379
{
7480
label: 'channels',
@@ -82,6 +88,7 @@ const completion: ApidomCompletionItem[] = [
8288
value:
8389
'[Channels Object](https://www.asyncapi.com/docs/reference/specification/v2.6.0#channelsObject)\n\\\n\\\n**REQUIRED**. The available channels and messages for the API. Holds the relative paths to the individual channel and their operations. Channel paths are relative to servers. Channels are also known as "topics", "routing keys", "event types" or "paths".',
8490
},
91+
targetSpecs: AsyncAPI2,
8592
},
8693
{
8794
label: 'components',
@@ -95,6 +102,7 @@ const completion: ApidomCompletionItem[] = [
95102
value:
96103
'[Components Object](https://www.asyncapi.com/docs/reference/specification/v2.6.0#componentsObject)\n\\\n\\\nAn element to hold various schemas for the specification. Holds a set of reusable objects for different aspects of the AsyncAPI specification. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.',
97104
},
105+
targetSpecs: AsyncAPI2,
98106
},
99107
{
100108
label: 'tags',
@@ -108,6 +116,7 @@ const completion: ApidomCompletionItem[] = [
108116
value:
109117
'[Tags Object](https://www.asyncapi.com/docs/reference/specification/v2.6.0#tagsObject)\n\\\n\\\nA list of tags used by the specification with additional metadata. Each tag name in the list **MUST** be unique.',
110118
},
119+
targetSpecs: AsyncAPI2,
111120
},
112121
{
113122
label: 'externalDocs',
@@ -121,6 +130,7 @@ const completion: ApidomCompletionItem[] = [
121130
value:
122131
'[External Documentation Object](https://www.asyncapi.com/docs/reference/specification/v2.6.0#externalDocumentationObject)\n\\\n\\\nAdditional external documentation. Allows referencing an external resource for extended documentation.',
123132
},
133+
targetSpecs: AsyncAPI2,
124134
},
125135
{
126136
label: 'application/json',
@@ -131,6 +141,7 @@ const completion: ApidomCompletionItem[] = [
131141
type: CompletionType.VALUE,
132142
insertTextFormat: 2,
133143
sortText: '0001',
144+
targetSpecs: AsyncAPI2,
134145
},
135146
{
136147
label: 'application/xml',
@@ -141,6 +152,7 @@ const completion: ApidomCompletionItem[] = [
141152
type: CompletionType.VALUE,
142153
insertTextFormat: 2,
143154
sortText: '0002',
155+
targetSpecs: AsyncAPI2,
144156
},
145157
{
146158
label: 'application/yaml',
@@ -151,6 +163,7 @@ const completion: ApidomCompletionItem[] = [
151163
type: CompletionType.VALUE,
152164
insertTextFormat: 2,
153165
sortText: '0003',
166+
targetSpecs: AsyncAPI2,
154167
},
155168
{
156169
label: 'application/x-www-form-urlencoded',
@@ -161,6 +174,7 @@ const completion: ApidomCompletionItem[] = [
161174
type: CompletionType.VALUE,
162175
insertTextFormat: 2,
163176
sortText: '0004',
177+
targetSpecs: AsyncAPI2,
164178
},
165179
{
166180
label: 'application/octet-stream',
@@ -171,6 +185,7 @@ const completion: ApidomCompletionItem[] = [
171185
type: CompletionType.VALUE,
172186
insertTextFormat: 2,
173187
sortText: '0005',
188+
targetSpecs: AsyncAPI2,
174189
},
175190
{
176191
label: 'application/pdf',
@@ -181,6 +196,7 @@ const completion: ApidomCompletionItem[] = [
181196
type: CompletionType.VALUE,
182197
insertTextFormat: 2,
183198
sortText: '0006',
199+
targetSpecs: AsyncAPI2,
184200
},
185201
{
186202
label: 'application/zip',
@@ -191,6 +207,7 @@ const completion: ApidomCompletionItem[] = [
191207
type: CompletionType.VALUE,
192208
insertTextFormat: 2,
193209
sortText: '0007',
210+
targetSpecs: AsyncAPI2,
194211
},
195212
{
196213
label: 'application/gzip',
@@ -201,6 +218,7 @@ const completion: ApidomCompletionItem[] = [
201218
type: CompletionType.VALUE,
202219
insertTextFormat: 2,
203220
sortText: '0008',
221+
targetSpecs: AsyncAPI2,
204222
},
205223
{
206224
label: 'multipart/form-data',
@@ -211,6 +229,7 @@ const completion: ApidomCompletionItem[] = [
211229
type: CompletionType.VALUE,
212230
insertTextFormat: 2,
213231
sortText: '0009',
232+
targetSpecs: AsyncAPI2,
214233
},
215234
{
216235
label: 'text/plain',
@@ -221,6 +240,7 @@ const completion: ApidomCompletionItem[] = [
221240
type: CompletionType.VALUE,
222241
insertTextFormat: 2,
223242
sortText: '0010',
243+
targetSpecs: AsyncAPI2,
224244
},
225245
{
226246
label: 'text/plain;charset=utf-8',
@@ -231,6 +251,7 @@ const completion: ApidomCompletionItem[] = [
231251
type: CompletionType.VALUE,
232252
insertTextFormat: 2,
233253
sortText: '0011',
254+
targetSpecs: AsyncAPI2,
234255
},
235256
{
236257
label: 'text/html',
@@ -241,6 +262,7 @@ const completion: ApidomCompletionItem[] = [
241262
type: CompletionType.VALUE,
242263
insertTextFormat: 2,
243264
sortText: '0012',
265+
targetSpecs: AsyncAPI2,
244266
},
245267
{
246268
label: 'text/xml',
@@ -251,6 +273,7 @@ const completion: ApidomCompletionItem[] = [
251273
type: CompletionType.VALUE,
252274
insertTextFormat: 2,
253275
sortText: '0013',
276+
targetSpecs: AsyncAPI2,
254277
},
255278
{
256279
label: 'text/csv',
@@ -261,6 +284,7 @@ const completion: ApidomCompletionItem[] = [
261284
type: CompletionType.VALUE,
262285
insertTextFormat: 2,
263286
sortText: '0014',
287+
targetSpecs: AsyncAPI2,
264288
},
265289
{
266290
label: 'text/javascript',
@@ -271,6 +295,7 @@ const completion: ApidomCompletionItem[] = [
271295
type: CompletionType.VALUE,
272296
insertTextFormat: 2,
273297
sortText: '0015',
298+
targetSpecs: AsyncAPI2,
274299
},
275300
{
276301
label: 'text/css',
@@ -281,6 +306,7 @@ const completion: ApidomCompletionItem[] = [
281306
type: CompletionType.VALUE,
282307
insertTextFormat: 2,
283308
sortText: '0016',
309+
targetSpecs: AsyncAPI2,
284310
},
285311
{
286312
label: 'image/png',
@@ -291,6 +317,7 @@ const completion: ApidomCompletionItem[] = [
291317
type: CompletionType.VALUE,
292318
insertTextFormat: 2,
293319
sortText: '0017',
320+
targetSpecs: AsyncAPI2,
294321
},
295322
{
296323
label: 'image/jpeg',
@@ -301,6 +328,7 @@ const completion: ApidomCompletionItem[] = [
301328
type: CompletionType.VALUE,
302329
insertTextFormat: 2,
303330
sortText: '0018',
331+
targetSpecs: AsyncAPI2,
304332
},
305333
{
306334
label: 'image/gif',
@@ -311,6 +339,7 @@ const completion: ApidomCompletionItem[] = [
311339
type: CompletionType.VALUE,
312340
insertTextFormat: 2,
313341
sortText: '0019',
342+
targetSpecs: AsyncAPI2,
314343
},
315344
{
316345
label: 'image/bmp',
@@ -321,6 +350,7 @@ const completion: ApidomCompletionItem[] = [
321350
type: CompletionType.VALUE,
322351
insertTextFormat: 2,
323352
sortText: '0020',
353+
targetSpecs: AsyncAPI2,
324354
},
325355
];
326356

0 commit comments

Comments
 (0)