diff --git a/packages/apidom-ls/src/config/openapi/path-item/completion.ts b/packages/apidom-ls/src/config/openapi/path-item/completion.ts index c343e9272a..5e47af4602 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/completion.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/completion.ts @@ -24,6 +24,20 @@ const completion: ApidomCompletionItem[] = [ { namespace: 'openapi', version: '3.0.3' }, ], }, + { + label: '$ref', + insertText: '$ref', + kind: 14, + format: CompletionFormat.QUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '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).', + }, + targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + }, { label: 'summary', insertText: 'summary', @@ -69,8 +83,8 @@ const completion: ApidomCompletionItem[] = [ ], }, { - label: 'put', - insertText: 'put', + label: 'get', + insertText: 'get', kind: 14, format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, @@ -78,18 +92,13 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a PUT operation on this path.', + '[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.', }, - targetSpecs: [ - { namespace: 'openapi', version: '3.0.0' }, - { namespace: 'openapi', version: '3.0.1' }, - { namespace: 'openapi', version: '3.0.2' }, - { namespace: 'openapi', version: '3.0.3' }, - ], + targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], }, { - label: 'post', - insertText: 'post', + label: 'put', + insertText: 'put', kind: 14, format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, @@ -97,7 +106,7 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a POST operation on this path.', + '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a PUT operation on this path.', }, targetSpecs: [ { namespace: 'openapi', version: '3.0.0' }, @@ -107,8 +116,8 @@ const completion: ApidomCompletionItem[] = [ ], }, { - label: 'delete', - insertText: 'delete', + label: 'put', + insertText: 'put', kind: 14, format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, @@ -116,18 +125,13 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a DELETE operation on this path.', + '[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.', }, - targetSpecs: [ - { namespace: 'openapi', version: '3.0.0' }, - { namespace: 'openapi', version: '3.0.1' }, - { namespace: 'openapi', version: '3.0.2' }, - { namespace: 'openapi', version: '3.0.3' }, - ], + targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], }, { - label: 'options', - insertText: 'options', + label: 'post', + insertText: 'post', kind: 14, format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, @@ -135,7 +139,7 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a OPTIONS operation on this path.', + '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a POST operation on this path.', }, targetSpecs: [ { namespace: 'openapi', version: '3.0.0' }, @@ -145,8 +149,8 @@ const completion: ApidomCompletionItem[] = [ ], }, { - label: 'head', - insertText: 'head', + label: 'post', + insertText: 'post', kind: 14, format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, @@ -154,18 +158,13 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a HEAD operation on this path.', + '[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.', }, - targetSpecs: [ - { namespace: 'openapi', version: '3.0.0' }, - { namespace: 'openapi', version: '3.0.1' }, - { namespace: 'openapi', version: '3.0.2' }, - { namespace: 'openapi', version: '3.0.3' }, - ], + targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], }, { - label: 'patch', - insertText: 'patch', + label: 'delete', + insertText: 'delete', kind: 14, format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, @@ -173,7 +172,7 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a PATCH operation on this path.', + '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a DELETE operation on this path.', }, targetSpecs: [ { namespace: 'openapi', version: '3.0.0' }, @@ -183,8 +182,8 @@ const completion: ApidomCompletionItem[] = [ ], }, { - label: 'trace', - insertText: 'trace', + label: 'delete', + insertText: 'delete', kind: 14, format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, @@ -192,45 +191,21 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a TRACE operation on this path.', - }, - targetSpecs: [ - { namespace: 'openapi', version: '3.0.0' }, - { namespace: 'openapi', version: '3.0.1' }, - { namespace: 'openapi', version: '3.0.2' }, - { namespace: 'openapi', version: '3.0.3' }, - ], - }, - { - label: 'servers', - insertText: 'servers', - kind: 14, - format: CompletionFormat.ARRAY, - type: CompletionType.PROPERTY, - insertTextFormat: 2, - documentation: { - kind: 'markdown', - value: - '[[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject)]\n\\\n\\\nAn alternative `server` array to service all operations in this path.', + '[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.', }, - targetSpecs: [ - { namespace: 'openapi', version: '3.0.0' }, - { namespace: 'openapi', version: '3.0.1' }, - { namespace: 'openapi', version: '3.0.2' }, - { namespace: 'openapi', version: '3.0.3' }, - ], + targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], }, { - label: 'parameters', - insertText: 'parameters', + label: 'options', + insertText: 'options', kind: 14, - format: CompletionFormat.ARRAY, + format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, insertTextFormat: 2, documentation: { kind: 'markdown', value: - "[[Parameter](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.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.0.3.md#parameterName) and [location](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn). The list can use the [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.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.0.3.md#componentsParameters).", + '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a OPTIONS operation on this path.', }, targetSpecs: [ { namespace: 'openapi', version: '3.0.0' }, @@ -239,49 +214,23 @@ const completion: ApidomCompletionItem[] = [ { namespace: 'openapi', version: '3.0.3' }, ], }, - // OpenAPI 3.1.x { - label: '$ref', - insertText: '$ref', + label: 'options', + insertText: 'options', kind: 14, - format: CompletionFormat.QUOTED, + format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, insertTextFormat: 2, documentation: { kind: 'markdown', value: - '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).', + '[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.', }, targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], }, { - label: 'summary', - insertText: 'summary', - kind: 14, - format: CompletionFormat.QUOTED, - type: CompletionType.PROPERTY, - insertTextFormat: 2, - documentation: { - kind: 'markdown', - value: 'An optional string summary, intended to apply to all operations in this path.', - }, - }, - { - label: 'description', - insertText: 'description', - kind: 14, - format: CompletionFormat.QUOTED, - type: CompletionType.PROPERTY, - insertTextFormat: 2, - documentation: { - kind: 'markdown', - value: - '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.', - }, - }, - { - label: 'get', - insertText: 'get', + label: 'head', + insertText: 'head', kind: 14, format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, @@ -289,13 +238,18 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[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.', + '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a HEAD operation on this path.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: [ + { namespace: 'openapi', version: '3.0.0' }, + { namespace: 'openapi', version: '3.0.1' }, + { namespace: 'openapi', version: '3.0.2' }, + { namespace: 'openapi', version: '3.0.3' }, + ], }, { - label: 'put', - insertText: 'put', + label: 'head', + insertText: 'head', kind: 14, format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, @@ -303,13 +257,13 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[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.', + '[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.', }, targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], }, { - label: 'post', - insertText: 'post', + label: 'patch', + insertText: 'patch', kind: 14, format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, @@ -317,13 +271,18 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[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.', + '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a PATCH operation on this path.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: [ + { namespace: 'openapi', version: '3.0.0' }, + { namespace: 'openapi', version: '3.0.1' }, + { namespace: 'openapi', version: '3.0.2' }, + { namespace: 'openapi', version: '3.0.3' }, + ], }, { - label: 'delete', - insertText: 'delete', + label: 'patch', + insertText: 'patch', kind: 14, format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, @@ -331,13 +290,13 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[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.', + '[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.', }, targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], }, { - label: 'options', - insertText: 'options', + label: 'trace', + insertText: 'trace', kind: 14, format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, @@ -345,13 +304,18 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[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.', + '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)\n\\\n\\\nA definition of a TRACE operation on this path.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: [ + { namespace: 'openapi', version: '3.0.0' }, + { namespace: 'openapi', version: '3.0.1' }, + { namespace: 'openapi', version: '3.0.2' }, + { namespace: 'openapi', version: '3.0.3' }, + ], }, { - label: 'head', - insertText: 'head', + label: 'trace', + insertText: 'trace', kind: 14, format: CompletionFormat.OBJECT, type: CompletionType.PROPERTY, @@ -359,41 +323,46 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[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.', + '[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.', }, targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], }, { - label: 'patch', - insertText: 'patch', + label: 'servers', + insertText: 'servers', kind: 14, - format: CompletionFormat.OBJECT, + format: CompletionFormat.ARRAY, type: CompletionType.PROPERTY, insertTextFormat: 2, documentation: { kind: 'markdown', value: - '[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.', + '[[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject)]\n\\\n\\\nAn alternative `server` array to service all operations in this path.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: [ + { namespace: 'openapi', version: '3.0.0' }, + { namespace: 'openapi', version: '3.0.1' }, + { namespace: 'openapi', version: '3.0.2' }, + { namespace: 'openapi', version: '3.0.3' }, + ], }, { - label: 'trace', - insertText: 'trace', + label: 'servers', + insertText: 'servers', kind: 14, - format: CompletionFormat.OBJECT, + format: CompletionFormat.ARRAY, type: CompletionType.PROPERTY, insertTextFormat: 2, documentation: { kind: 'markdown', value: - '[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.', + '[[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.', }, targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], }, { - label: 'servers', - insertText: 'servers', + label: 'parameters', + insertText: 'parameters', kind: 14, format: CompletionFormat.ARRAY, type: CompletionType.PROPERTY, @@ -401,9 +370,14 @@ const completion: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '[[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.', + "[[Parameter](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.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.0.3.md#parameterName) and [location](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn). The list can use the [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.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.0.3.md#componentsParameters).", }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: [ + { namespace: 'openapi', version: '3.0.0' }, + { namespace: 'openapi', version: '3.0.1' }, + { namespace: 'openapi', version: '3.0.2' }, + { namespace: 'openapi', version: '3.0.3' }, + ], }, { label: 'parameters',