Skip to content

Commit 4473af7

Browse files
committed
feat(apidom-ls): add rules for components
1 parent 95345f6 commit 4473af7

35 files changed

+638
-74
lines changed

packages/apidom-ls/src/config/asyncapi/asyncapi2/lint/channels-members.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const channelsMembersLint: LinterMeta = {
77
message: 'channels members must be of type `channel`',
88
severity: 1,
99
linterFunction: 'apilintChildrenOfElementsOrClasess',
10-
linterParams: ['channelItem'],
10+
linterParams: [['channelItem']],
1111
marker: 'key',
1212
markerTarget: 'channels',
1313
target: 'channels',

packages/apidom-ls/src/config/asyncapi/asyncapi2/lint/servers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const serversLint: LinterMeta = {
77
message: 'servers members must be of type `server`',
88
severity: 1,
99
linterFunction: 'apilintChildrenOfElementsOrClasess',
10-
linterParams: ['server'],
10+
linterParams: [['server']],
1111
marker: 'key',
1212
markerTarget: 'servers',
1313
target: 'servers',

packages/apidom-ls/src/config/asyncapi/channel-item/complete/channel-item.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
111111
target: 'bindings',
112112
label: 'amqp',
113113
insertText: 'amqp',
114-
kind: 12,
114+
kind: 14,
115115
format: CompletionFormat.OBJECT,
116116
type: CompletionType.PROPERTY,
117117
insertTextFormat: 2,
@@ -120,7 +120,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
120120
target: 'bindings',
121121
label: 'amqps',
122122
insertText: 'amqps',
123-
kind: 12,
123+
kind: 14,
124124
format: CompletionFormat.OBJECT,
125125
type: CompletionType.PROPERTY,
126126
insertTextFormat: 2,
@@ -129,7 +129,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
129129
target: 'bindings',
130130
label: 'http',
131131
insertText: 'http',
132-
kind: 12,
132+
kind: 14,
133133
format: CompletionFormat.OBJECT,
134134
type: CompletionType.PROPERTY,
135135
insertTextFormat: 2,
@@ -138,7 +138,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
138138
target: 'bindings',
139139
label: 'https',
140140
insertText: 'https',
141-
kind: 12,
141+
kind: 14,
142142
format: CompletionFormat.OBJECT,
143143
type: CompletionType.PROPERTY,
144144
insertTextFormat: 2,
@@ -147,7 +147,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
147147
target: 'bindings',
148148
label: 'ibmmq',
149149
insertText: 'ibmmq',
150-
kind: 12,
150+
kind: 14,
151151
format: CompletionFormat.OBJECT,
152152
type: CompletionType.PROPERTY,
153153
insertTextFormat: 2,
@@ -156,7 +156,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
156156
target: 'bindings',
157157
label: 'jms',
158158
insertText: 'jms',
159-
kind: 12,
159+
kind: 14,
160160
format: CompletionFormat.OBJECT,
161161
type: CompletionType.PROPERTY,
162162
insertTextFormat: 2,
@@ -165,7 +165,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
165165
target: 'bindings',
166166
label: 'kafka',
167167
insertText: 'kafka',
168-
kind: 12,
168+
kind: 14,
169169
format: CompletionFormat.OBJECT,
170170
type: CompletionType.PROPERTY,
171171
insertTextFormat: 2,
@@ -174,7 +174,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
174174
target: 'bindings',
175175
label: 'kafka-secure',
176176
insertText: 'kafka-secure',
177-
kind: 12,
177+
kind: 14,
178178
format: CompletionFormat.OBJECT,
179179
type: CompletionType.PROPERTY,
180180
insertTextFormat: 2,
@@ -183,7 +183,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
183183
target: 'bindings',
184184
label: 'anypointmq',
185185
insertText: 'anypointmq',
186-
kind: 12,
186+
kind: 14,
187187
format: CompletionFormat.OBJECT,
188188
type: CompletionType.PROPERTY,
189189
insertTextFormat: 2,
@@ -192,7 +192,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
192192
target: 'bindings',
193193
label: 'mqtt',
194194
insertText: 'mqtt',
195-
kind: 12,
195+
kind: 14,
196196
format: CompletionFormat.OBJECT,
197197
type: CompletionType.PROPERTY,
198198
insertTextFormat: 2,
@@ -201,7 +201,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
201201
target: 'bindings',
202202
label: 'secure-mqtt',
203203
insertText: 'secure-mqtt',
204-
kind: 12,
204+
kind: 14,
205205
format: CompletionFormat.OBJECT,
206206
type: CompletionType.PROPERTY,
207207
insertTextFormat: 2,
@@ -210,7 +210,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
210210
target: 'bindings',
211211
label: 'stomp',
212212
insertText: 'stomp',
213-
kind: 12,
213+
kind: 14,
214214
format: CompletionFormat.OBJECT,
215215
type: CompletionType.PROPERTY,
216216
insertTextFormat: 2,
@@ -219,7 +219,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
219219
target: 'bindings',
220220
label: 'stomps',
221221
insertText: 'stomps',
222-
kind: 12,
222+
kind: 14,
223223
format: CompletionFormat.OBJECT,
224224
type: CompletionType.PROPERTY,
225225
insertTextFormat: 2,
@@ -228,7 +228,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
228228
target: 'bindings',
229229
label: 'ws',
230230
insertText: 'ws',
231-
kind: 12,
231+
kind: 14,
232232
format: CompletionFormat.OBJECT,
233233
type: CompletionType.PROPERTY,
234234
insertTextFormat: 2,
@@ -237,7 +237,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
237237
target: 'bindings',
238238
label: 'wss',
239239
insertText: 'wss',
240-
kind: 12,
240+
kind: 14,
241241
format: CompletionFormat.OBJECT,
242242
type: CompletionType.PROPERTY,
243243
insertTextFormat: 2,
@@ -246,7 +246,7 @@ const channelCompleteJson: ApidomCompletionItem[] = [
246246
target: 'bindings',
247247
label: 'mercure',
248248
insertText: 'mercure',
249-
kind: 12,
249+
kind: 14,
250250
format: CompletionFormat.OBJECT,
251251
type: CompletionType.PROPERTY,
252252
insertTextFormat: 2,

packages/apidom-ls/src/config/asyncapi/channel-item/lint/bindings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const channelBindingsLint: LinterMeta = {
77
message: 'bindings members must be binding objects',
88
severity: 1,
99
linterFunction: 'apilintChildrenOfElementsOrClasess',
10-
linterParams: ['channel-binding'],
10+
linterParams: [['channel-binding']],
1111
marker: 'key',
1212
markerTarget: 'bindings',
1313
target: 'bindings',

packages/apidom-ls/src/config/asyncapi/channel-item/lint/parameters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const channelParametersLint: LinterMeta = {
77
message: 'parameters members must be parameter objects',
88
severity: 1,
99
linterFunction: 'apilintChildrenOfElementsOrClasess',
10-
linterParams: ['parameter'],
10+
linterParams: [['parameter']],
1111
marker: 'key',
1212
markerTarget: 'parameters',
1313
target: 'parameters',
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
import {
2+
ApidomCompletionItem,
3+
CompletionFormat,
4+
CompletionType,
5+
} from '../../../../apidom-language-types';
6+
7+
const componentsComplete: ApidomCompletionItem[] = [
8+
{
9+
label: 'schemas',
10+
insertText: 'schemas',
11+
kind: 14,
12+
format: CompletionFormat.OBJECT,
13+
type: CompletionType.PROPERTY,
14+
insertTextFormat: 2,
15+
documentation: {
16+
kind: 'markdown',
17+
value:
18+
'Map[`string`, [Schema Object](https://www.asyncapi.com/docs/specifications/v2.2.0#schemaObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Schema Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#schemaObject).',
19+
},
20+
},
21+
{
22+
label: 'messages',
23+
insertText: 'messages',
24+
kind: 14,
25+
format: CompletionFormat.OBJECT,
26+
type: CompletionType.PROPERTY,
27+
insertTextFormat: 2,
28+
documentation: {
29+
kind: 'markdown',
30+
value:
31+
'Map[`string`, [Message Object](https://www.asyncapi.com/docs/specifications/v2.2.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Message Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#messageObject).',
32+
},
33+
},
34+
{
35+
label: 'securitySchemes',
36+
insertText: 'securitySchemes',
37+
kind: 14,
38+
format: CompletionFormat.OBJECT,
39+
type: CompletionType.PROPERTY,
40+
insertTextFormat: 2,
41+
documentation: {
42+
kind: 'markdown',
43+
value:
44+
'Map[`string`, [Security Scheme Object](https://www.asyncapi.com/docs/specifications/v2.2.0#securitySchemeObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Security Scheme Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#securitySchemeObject).',
45+
},
46+
},
47+
{
48+
label: 'parameters',
49+
insertText: 'parameters',
50+
kind: 14,
51+
format: CompletionFormat.OBJECT,
52+
type: CompletionType.PROPERTY,
53+
insertTextFormat: 2,
54+
documentation: {
55+
kind: 'markdown',
56+
value:
57+
'Map[`string`, [Parameter Object](https://www.asyncapi.com/docs/specifications/v2.2.0#parameterObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Parameter Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#parameterObject).',
58+
},
59+
},
60+
{
61+
label: 'correlationIds',
62+
insertText: 'correlationIds',
63+
kind: 14,
64+
format: CompletionFormat.OBJECT,
65+
type: CompletionType.PROPERTY,
66+
insertTextFormat: 2,
67+
documentation: {
68+
kind: 'markdown',
69+
value:
70+
'Map[`string`, [Correlation ID Object](https://www.asyncapi.com/docs/specifications/v2.2.0#correlationIdObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Correlation ID Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#correlationIdObject).',
71+
},
72+
},
73+
{
74+
label: 'operationTraits',
75+
insertText: 'operationTraits',
76+
kind: 14,
77+
format: CompletionFormat.OBJECT,
78+
type: CompletionType.PROPERTY,
79+
insertTextFormat: 2,
80+
documentation: {
81+
kind: 'markdown',
82+
value:
83+
'Map[`string`, [Operation Trait Object](https://www.asyncapi.com/docs/specifications/v2.2.0#operationTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Operation Trait Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#operationTraitObject).',
84+
},
85+
},
86+
{
87+
label: 'messageTraits',
88+
insertText: 'messageTraits',
89+
kind: 14,
90+
format: CompletionFormat.OBJECT,
91+
type: CompletionType.PROPERTY,
92+
insertTextFormat: 2,
93+
documentation: {
94+
kind: 'markdown',
95+
value:
96+
'Map[`string`, [Message Trait Object](https://www.asyncapi.com/docs/specifications/v2.2.0#messageTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Message Trait Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#messageTraitObject).',
97+
},
98+
},
99+
{
100+
label: 'serverBindings',
101+
insertText: 'serverBindings',
102+
kind: 14,
103+
format: CompletionFormat.OBJECT,
104+
type: CompletionType.PROPERTY,
105+
insertTextFormat: 2,
106+
documentation: {
107+
kind: 'markdown',
108+
value:
109+
'Map[`string`, [Server Bindings Object](https://www.asyncapi.com/docs/specifications/v2.2.0#serverBindingsObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Server Bindings Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#serverBindingsObject).',
110+
},
111+
},
112+
{
113+
label: 'channelBindings',
114+
insertText: 'channelBindings',
115+
kind: 14,
116+
format: CompletionFormat.OBJECT,
117+
type: CompletionType.PROPERTY,
118+
insertTextFormat: 2,
119+
documentation: {
120+
kind: 'markdown',
121+
value:
122+
'Map[`string`, [Channel Bindings Object](https://www.asyncapi.com/docs/specifications/v2.2.0#channelBindingsObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Channel Bindings Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#channelBindingsObject).',
123+
},
124+
},
125+
{
126+
label: 'operationBindings',
127+
insertText: 'operationBindings',
128+
kind: 14,
129+
format: CompletionFormat.OBJECT,
130+
type: CompletionType.PROPERTY,
131+
insertTextFormat: 2,
132+
documentation: {
133+
kind: 'markdown',
134+
value:
135+
'Map[`string`, [Operation Bindings Object](https://www.asyncapi.com/docs/specifications/v2.2.0#operationBindingsObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Operation Bindings Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#operationBindingsObject).',
136+
},
137+
},
138+
{
139+
label: 'messageBindings',
140+
insertText: 'messageBindings',
141+
kind: 14,
142+
format: CompletionFormat.OBJECT,
143+
type: CompletionType.PROPERTY,
144+
insertTextFormat: 2,
145+
documentation: {
146+
kind: 'markdown',
147+
value:
148+
'Map[`string`, [Message Bindings Object](https://www.asyncapi.com/docs/specifications/v2.2.0#messageBindingsObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Message Bindings Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#messageBindingsObject).',
149+
},
150+
},
151+
];
152+
153+
export default componentsComplete;
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
const componentsDocs = [
2+
{
3+
target: 'schemas',
4+
docs: 'Map[`string`, [Schema Object](https://www.asyncapi.com/docs/specifications/v2.2.0#schemaObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Schema Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#schemaObject).',
5+
},
6+
{
7+
target: 'messages',
8+
docs: 'Map[`string`, [Message Object](https://www.asyncapi.com/docs/specifications/v2.2.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Message Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#messageObject).',
9+
},
10+
{
11+
target: 'securitySchemes',
12+
docs: 'Map[`string`, [Security Scheme Object](https://www.asyncapi.com/docs/specifications/v2.2.0#securitySchemeObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Security Scheme Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#securitySchemeObject).',
13+
},
14+
{
15+
target: 'parameters',
16+
docs: 'Map[`string`, [Parameter Object](https://www.asyncapi.com/docs/specifications/v2.2.0#parameterObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Parameter Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#parameterObject).',
17+
},
18+
{
19+
target: 'correlationIds',
20+
docs: 'Map[`string`, [Correlation ID Object](https://www.asyncapi.com/docs/specifications/v2.2.0#correlationIdObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Correlation ID Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#correlationIdObject).',
21+
},
22+
{
23+
target: 'operationTraits',
24+
docs: 'Map[`string`, [Operation Trait Object](https://www.asyncapi.com/docs/specifications/v2.2.0#operationTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Operation Trait Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#operationTraitObject).',
25+
},
26+
{
27+
target: 'messageTraits',
28+
docs: 'Map[`string`, [Message Trait Object](https://www.asyncapi.com/docs/specifications/v2.2.0#messageTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Message Trait Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#messageTraitObject).',
29+
},
30+
{
31+
target: 'serverBindings',
32+
docs: 'Map[`string`, [Server Bindings Object](https://www.asyncapi.com/docs/specifications/v2.2.0#serverBindingsObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Server Bindings Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#serverBindingsObject).',
33+
},
34+
{
35+
target: 'channelBindings',
36+
docs: 'Map[`string`, [Channel Bindings Object](https://www.asyncapi.com/docs/specifications/v2.2.0#channelBindingsObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Channel Bindings Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#channelBindingsObject).',
37+
},
38+
{
39+
target: 'operationBindings',
40+
docs: 'Map[`string`, [Operation Bindings Object](https://www.asyncapi.com/docs/specifications/v2.2.0#operationBindingsObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Operation Bindings Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#operationBindingsObject).',
41+
},
42+
{
43+
target: 'messageBindings',
44+
docs: 'Map[`string`, [Message Bindings Object](https://www.asyncapi.com/docs/specifications/v2.2.0#messageBindingsObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.2.0#referenceObject)]\n\n ---- \n\nAn object to hold reusable [Message Bindings Objects](https://www.asyncapi.com/docs/specifications/v2.2.0#messageBindingsObject).',
45+
},
46+
{
47+
docs: '[Components Object](https://www.asyncapi.com/docs/specifications/v2.2.0#componentsObject)\n\n ---- \n\nHolds 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.',
48+
},
49+
];
50+
export default componentsDocs;

0 commit comments

Comments
 (0)