Skip to content

Commit e78665e

Browse files
authored
feat(ls): provide OpenAPI 3.1.0 completion rules for Path Item object (#2150)
1 parent ae9ec4f commit e78665e

File tree

1 file changed

+180
-0
lines changed

1 file changed

+180
-0
lines changed

packages/apidom-ls/src/config/openapi/path-item/completion.ts

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,186 @@ const completion: ApidomCompletionItem[] = [
239239
{ namespace: 'openapi', version: '3.0.3' },
240240
],
241241
},
242+
// OpenAPI 3.1.x
243+
{
244+
label: '$ref',
245+
insertText: '$ref',
246+
kind: 14,
247+
format: CompletionFormat.QUOTED,
248+
type: CompletionType.PROPERTY,
249+
insertTextFormat: 2,
250+
documentation: {
251+
kind: 'markdown',
252+
value:
253+
'Allows for an external definition of this path item. The referenced structure MUST be in the format of a [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemObject). In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving [Relative References](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#relativeReferencesURI).',
254+
},
255+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
256+
},
257+
{
258+
label: 'summary',
259+
insertText: 'summary',
260+
kind: 14,
261+
format: CompletionFormat.QUOTED,
262+
type: CompletionType.PROPERTY,
263+
insertTextFormat: 2,
264+
documentation: {
265+
kind: 'markdown',
266+
value: 'An optional string summary, intended to apply to all operations in this path.',
267+
},
268+
},
269+
{
270+
label: 'description',
271+
insertText: 'description',
272+
kind: 14,
273+
format: CompletionFormat.QUOTED,
274+
type: CompletionType.PROPERTY,
275+
insertTextFormat: 2,
276+
documentation: {
277+
kind: 'markdown',
278+
value:
279+
'An optional string description, intended to apply to all operations in this path. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.',
280+
},
281+
},
282+
{
283+
label: 'get',
284+
insertText: 'get',
285+
kind: 14,
286+
format: CompletionFormat.OBJECT,
287+
type: CompletionType.PROPERTY,
288+
insertTextFormat: 2,
289+
documentation: {
290+
kind: 'markdown',
291+
value:
292+
'[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject)\n\\\n\\\nA definition of a GET operation on this path.',
293+
},
294+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
295+
},
296+
{
297+
label: 'put',
298+
insertText: 'put',
299+
kind: 14,
300+
format: CompletionFormat.OBJECT,
301+
type: CompletionType.PROPERTY,
302+
insertTextFormat: 2,
303+
documentation: {
304+
kind: 'markdown',
305+
value:
306+
'[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject)\n\\\n\\\nA definition of a PUT operation on this path.',
307+
},
308+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
309+
},
310+
{
311+
label: 'post',
312+
insertText: 'post',
313+
kind: 14,
314+
format: CompletionFormat.OBJECT,
315+
type: CompletionType.PROPERTY,
316+
insertTextFormat: 2,
317+
documentation: {
318+
kind: 'markdown',
319+
value:
320+
'[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject)\n\\\n\\\nA definition of a POST operation on this path.',
321+
},
322+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
323+
},
324+
{
325+
label: 'delete',
326+
insertText: 'delete',
327+
kind: 14,
328+
format: CompletionFormat.OBJECT,
329+
type: CompletionType.PROPERTY,
330+
insertTextFormat: 2,
331+
documentation: {
332+
kind: 'markdown',
333+
value:
334+
'[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject)\n\\\n\\\nA definition of a DELETE operation on this path.',
335+
},
336+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
337+
},
338+
{
339+
label: 'options',
340+
insertText: 'options',
341+
kind: 14,
342+
format: CompletionFormat.OBJECT,
343+
type: CompletionType.PROPERTY,
344+
insertTextFormat: 2,
345+
documentation: {
346+
kind: 'markdown',
347+
value:
348+
'[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject)\n\\\n\\\nA definition of a OPTIONS operation on this path.',
349+
},
350+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
351+
},
352+
{
353+
label: 'head',
354+
insertText: 'head',
355+
kind: 14,
356+
format: CompletionFormat.OBJECT,
357+
type: CompletionType.PROPERTY,
358+
insertTextFormat: 2,
359+
documentation: {
360+
kind: 'markdown',
361+
value:
362+
'[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject)\n\\\n\\\nA definition of a HEAD operation on this path.',
363+
},
364+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
365+
},
366+
{
367+
label: 'patch',
368+
insertText: 'patch',
369+
kind: 14,
370+
format: CompletionFormat.OBJECT,
371+
type: CompletionType.PROPERTY,
372+
insertTextFormat: 2,
373+
documentation: {
374+
kind: 'markdown',
375+
value:
376+
'[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject)\n\\\n\\\nA definition of a PATCH operation on this path.',
377+
},
378+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
379+
},
380+
{
381+
label: 'trace',
382+
insertText: 'trace',
383+
kind: 14,
384+
format: CompletionFormat.OBJECT,
385+
type: CompletionType.PROPERTY,
386+
insertTextFormat: 2,
387+
documentation: {
388+
kind: 'markdown',
389+
value:
390+
'[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject)\n\\\n\\\nA definition of a TRACE operation on this path.',
391+
},
392+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
393+
},
394+
{
395+
label: 'servers',
396+
insertText: 'servers',
397+
kind: 14,
398+
format: CompletionFormat.ARRAY,
399+
type: CompletionType.PROPERTY,
400+
insertTextFormat: 2,
401+
documentation: {
402+
kind: 'markdown',
403+
value:
404+
'[[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject)]\n\\\n\\\nAn alternative `server` array to service all operations in this path.',
405+
},
406+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
407+
},
408+
{
409+
label: 'parameters',
410+
insertText: 'parameters',
411+
kind: 14,
412+
format: CompletionFormat.ARRAY,
413+
type: CompletionType.PROPERTY,
414+
insertTextFormat: 2,
415+
documentation: {
416+
kind: 'markdown',
417+
value:
418+
"[[Parameter](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)]\n\\\n\\\nA list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterName) and [location](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn). The list can use the [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsParameters).",
419+
},
420+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
421+
},
242422
];
243423

244424
export default completion;

0 commit comments

Comments
 (0)