diff --git a/packages/apidom-ls/src/config/openapi/oauth-flow/completion.ts b/packages/apidom-ls/src/config/openapi/oauth-flow/completion.ts index 8893d26c17..8250749b76 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flow/completion.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flow/completion.ts @@ -3,6 +3,7 @@ import { CompletionFormat, CompletionType, } from '../../../apidom-language-types'; +import { OpenAPI30, OpenAPI31, OpenAPI3 } from '../target-specs'; const completion: ApidomCompletionItem[] = [ { @@ -17,12 +18,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Applies to `oauth2` (`"implicit"`, `"authorizationCode"`). **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL.', }, - 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: OpenAPI30, }, { label: 'authorizationUrl', @@ -36,7 +32,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Applies to `oauth2` (`"implicit"`, `"authorizationCode"`). **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'tokenUrl', @@ -50,12 +46,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Applies to `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`). **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL.', }, - 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: OpenAPI30, }, { label: 'tokenUrl', @@ -69,7 +60,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Applies to `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`). **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'refreshUrl', @@ -83,12 +74,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Applies to `oauth2`. The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.', }, - 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: OpenAPI30, }, { label: 'refreshUrl', @@ -102,7 +88,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Applies to `oauth2`. The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'scopes', @@ -116,6 +102,7 @@ const completion: ApidomCompletionItem[] = [ value: '**REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty.', }, + targetSpecs: OpenAPI3, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/oauth-flow/documentation.ts b/packages/apidom-ls/src/config/openapi/oauth-flow/documentation.ts index bffa7a3891..dc443f62bc 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flow/documentation.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flow/documentation.ts @@ -1,65 +1,48 @@ +import { OpenAPI30, OpenAPI31, OpenAPI3 } from '../target-specs'; + const documentation = [ { target: 'authorizationUrl', docs: 'Applies to `oauth2` (`"implicit"`, `"authorizationCode"`). **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL.', - 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: OpenAPI30, }, { target: 'authorizationUrl', docs: 'Applies to `oauth2` (`"implicit"`, `"authorizationCode"`). **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'tokenUrl', docs: 'Applies to `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`). **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL.', - 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: OpenAPI30, }, { target: 'tokenUrl', docs: 'Applies to `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`). **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'refreshUrl', docs: 'Applies to `oauth2`. The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.', - 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: OpenAPI30, }, { target: 'refreshUrl', docs: 'Applies to `oauth2`. The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'scopes', docs: 'Map[`string`, `string`]\n\\\n\\\nApplies to `oauth2`. **REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty.', + targetSpecs: OpenAPI3, }, { docs: '#### [OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauth-flow-object)\n\nConfiguration details for a supported OAuth Flow\n\n##### Fixed Fields\nField Name | Type | Applies To | Description\n---|:---:|---|---\nauthorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL.\ntokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL.\nrefreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.\nscopes | Map[`string`, `string`] | `oauth2` | **REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty.\n\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions).\n\n##### OAuth Flow Object Examples\n\n```JSON\n{\n "type": "oauth2",\n "flows": {\n "implicit": {\n "authorizationUrl": "https://example.com/api/oauth/dialog",\n "scopes": {\n "write:pets": "modify pets in your account",\n "read:pets": "read your pets"\n }\n },\n "authorizationCode": {\n "authorizationUrl": "https://example.com/api/oauth/dialog",\n "tokenUrl": "https://example.com/api/oauth/token",\n "scopes": {\n "write:pets": "modify pets in your account",\n "read:pets": "read your pets"\n }\n }\n }\n}\n```\n\n\n\\\nYAML\n```yaml\ntype: oauth2\nflows:\n implicit:\n authorizationUrl: https://example.com/api/oauth/dialog\n scopes:\n write:pets: modify pets in your account\n read:pets: read your pets\n authorizationCode:\n authorizationUrl: https://example.com/api/oauth/dialog\n tokenUrl: https://example.com/api/oauth/token\n scopes:\n write:pets: modify pets in your account\n read:pets: read your pets\n```', - 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: OpenAPI30, }, { docs: '#### [OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauthFlowObject)\n\nConfiguration details for a supported OAuth Flow\n##### Fixed Fields\nField Name | Type | Applies To | Description\n---|:---:|---|:---\nauthorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.\ntokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.\nrefreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.\nscopes | Map[`string`, `string`] | `oauth2` | **REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty.\n\n\\\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions).\n##### OAuth Flow Object Examples\n\n\\\nJSON\n```json\n{\n "type": "oauth2",\n "flows": {\n "implicit": {\n "authorizationUrl": "https://example.com/api/oauth/dialog",\n "scopes": {\n "write:pets": "modify pets in your account",\n "read:pets": "read your pets"\n }\n },\n "authorizationCode": {\n "authorizationUrl": "https://example.com/api/oauth/dialog",\n "tokenUrl": "https://example.com/api/oauth/token",\n "scopes": {\n "write:pets": "modify pets in your account",\n "read:pets": "read your pets"\n }\n }\n }\n}\n```\n\n\n\\\nYAML\n```yaml\ntype: oauth2\nflows: \n implicit:\n authorizationUrl: https://example.com/api/oauth/dialog\n scopes:\n write:pets: modify pets in your account\n read:pets: read your pets\n authorizationCode:\n authorizationUrl: https://example.com/api/oauth/dialog\n tokenUrl: https://example.com/api/oauth/token\n scopes:\n write:pets: modify pets in your account\n read:pets: read your pets\n```\n', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/oauth-flow/lint/allowed-fields.ts b/packages/apidom-ls/src/config/openapi/oauth-flow/lint/allowed-fields.ts index 873fe1ac33..c841c5a6c8 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flow/lint/allowed-fields.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flow/lint/allowed-fields.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const allowedFieldsLint: LinterMeta = { code: ApilintCodes.NOT_ALLOWED_FIELDS, @@ -11,6 +12,7 @@ const allowedFieldsLint: LinterMeta = { linterFunction: 'allowedFields', linterParams: [['authorizationUrl', 'tokenUrl', 'refreshUrl', 'scopes'], 'x-'], marker: 'key', + targetSpecs: OpenAPI3, }; export default allowedFieldsLint; diff --git a/packages/apidom-ls/src/config/openapi/oauth-flow/lint/authorization-url--format-uri.ts b/packages/apidom-ls/src/config/openapi/oauth-flow/lint/authorization-url--format-uri.ts index 054939bdaf..44332b8453 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flow/lint/authorization-url--format-uri.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flow/lint/authorization-url--format-uri.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const authorizationUrlFormatURILint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OAUTH_FLOW_FIELD_AUTHORIZATION_URL_FORMAT_URI, @@ -12,6 +13,7 @@ const authorizationUrlFormatURILint: LinterMeta = { marker: 'value', target: 'authorizationUrl', data: {}, + targetSpecs: OpenAPI3, }; export default authorizationUrlFormatURILint; diff --git a/packages/apidom-ls/src/config/openapi/oauth-flow/lint/refresh-url--format-uri.ts b/packages/apidom-ls/src/config/openapi/oauth-flow/lint/refresh-url--format-uri.ts index f9a9536cac..d0b4a17850 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flow/lint/refresh-url--format-uri.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flow/lint/refresh-url--format-uri.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const refreshUrlFormatURILint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OAUTH_FLOW_FIELD_REFRESH_URL_FORMAT_URI, @@ -12,6 +13,7 @@ const refreshUrlFormatURILint: LinterMeta = { marker: 'value', target: 'refreshUrl', data: {}, + targetSpecs: OpenAPI3, }; export default refreshUrlFormatURILint; diff --git a/packages/apidom-ls/src/config/openapi/oauth-flow/lint/scopes--type.ts b/packages/apidom-ls/src/config/openapi/oauth-flow/lint/scopes--type.ts index d00742ae4b..e2faff20f2 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flow/lint/scopes--type.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flow/lint/scopes--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const scopesTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OAUTH_FLOW_FIELD_SCOPES_TYPE, @@ -13,6 +14,7 @@ const scopesTypeLint: LinterMeta = { marker: 'value', target: 'scopes', data: {}, + targetSpecs: OpenAPI3, }; export default scopesTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/oauth-flow/lint/token-url--format-uri.ts b/packages/apidom-ls/src/config/openapi/oauth-flow/lint/token-url--format-uri.ts index 26332529e5..723e15303c 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flow/lint/token-url--format-uri.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flow/lint/token-url--format-uri.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const tokenUrlFormatURILint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OAUTH_FLOW_FIELD_TOKEN_URL_FORMAT_URI, @@ -12,6 +13,7 @@ const tokenUrlFormatURILint: LinterMeta = { marker: 'value', target: 'tokenUrl', data: {}, + targetSpecs: OpenAPI3, }; export default tokenUrlFormatURILint; diff --git a/packages/apidom-ls/src/config/openapi/oauth-flows/completion.ts b/packages/apidom-ls/src/config/openapi/oauth-flows/completion.ts index 02de52bf8e..06e299fc7c 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flows/completion.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flows/completion.ts @@ -3,6 +3,7 @@ import { CompletionFormat, CompletionType, } from '../../../apidom-language-types'; +import { OpenAPI30, OpenAPI31 } from '../target-specs'; const completion: ApidomCompletionItem[] = [ { @@ -17,12 +18,7 @@ const completion: ApidomCompletionItem[] = [ value: '[OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowObject)\n\\\n\\\nConfiguration for the OAuth Implicit flow.', }, - 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: OpenAPI30, }, { label: 'implicit', @@ -36,7 +32,7 @@ const completion: ApidomCompletionItem[] = [ value: '[OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauthFlowObject)\n\\\n\\\nConfiguration for the OAuth Implicit flow.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'password', @@ -50,12 +46,7 @@ const completion: ApidomCompletionItem[] = [ value: '[OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowObject)\n\\\n\\\nConfiguration for the OAuth Resource Owner Password flow.', }, - 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: OpenAPI30, }, { label: 'password', @@ -69,7 +60,7 @@ const completion: ApidomCompletionItem[] = [ value: '[OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauthFlowObject)\n\\\n\\\nConfiguration for the OAuth Resource Owner Password flow.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'clientCredentials', @@ -83,12 +74,7 @@ const completion: ApidomCompletionItem[] = [ value: '[OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowObject)\n\\\n\\\nConfiguration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.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' }, - ], + targetSpecs: OpenAPI30, }, { label: 'clientCredentials', @@ -102,7 +88,7 @@ const completion: ApidomCompletionItem[] = [ value: '[OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauthFlowObject)\n\\\n\\\nConfiguration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'authorizationCode', @@ -116,12 +102,7 @@ const completion: ApidomCompletionItem[] = [ value: '[OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowObject)\n\\\n\\\nConfiguration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.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' }, - ], + targetSpecs: OpenAPI30, }, { label: 'authorizationCode', @@ -135,7 +116,7 @@ const completion: ApidomCompletionItem[] = [ value: '[OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauthFlowObject)\n\\\n\\\nConfiguration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/oauth-flows/documentation.ts b/packages/apidom-ls/src/config/openapi/oauth-flows/documentation.ts index 0e1378e83f..445503bfce 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flows/documentation.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flows/documentation.ts @@ -1,3 +1,5 @@ +import { OpenAPI30, OpenAPI31 } from '../target-specs'; + /** * Omitted fixed fields: * - implicit @@ -14,16 +16,11 @@ const documentation = [ { docs: '#### [OAuth Flows Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowsObject)\nAllows configuration of the supported OAuth Flows.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\nimplicit | [OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowObject) | Configuration for the OAuth Implicit flow\npassword | [OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowObject) | Configuration for the OAuth Resource Owner Password flow\nclientCredentials | [OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0.\nauthorizationCode | [OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0.\n\n\\\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions).\n', - 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: OpenAPI30, }, { docs: '#### [OAuth Flows Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauthFlowsObject)\nAllows configuration of the supported OAuth Flows.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\nimplicit | [OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauthFlowObject) | Configuration for the OAuth Implicit flow\npassword | [OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauthFlowObject) | Configuration for the OAuth Resource Owner Password flow\nclientCredentials | [OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0.\nauthorizationCode | [OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0.\n\n\\\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions).\n', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/oauth-flows/lint/allowed-fields.ts b/packages/apidom-ls/src/config/openapi/oauth-flows/lint/allowed-fields.ts index 573cdda71d..69c910e83f 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flows/lint/allowed-fields.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flows/lint/allowed-fields.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const allowedFieldsLint: LinterMeta = { code: ApilintCodes.NOT_ALLOWED_FIELDS, @@ -11,6 +12,7 @@ const allowedFieldsLint: LinterMeta = { linterFunction: 'allowedFields', linterParams: [['implicit', 'password', 'clientCredentials', 'authorizationCode'], 'x-'], marker: 'key', + targetSpecs: OpenAPI3, }; export default allowedFieldsLint; diff --git a/packages/apidom-ls/src/config/openapi/oauth-flows/lint/authorization-code--type.ts b/packages/apidom-ls/src/config/openapi/oauth-flows/lint/authorization-code--type.ts index 5c38d49b8f..34338b52b8 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flows/lint/authorization-code--type.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flows/lint/authorization-code--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const authorizationCodeTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OAUTH_FLOWS_FIELD_AUTHORIZATION_CODE_TYPE, @@ -13,6 +14,7 @@ const authorizationCodeTypeLint: LinterMeta = { marker: 'value', target: 'authorizationCode', data: {}, + targetSpecs: OpenAPI3, }; export default authorizationCodeTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/oauth-flows/lint/client-credentials--type.ts b/packages/apidom-ls/src/config/openapi/oauth-flows/lint/client-credentials--type.ts index b8036af80b..0a89dc5dcc 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flows/lint/client-credentials--type.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flows/lint/client-credentials--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const clientCredentialsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OAUTH_FLOWS_FIELD_CLIENT_CREDENTIALS_TYPE, @@ -13,6 +14,7 @@ const clientCredentialsTypeLint: LinterMeta = { marker: 'value', target: 'clientCredentials', data: {}, + targetSpecs: OpenAPI3, }; export default clientCredentialsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/oauth-flows/lint/implicit--type.ts b/packages/apidom-ls/src/config/openapi/oauth-flows/lint/implicit--type.ts index 34a41ee74e..a416f60b23 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flows/lint/implicit--type.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flows/lint/implicit--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const implicitTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OAUTH_FLOWS_FIELD_IMPLICIT_TYPE, @@ -13,6 +14,7 @@ const implicitTypeLint: LinterMeta = { marker: 'value', target: 'implicit', data: {}, + targetSpecs: OpenAPI3, }; export default implicitTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/oauth-flows/lint/password--type.ts b/packages/apidom-ls/src/config/openapi/oauth-flows/lint/password--type.ts index a03496ccd7..4d4457a7cf 100644 --- a/packages/apidom-ls/src/config/openapi/oauth-flows/lint/password--type.ts +++ b/packages/apidom-ls/src/config/openapi/oauth-flows/lint/password--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const passwordTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OAUTH_FLOWS_FIELD_PASSWORD_TYPE, @@ -13,6 +14,7 @@ const passwordTypeLint: LinterMeta = { marker: 'value', target: 'password', data: {}, + targetSpecs: OpenAPI3, }; export default passwordTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi/completion.ts b/packages/apidom-ls/src/config/openapi/openapi/completion.ts index b998ef352c..08f250c9ab 100644 --- a/packages/apidom-ls/src/config/openapi/openapi/completion.ts +++ b/packages/apidom-ls/src/config/openapi/openapi/completion.ts @@ -3,47 +3,53 @@ import { CompletionFormat, CompletionType, } from '../../../apidom-language-types'; +import { OpenAPI3 } from '../target-specs'; const completion: ApidomCompletionItem[] = [ { label: '3.0.0', insertText: '3.0.0', kind: 12, - format: CompletionFormat.QUOTED_FORCED, + format: CompletionFormat.UNQUOTED, type: CompletionType.VALUE, insertTextFormat: 2, + targetSpecs: OpenAPI3, }, { label: '3.0.1', insertText: '3.0.1', kind: 12, - format: CompletionFormat.QUOTED_FORCED, + format: CompletionFormat.UNQUOTED, type: CompletionType.VALUE, insertTextFormat: 2, + targetSpecs: OpenAPI3, }, { label: '3.0.2', insertText: '3.0.2', kind: 12, - format: CompletionFormat.QUOTED_FORCED, + format: CompletionFormat.UNQUOTED, type: CompletionType.VALUE, insertTextFormat: 2, + targetSpecs: OpenAPI3, }, { label: '3.0.3', insertText: '3.0.3', kind: 12, - format: CompletionFormat.QUOTED_FORCED, + format: CompletionFormat.UNQUOTED, type: CompletionType.VALUE, insertTextFormat: 2, + targetSpecs: OpenAPI3, }, { label: '3.1.0', insertText: '3.1.0', kind: 12, - format: CompletionFormat.QUOTED_FORCED, + format: CompletionFormat.UNQUOTED, type: CompletionType.VALUE, insertTextFormat: 2, + targetSpecs: OpenAPI3, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-0.ts b/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-0.ts index 63c3436d9b..9f83a2e18b 100644 --- a/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-0.ts +++ b/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-0.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI300 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const valuePattern3_0_0Lint: LinterMeta = { @@ -12,7 +13,6 @@ const valuePattern3_0_0Lint: LinterMeta = { linterFunction: 'apilintValueRegex', linterParams: ['3\\.0\\.0'], marker: 'value', - targetSpecs: [{ namespace: 'openapi', version: '3.0.0' }], data: { quickFix: [ { @@ -22,6 +22,7 @@ const valuePattern3_0_0Lint: LinterMeta = { }, ], }, + targetSpecs: OpenAPI300, }; export default valuePattern3_0_0Lint; diff --git a/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-1.ts b/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-1.ts index ca20b4a9b4..924d3fb2a0 100644 --- a/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-1.ts +++ b/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-1.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI301 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const valuePattern3_0_1Lint: LinterMeta = { @@ -12,7 +13,6 @@ const valuePattern3_0_1Lint: LinterMeta = { linterFunction: 'apilintValueRegex', linterParams: ['3\\.0\\.1'], marker: 'value', - targetSpecs: [{ namespace: 'openapi', version: '3.0.1' }], data: { quickFix: [ { @@ -22,6 +22,7 @@ const valuePattern3_0_1Lint: LinterMeta = { }, ], }, + targetSpecs: OpenAPI301, }; export default valuePattern3_0_1Lint; diff --git a/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-2.ts b/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-2.ts index e74ee3ecc5..7cfb610c28 100644 --- a/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-2.ts +++ b/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-2.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI302 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const valuePattern3_0_2Lint: LinterMeta = { @@ -12,7 +13,6 @@ const valuePattern3_0_2Lint: LinterMeta = { linterFunction: 'apilintValueRegex', linterParams: ['3\\.0\\.2'], marker: 'value', - targetSpecs: [{ namespace: 'openapi', version: '3.0.2' }], data: { quickFix: [ { @@ -22,6 +22,7 @@ const valuePattern3_0_2Lint: LinterMeta = { }, ], }, + targetSpecs: OpenAPI302, }; export default valuePattern3_0_2Lint; diff --git a/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-3.ts b/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-3.ts index d5e1b61f20..9b07cabc0d 100644 --- a/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-3.ts +++ b/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-0-3.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI303 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const valuePattern3_0_3Lint: LinterMeta = { @@ -12,7 +13,6 @@ const valuePattern3_0_3Lint: LinterMeta = { linterFunction: 'apilintValueRegex', linterParams: ['3\\.0\\.3'], marker: 'value', - targetSpecs: [{ namespace: 'openapi', version: '3.0.3' }], data: { quickFix: [ { @@ -22,6 +22,7 @@ const valuePattern3_0_3Lint: LinterMeta = { }, ], }, + targetSpecs: OpenAPI303, }; export default valuePattern3_0_3Lint; diff --git a/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-1-0.ts b/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-1-0.ts index 64d96d93fb..fbcb554c7f 100644 --- a/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-1-0.ts +++ b/packages/apidom-ls/src/config/openapi/openapi/lint/value--pattern-3-1-0.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const valuePattern3_1_0Lint: LinterMeta = { @@ -12,7 +13,6 @@ const valuePattern3_1_0Lint: LinterMeta = { linterFunction: 'apilintValueRegex', linterParams: ['3\\.1\\.0'], marker: 'value', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], data: { quickFix: [ { @@ -22,6 +22,7 @@ const valuePattern3_1_0Lint: LinterMeta = { }, ], }, + targetSpecs: OpenAPI31, }; export default valuePattern3_1_0Lint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/completion.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/completion.ts index e2c6e5cc02..8e98b91e7d 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/completion.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/completion.ts @@ -3,6 +3,7 @@ import { CompletionFormat, CompletionType, } from '../../../apidom-language-types'; +import { OpenAPI30 } from '../target-specs'; const completion: ApidomCompletionItem[] = [ { @@ -17,6 +18,7 @@ const completion: ApidomCompletionItem[] = [ value: '**REQUIRED**. This string MUST be the [semantic version number](https://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#versions) that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is *not* related to the API [`info.version`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#infoVersion) string', }, + targetSpecs: OpenAPI30, }, { label: 'info', @@ -30,6 +32,7 @@ const completion: ApidomCompletionItem[] = [ value: '[Info Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#infoObject)\n\\\n\\\n**REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required.', }, + targetSpecs: OpenAPI30, }, { label: 'servers', @@ -43,6 +46,7 @@ const completion: ApidomCompletionItem[] = [ value: '[[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject)]\n\\\n\\\nAn array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject) with a [url](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverUrl) value of `/`.', }, + targetSpecs: OpenAPI30, }, { label: 'paths', @@ -56,6 +60,7 @@ const completion: ApidomCompletionItem[] = [ value: '[Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsObject)\n\\\n\\\n**REQUIRED**. The available paths and operations for the API.', }, + targetSpecs: OpenAPI30, }, { label: 'components', @@ -69,6 +74,7 @@ const completion: ApidomCompletionItem[] = [ value: '[Components Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#componentsObject)\n\\\n\\\nAn element to hold various schemas for the specification.', }, + targetSpecs: OpenAPI30, }, { label: 'security', @@ -82,6 +88,7 @@ const completion: ApidomCompletionItem[] = [ value: '[[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securityRequirementObject)]\n\\\n\\\nA declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement (`{}`) can be included in the array.', }, + targetSpecs: OpenAPI30, }, { label: 'tags', @@ -95,6 +102,7 @@ const completion: ApidomCompletionItem[] = [ value: "[[Tag Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#tagObject)]\n\\\n\\\nA list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.", }, + targetSpecs: OpenAPI30, }, { label: 'externalDocs', @@ -108,6 +116,7 @@ const completion: ApidomCompletionItem[] = [ value: '[External Documentation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#externalDocumentationObject)\n\\\n\\\nAdditional external documentation.', }, + targetSpecs: OpenAPI30, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/documentation.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/documentation.ts index 57dcf6cbfa..c4e85d27c4 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/documentation.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/documentation.ts @@ -1,3 +1,5 @@ +import { OpenAPI30 } from '../target-specs'; + /** * Omitted fixed fields: * - info @@ -15,21 +17,26 @@ const documentation = [ { target: 'openapi', docs: '**REQUIRED**. This string MUST be the [semantic version number](https://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#versions) that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is *not* related to the API [`info.version`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#infoVersion) string', + targetSpecs: OpenAPI30, }, { target: 'servers', docs: '[[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject)]\n\\\n\\\nAn array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject) with a [url](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverUrl) value of `/`.', + targetSpecs: OpenAPI30, }, { target: 'security', docs: '[[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securityRequirementObject)]\n\\\n\\\nA declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement (`{}`) can be included in the array.', + targetSpecs: OpenAPI30, }, { target: 'tags', docs: "[[Tag Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#tagObject)]\n\\\n\\\nA list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.", + targetSpecs: OpenAPI30, }, { docs: "#### [OpenAPI Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oasObject)\n\nThis is the root document object of the [OpenAPI document](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oasDocument).\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\nopenapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](https://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#versions) that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is *not* related to the API [`info.version`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#infoVersion) string.\ninfo | [Info Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required.\nservers | [[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject)] | An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject) with a [url](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverUrl) value of `/`.\npaths | [Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsObject) | **REQUIRED**. The available paths and operations for the API.\ncomponents | [Components Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#componentsObject) | An element to hold various schemas for the specification.\nsecurity | [[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement (`{}`) can be included in the array.\ntags | [[Tag Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.\nexternalDocs | [External Documentation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#externalDocumentationObject) | Additional external documentation.\n\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions).", + targetSpecs: OpenAPI30, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/allowed-fields.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/allowed-fields.ts index b06f72d689..774317cc58 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/allowed-fields.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/allowed-fields.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; const allowedFieldsLint: LinterMeta = { code: ApilintCodes.NOT_ALLOWED_FIELDS, @@ -14,6 +15,7 @@ const allowedFieldsLint: LinterMeta = { 'x-', ], marker: 'key', + targetSpecs: OpenAPI30, }; export default allowedFieldsLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/components--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/components--type.ts index a559a0bf26..ba81d9bebe 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/components--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/components--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; const componentsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPEN_API_FIELD_COMPONENTS_TYPE, @@ -13,6 +14,7 @@ const componentsTypeLint: LinterMeta = { marker: 'value', target: 'components', data: {}, + targetSpecs: OpenAPI30, }; export default componentsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/external-docs--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/external-docs--type.ts index b269bb6a54..48983e0613 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/external-docs--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/external-docs--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; const externalDocsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPEN_API_FIELD_EXTERNAL_DOCS_TYPE, @@ -13,6 +14,7 @@ const externalDocsTypeLint: LinterMeta = { marker: 'value', target: 'externalDocs', data: {}, + targetSpecs: OpenAPI30, }; export default externalDocsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/info--required.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/info--required.ts index 877e68e30e..dde65ca582 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/info--required.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/info--required.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; const infoRequiredLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPEN_API_FIELD_INFO_TYPE_REQUIRED, @@ -21,6 +22,7 @@ const infoRequiredLint: LinterMeta = { }, ], }, + targetSpecs: OpenAPI30, }; export default infoRequiredLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/info--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/info--type.ts index fe207c6f9e..ab3766a9cc 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/info--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/info--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; const infoTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPEN_API_FIELD_INFO_TYPE, @@ -13,6 +14,7 @@ const infoTypeLint: LinterMeta = { marker: 'value', target: 'info', data: {}, + targetSpecs: OpenAPI30, }; export default infoTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/paths--required.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/paths--required.ts index fa3b9dd784..f3ae3adbbf 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/paths--required.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/paths--required.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; const pathsRequiredLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPEN_API_FIELD_PATHS_REQUIRED, @@ -21,6 +22,7 @@ const pathsRequiredLint: LinterMeta = { }, ], }, + targetSpecs: OpenAPI30, }; export default pathsRequiredLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/paths--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/paths--type.ts index 9920341e88..5bdde6ab83 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/paths--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/paths--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; const pathsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPEN_API_FIELD_PATHS_TYPE, @@ -13,6 +14,7 @@ const pathsTypeLint: LinterMeta = { marker: 'value', target: 'paths', data: {}, + targetSpecs: OpenAPI30, }; export default pathsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/security--items-type.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/security--items-type.ts index d530f6678c..4923779957 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/security--items-type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/security--items-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; const securityItemsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPEN_API_FIELD_SECURITY_ITEMS_TYPE, @@ -13,6 +14,7 @@ const securityItemsTypeLint: LinterMeta = { marker: 'key', target: 'security', data: {}, + targetSpecs: OpenAPI30, }; export default securityItemsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/security--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/security--type.ts index da3a912c13..21a6118e06 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/security--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/security--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; const securityTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPEN_API_FIELD_SECURITY_TYPE, @@ -13,6 +14,7 @@ const securityTypeLint: LinterMeta = { marker: 'value', target: 'security', data: {}, + targetSpecs: OpenAPI30, }; export default securityTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/servers--items-type.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/servers--items-type.ts index 4338aad85a..458ac58520 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/servers--items-type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/servers--items-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; const serverItemsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPEN_API_FIELD_SERVERS_ITEMS_TYPE, @@ -13,6 +14,7 @@ const serverItemsTypeLint: LinterMeta = { marker: 'key', target: 'servers', data: {}, + targetSpecs: OpenAPI30, }; export default serverItemsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/servers--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/servers--type.ts index 695a26bb40..09ab13ab03 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/servers--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/servers--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; const serversTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPEN_API_FIELD_SERVERS_TYPE, @@ -13,6 +14,7 @@ const serversTypeLint: LinterMeta = { marker: 'value', target: 'servers', data: {}, + targetSpecs: OpenAPI30, }; export default serversTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/tags--items-type.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/tags--items-type.ts index acd34fca39..df1221de1e 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/tags--items-type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/tags--items-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; const tagsItemsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPEN_API_FIELD_TAGS_ITEMS_TYPE, @@ -13,6 +14,7 @@ const tagsItemsTypeLint: LinterMeta = { marker: 'key', target: 'tags', data: {}, + targetSpecs: OpenAPI30, }; export default tagsItemsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/tags--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/tags--type.ts index 61c30d18b0..af1c04557b 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_0/lint/tags--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_0/lint/tags--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; const tagsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPEN_API_FIELD_TAGS_TYPE, @@ -13,6 +14,7 @@ const tagsTypeLint: LinterMeta = { marker: 'value', target: 'tags', data: {}, + targetSpecs: OpenAPI30, }; export default tagsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/completion.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/completion.ts index ab16b0df83..f3acb15cab 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/completion.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/completion.ts @@ -3,6 +3,7 @@ import { CompletionFormat, CompletionType, } from '../../../apidom-language-types'; +import { OpenAPI31 } from '../target-specs'; const completion: ApidomCompletionItem[] = [ { @@ -17,6 +18,7 @@ const completion: ApidomCompletionItem[] = [ value: '**REQUIRED**. This string MUST be the [version number](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#versions) of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI document. This is *not* related to the API [`info.version`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoVersion) string.', }, + targetSpecs: OpenAPI31, }, { label: 'info', @@ -30,6 +32,7 @@ const completion: ApidomCompletionItem[] = [ value: '[Info Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoObject)\n\\\n\\\n**REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required.', }, + targetSpecs: OpenAPI31, }, { label: 'jsonSchemaDialect', @@ -43,6 +46,7 @@ const completion: ApidomCompletionItem[] = [ value: 'The default value for the `$schema` keyword within [Schema Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schemaObject) contained within this OAS document. This MUST be in the form of a URI.', }, + targetSpecs: OpenAPI31, }, { label: 'servers', @@ -56,6 +60,7 @@ const completion: ApidomCompletionItem[] = [ value: '[[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject)]\n\\\n\\\nAn array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject) with a [url](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverUrl) value of `/`.', }, + targetSpecs: OpenAPI31, }, { label: 'paths', @@ -69,6 +74,7 @@ const completion: ApidomCompletionItem[] = [ value: '[Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsObject)\n\\\n\\\n**REQUIRED**. The available paths and operations for the API.', }, + targetSpecs: OpenAPI31, }, { label: 'webhooks', @@ -82,6 +88,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Map[`string`, [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)]\n\\\n\\\nThe incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An [example](https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.1/webhook-example.yaml) is available.', }, + targetSpecs: OpenAPI31, }, { label: 'components', @@ -95,6 +102,7 @@ const completion: ApidomCompletionItem[] = [ value: '[Components Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsObject)\n\\\n\\\nAn element to hold various schemas for the specification.', }, + targetSpecs: OpenAPI31, }, { label: 'security', @@ -108,6 +116,7 @@ const completion: ApidomCompletionItem[] = [ value: '[[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#securityRequirementObject)]\n\\\n\\\nA declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement (`{}`) can be included in the array.', }, + targetSpecs: OpenAPI31, }, { label: 'tags', @@ -121,6 +130,7 @@ const completion: ApidomCompletionItem[] = [ value: "[[Tag Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tagObject)]\n\\\n\\\nA list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.", }, + targetSpecs: OpenAPI31, }, { label: 'externalDocs', @@ -134,6 +144,7 @@ const completion: ApidomCompletionItem[] = [ value: '[External Documentation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#externalDocumentationObject)\n\\\n\\\nAdditional external documentation.', }, + targetSpecs: OpenAPI31, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/documentation.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/documentation.ts index 8f3a00e972..bf9d5672a8 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/documentation.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/documentation.ts @@ -1,3 +1,5 @@ +import { OpenAPI31 } from '../target-specs'; + /** * Omitted fixed fields: * - info @@ -15,26 +17,32 @@ const documentation = [ { target: 'openapi', docs: '**REQUIRED**. This string MUST be the [version number](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#versions) of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI document. This is *not* related to the API [`info.version`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoVersion) string.', + targetSpecs: OpenAPI31, }, { target: 'jsonSchemaDialect', docs: 'The default value for the `$schema` keyword within [Schema Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schemaObject) contained within this OAS document. This MUST be in the form of a URI.', + targetSpecs: OpenAPI31, }, { target: 'servers', docs: '[[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject)]\n\\\n\\\nAn array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject) with a [url](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverUrl) value of `/`.', + targetSpecs: OpenAPI31, }, { target: 'webhooks', docs: 'Map[`string`, [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)]\n\\\n\\\nThe incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An [example](https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.1/webhook-example.yaml) is available.', + targetSpecs: OpenAPI31, }, { target: 'security', docs: '[[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#securityRequirementObject)]\n\\\n\\\nA declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement ({}) can be included in the array.', + targetSpecs: OpenAPI31, }, { target: 'tags', docs: "[[Tag Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tagObject)]\n\\\n\\\nA list of tags used by the document with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.", + targetSpecs: OpenAPI31, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/allowed-fields.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/allowed-fields.ts index 794a7f64c3..0c3a536716 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/allowed-fields.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/allowed-fields.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const allowedFieldsLint: LinterMeta = { code: ApilintCodes.NOT_ALLOWED_FIELDS, @@ -25,6 +26,7 @@ const allowedFieldsLint: LinterMeta = { 'x-', ], marker: 'key', + targetSpecs: OpenAPI31, }; export default allowedFieldsLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/components--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/components--type.ts index b9ab270cd2..f828a8c832 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/components--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/components--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const componentsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_COMPONENTS_TYPE, @@ -13,6 +14,7 @@ const componentsTypeLint: LinterMeta = { marker: 'value', target: 'components', data: {}, + targetSpecs: OpenAPI31, }; export default componentsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/external-docs--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/external-docs--type.ts index 61fbdd6c4f..3edd9819bb 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/external-docs--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/external-docs--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const externalDocsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_EXTERNAL_DOCS_TYPE, @@ -13,6 +14,7 @@ const externalDocsTypeLint: LinterMeta = { marker: 'value', target: 'externalDocs', data: {}, + targetSpecs: OpenAPI31, }; export default externalDocsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--required.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--required.ts index a8811494fa..c81a0c370e 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--required.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--required.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const infoRequiredLint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_INFO_TYPE_REQUIRED, @@ -21,6 +22,7 @@ const infoRequiredLint: LinterMeta = { }, ], }, + targetSpecs: OpenAPI31, }; export default infoRequiredLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--type.ts index faac99e209..7bba586374 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/info--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const infoTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_INFO_TYPE, @@ -13,6 +14,7 @@ const infoTypeLint: LinterMeta = { marker: 'value', target: 'info', data: {}, + targetSpecs: OpenAPI31, }; export default infoTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/json-schema-dialect--format-uri.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/json-schema-dialect--format-uri.ts index 64836fcf73..d23c682434 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/json-schema-dialect--format-uri.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/json-schema-dialect--format-uri.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const jsonSchemaDialectFormatURILint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_JSON_SCHEMA_DIALECT_FORMAT_URI, @@ -12,6 +13,7 @@ const jsonSchemaDialectFormatURILint: LinterMeta = { marker: 'value', target: 'jsonSchemaDialect', data: {}, + targetSpecs: OpenAPI31, }; export default jsonSchemaDialectFormatURILint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/paths--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/paths--type.ts index 15e4b5d979..ab105ba05b 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/paths--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/paths--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const pathsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_PATHS_TYPE, @@ -13,6 +14,7 @@ const pathsTypeLint: LinterMeta = { marker: 'value', target: 'paths', data: {}, + targetSpecs: OpenAPI31, }; export default pathsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/required-fields.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/required-fields.ts index ca25c812d6..993ae5f2c5 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/required-fields.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/required-fields.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const requiredFieldsLint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_REQUIRED_FIELDS, @@ -28,6 +29,7 @@ const requiredFieldsLint: LinterMeta = { }, ], }, + targetSpecs: OpenAPI31, }; export default requiredFieldsLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--items-type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--items-type.ts index 43227f6724..8cc35fbb42 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--items-type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--items-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const securityItemsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_SECURITY_ITEMS_TYPE, @@ -13,6 +14,7 @@ const securityItemsTypeLint: LinterMeta = { marker: 'key', target: 'security', data: {}, + targetSpecs: OpenAPI31, }; export default securityItemsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--type.ts index cd87a2a08b..752744c736 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/security--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const securityTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_SECURITY_TYPE, @@ -13,6 +14,7 @@ const securityTypeLint: LinterMeta = { marker: 'value', target: 'security', data: {}, + targetSpecs: OpenAPI31, }; export default securityTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--items-type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--items-type.ts index 03c1be49c4..99bb38961a 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--items-type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--items-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const serverItemsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_SERVERS_ITEMS_TYPE, @@ -13,6 +14,7 @@ const serverItemsTypeLint: LinterMeta = { marker: 'key', target: 'servers', data: {}, + targetSpecs: OpenAPI31, }; export default serverItemsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--type.ts index adecd2943f..eab6bd69d5 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/servers--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const serversTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_SERVERS_TYPE, @@ -13,6 +14,7 @@ const serversTypeLint: LinterMeta = { marker: 'value', target: 'servers', data: {}, + targetSpecs: OpenAPI31, }; export default serversTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--items-type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--items-type.ts index 03118ef43e..a5b4a1419d 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--items-type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--items-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const tagsItemsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_TAGS_ITEMS_TYPE, @@ -13,6 +14,7 @@ const tagsItemsTypeLint: LinterMeta = { marker: 'key', target: 'tags', data: {}, + targetSpecs: OpenAPI31, }; export default tagsItemsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--type.ts index 069c6fb1b1..f504a0dbed 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/tags--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const tagsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_TAGS_TYPE, @@ -13,6 +14,7 @@ const tagsTypeLint: LinterMeta = { marker: 'value', target: 'tags', data: {}, + targetSpecs: OpenAPI31, }; export default tagsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/webhooks--values--type.ts b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/webhooks--values--type.ts index a81c7512a3..1e272e8af8 100644 --- a/packages/apidom-ls/src/config/openapi/openapi3_1/lint/webhooks--values--type.ts +++ b/packages/apidom-ls/src/config/openapi/openapi3_1/lint/webhooks--values--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; const webhooksLint: LinterMeta = { code: ApilintCodes.OPENAPI3_1_OPEN_API_FIELD_WEBHOOKS_VALUES_TYPE, @@ -14,6 +15,7 @@ const webhooksLint: LinterMeta = { markerTarget: 'webhooks', target: 'webhooks', data: {}, + targetSpecs: OpenAPI31, }; export default webhooksLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/completion.ts b/packages/apidom-ls/src/config/openapi/operation/completion.ts index 35c3909bf6..698a403a87 100644 --- a/packages/apidom-ls/src/config/openapi/operation/completion.ts +++ b/packages/apidom-ls/src/config/openapi/operation/completion.ts @@ -3,6 +3,7 @@ import { CompletionFormat, CompletionType, } from '../../../apidom-language-types'; +import { OpenAPI30, OpenAPI31, OpenAPI3 } from '../target-specs'; const completion: ApidomCompletionItem[] = [ { @@ -17,6 +18,7 @@ const completion: ApidomCompletionItem[] = [ value: '[`string`]\n\\\n\\\nA list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.', }, + targetSpecs: OpenAPI3, }, { label: 'summary', @@ -29,6 +31,7 @@ const completion: ApidomCompletionItem[] = [ kind: 'markdown', value: 'A short summary of what the operation does.', }, + targetSpecs: OpenAPI3, }, { label: 'description', @@ -42,6 +45,7 @@ const completion: ApidomCompletionItem[] = [ value: 'A verbose explanation of the operation behavior. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.', }, + targetSpecs: OpenAPI3, }, { label: 'externalDocs', @@ -55,12 +59,7 @@ const completion: ApidomCompletionItem[] = [ value: '[External Documentation](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#externalDocumentationObject)\n\\\n\\\nAdditional external documentation for this operation.', }, - 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: OpenAPI30, }, { label: 'externalDocs', @@ -74,7 +73,7 @@ const completion: ApidomCompletionItem[] = [ value: '[External Documentation](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#externalDocumentationObject)\n\\\n\\\nAdditional external documentation for this operation.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'operationId', @@ -88,6 +87,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is **case-sensitive**. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions.', }, + targetSpecs: OpenAPI3, }, { label: 'parameters', @@ -101,12 +101,7 @@ const completion: ApidomCompletionItem[] = [ value: "[[Parameter Object](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 this operation. If a parameter is already defined at the [Path Item](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathItemParameters), the new definition will override it but can never remove it. 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.0.0' }, - { namespace: 'openapi', version: '3.0.1' }, - { namespace: 'openapi', version: '3.0.2' }, - { namespace: 'openapi', version: '3.0.3' }, - ], + targetSpecs: OpenAPI30, }, { label: 'parameters', @@ -120,7 +115,7 @@ const completion: ApidomCompletionItem[] = [ value: "[[Parameter Object](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 this operation. If a parameter is already defined at the [Path Item](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemParameters), the new definition will override it but can never remove it. 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).", }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'requestBody', @@ -134,12 +129,7 @@ const completion: ApidomCompletionItem[] = [ value: '[Request Body Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#requestBodyObject) \\| [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)\n\\\n\\\nThe request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers.', }, - 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: OpenAPI30, }, { label: 'requestBody', @@ -153,7 +143,7 @@ const completion: ApidomCompletionItem[] = [ value: '[[Request Body Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#requestBodyObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)]\n\\\n\\\nThe request body applicable for this operation. The requestBody is fully supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague (such as [GET](https://tools.ietf.org/html/rfc7231#section-4.3.1), [HEAD](https://tools.ietf.org/html/rfc7231#section-4.3.2) and [DELETE](https://tools.ietf.org/html/rfc7231#section-4.3.5)), `requestBody` is permitted but does not have well-defined semantics and SHOULD be avoided if possible.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'responses', @@ -167,12 +157,7 @@ const completion: ApidomCompletionItem[] = [ value: '[Responses Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#responsesObject)\n\\\n\\\n**REQUIRED**. The list of possible responses as they are returned from executing this operation.', }, - 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: OpenAPI30, }, { label: 'responses', @@ -186,7 +171,7 @@ const completion: ApidomCompletionItem[] = [ value: '[Responses Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#responsesObject)\n\\\n\\\nThe list of possible responses as they are returned from executing this operation.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'callbacks', @@ -200,12 +185,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Map[`string`, [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callbackObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)]]\n\\\n\\\nA map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callbackObject) that describes a request that may be initiated by the API provider and the expected responses.', }, - 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: OpenAPI30, }, { label: 'callbacks', @@ -219,7 +199,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Map[`string`, [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callbackObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)]]\n\\\n\\\nA map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callbackObject) that describes a request that may be initiated by the API provider and the expected responses.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'deprecated', @@ -233,6 +213,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`.', }, + targetSpecs: OpenAPI3, }, { label: 'security', @@ -246,12 +227,7 @@ const completion: ApidomCompletionItem[] = [ value: '[[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject)]\n\\\n\\\nA declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. To make security optional, an empty security requirement (`{}`) can be included in the array. This definition overrides any declared top-level [`security`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oasSecurity). To remove a top-level security declaration, an empty array can be used.', }, - 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: OpenAPI30, }, { label: 'security', @@ -265,7 +241,7 @@ const completion: ApidomCompletionItem[] = [ value: '[[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject)]\n\\\n\\\nA declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. To make security optional, an empty security requirement (`{}`) can be included in the array. This definition overrides any declared top-level [`security`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oasSecurity). To remove a top-level security declaration, an empty array can be used.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'servers', @@ -279,12 +255,7 @@ const completion: ApidomCompletionItem[] = [ 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 this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value.', }, - 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: OpenAPI30, }, { label: 'servers', @@ -298,7 +269,7 @@ const completion: ApidomCompletionItem[] = [ 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 this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/operation/documentation.ts b/packages/apidom-ls/src/config/openapi/operation/documentation.ts index ed146369e3..2cc85278e5 100644 --- a/packages/apidom-ls/src/config/openapi/operation/documentation.ts +++ b/packages/apidom-ls/src/config/openapi/operation/documentation.ts @@ -1,3 +1,5 @@ +import { OpenAPI30, OpenAPI31, OpenAPI3 } from '../target-specs'; + /** * Omitted fixed fields: * - externalDocs @@ -13,110 +15,85 @@ const documentation = [ { target: 'tags', docs: '[`string`]\n\\\n\\\nA list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.', + targetSpecs: OpenAPI3, }, { target: 'summary', docs: 'A short summary of what the operation does.', + targetSpecs: OpenAPI3, }, { target: 'description', docs: 'A verbose explanation of the operation behavior. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.', + targetSpecs: OpenAPI3, }, { target: 'operationId', docs: 'Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is **case-sensitive**. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions.', + targetSpecs: OpenAPI3, }, { target: 'parameters', docs: "[[Parameter Object](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 this operation. If a parameter is already defined at the [Path Item](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathItemParameters), the new definition will override it but can never remove it. 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.0.0' }, - { namespace: 'openapi', version: '3.0.1' }, - { namespace: 'openapi', version: '3.0.2' }, - { namespace: 'openapi', version: '3.0.3' }, - ], + targetSpecs: OpenAPI30, }, { target: 'parameters', docs: "[[Parameter Object](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 this operation. If a parameter is already defined at the [Path Item](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemParameters), the new definition will override it but can never remove it. 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).", - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'requestBody', docs: '[Request Body Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#requestBodyObject) \\| [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)\n\\\n\\\nThe request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers.', - 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: OpenAPI30, }, { target: 'requestBody', docs: '[[Request Body Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#requestBodyObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)]\n\\\n\\\nThe request body applicable for this operation. The requestBody is fully supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague (such as [GET](https://tools.ietf.org/html/rfc7231#section-4.3.1), [HEAD](https://tools.ietf.org/html/rfc7231#section-4.3.2) and [DELETE](https://tools.ietf.org/html/rfc7231#section-4.3.5)), `requestBody` is permitted but does not have well-defined semantics and SHOULD be avoided if possible.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'callbacks', docs: 'Map[`string`, [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callbackObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)]]\n\\\n\\\nA map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callbackObject) that describes a request that may be initiated by the API provider and the expected responses.', - 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: OpenAPI30, }, { target: 'callbacks', docs: 'Map[`string`, [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callbackObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)]]\n\\\n\\\nA map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callbackObject) that describes a request that may be initiated by the API provider and the expected responses.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'deprecated', docs: 'Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`.', + targetSpecs: OpenAPI3, }, { target: 'security', docs: '[[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject)]\n\\\n\\\nA declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. To make security optional, an empty security requirement (`{}`) can be included in the array. This definition overrides any declared top-level [`security`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oasSecurity). To remove a top-level security declaration, an empty array can be used.', - 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: OpenAPI30, }, { target: 'security', docs: '[[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject)]\n\\\n\\\nA declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. To make security optional, an empty security requirement (`{}`) can be included in the array. This definition overrides any declared top-level [`security`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oasSecurity). To remove a top-level security declaration, an empty array can be used.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'servers', docs: '[[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject)]\n\\\n\\\nAn alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value.', - 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: OpenAPI30, }, { target: 'servers', docs: '[[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject)]\n\\\n\\\nAn alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { docs: '#### [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operation-object)\n\nDescribes a single API operation on a path.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ntags | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.\nsummary | `string` | A short summary of what the operation does.\ndescription | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.\nexternalDocs | [External Documentation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#externalDocumentationObject) | Additional external documentation for this operation.\noperationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is **case-sensitive**. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions.\nparameters | [[Parameter Object](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)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathItemParameters), the new definition will override it but can never remove it. 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](#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).\nrequestBody | [Request Body Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#requestBodyObject) \\| [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers.\nresponses | [Responses Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#responsesObject) | **REQUIRED**. The list of possible responses as they are returned from executing this operation.\ncallbacks | Map[`string`, [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callbackObject) \\| [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)] | A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callbackObject) that describes a request that may be initiated by the API provider and the expected responses.\ndeprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`.\nsecurity | [[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. To make security optional, an empty security requirement (`{}`) can be included in the array. This definition overrides any declared top-level [`security`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oasSecurity). To remove a top-level security declaration, an empty array can be used.\nservers | [[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject)] | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value.\n\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions).\n\n##### Operation Object Example\n\n\n\\\nJSON\n```json\n{\n "tags": [\n "pet"\n ],\n "summary": "Updates a pet in the store with form data",\n "operationId": "updatePetWithForm",\n "parameters": [\n {\n "name": "petId",\n "in": "path",\n "description": "ID of pet that needs to be updated",\n "required": true,\n "schema": {\n "type": "string"\n }\n }\n ],\n "requestBody": {\n "content": {\n "application/x-www-form-urlencoded": {\n "schema": {\n "type": "object",\n "properties": {\n "name": {\n "description": "Updated name of the pet",\n "type": "string"\n },\n "status": {\n "description": "Updated status of the pet",\n "type": "string"\n }\n },\n "required": ["status"]\n }\n }\n }\n },\n "responses": {\n "200": {\n "description": "Pet updated.",\n "content": {\n "application/json": {},\n "application/xml": {}\n }\n },\n "405": {\n "description": "Method Not Allowed",\n "content": {\n "application/json": {},\n "application/xml": {}\n }\n }\n },\n "security": [\n {\n "petstore_auth": [\n "write:pets",\n "read:pets"\n ]\n }\n ]\n}\n```\n\n\n\\\nYAML\n```yaml\ntags:\n- pet\nsummary: Updates a pet in the store with form data\noperationId: updatePetWithForm\nparameters:\n- name: petId\n in: path\n description: ID of pet that needs to be updated\n required: true\n schema:\n type: string\nrequestBody:\n content:\n \'application/x-www-form-urlencoded\':\n schema:\n properties:\n name:\n description: Updated name of the pet\n type: string\n status:\n description: Updated status of the pet\n type: string\n required:\n - status\nresponses:\n \'200\':\n description: Pet updated.\n content:\n \'application/json\': {}\n \'application/xml\': {}\n \'405\':\n description: Method Not Allowed\n content:\n \'application/json\': {}\n \'application/xml\': {}\nsecurity:\n- petstore_auth:\n - write:pets\n - read:pets\n```', - 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: OpenAPI30, }, { docs: '#### [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject)\n\nDescribes a single API operation on a path.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ntags | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.\nsummary | `string` | A short summary of what the operation does.\ndescription | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.\texternalDocs | [External Documentation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#externalDocumentationObject) | Additional external documentation for this operation.\noperationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is **case-sensitive**. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions.\nparameters | [[Parameter Object](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)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemParameters), the new definition will override it but can never remove it. 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).\nrequestBody | [[Request Body Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#requestBodyObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)] | The request body applicable for this operation. The requestBody is fully supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague (such as [GET](https://tools.ietf.org/html/rfc7231#section-4.3.1), [HEAD](https://tools.ietf.org/html/rfc7231#section-4.3.2) and [DELETE](https://tools.ietf.org/html/rfc7231#section-4.3.5)), `requestBody` is permitted but does not have well-defined semantics and SHOULD be avoided if possible.\nresponses | [Responses Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#responsesObject) | The list of possible responses as they are returned from executing this operation.\ncallbacks | Map[`string`, [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callbackObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)]] | A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callbackObject) that describes a request that may be initiated by the API provider and the expected responses.\ndeprecated |`boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`.\nsecurity | [[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. To make security optional, an empty security requirement (`{}`) can be included in the array. This definition overrides any declared top-level [`security`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oasSecurity). To remove a top-level security declaration, an empty array can be used.\nservers | [[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject)] | An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value.\n\n\\\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions).\n\n##### Operation Object Example\n\n\n\\\nJSON\n```json\n{\n "tags": [\n "pet"\n ],\n "summary": "Updates a pet in the store with form data",\n "operationId": "updatePetWithForm",\n "parameters": [\n {\n "name": "petId",\n "in": "path",\n "description": "ID of pet that needs to be updated",\n "required": true,\n "schema": {\n "type": "string"\n }\n }\n ],\n "requestBody": {\n "content": {\n "application/x-www-form-urlencoded": {\n "schema": {\n "type": "object",\n "properties": {\n "name": {\n "description": "Updated name of the pet",\n "type": "string"\n },\n "status": {\n "description": "Updated status of the pet",\n "type": "string"\n }\n },\n "required": ["status"]\n }\n }\n }\n },\n "responses": {\n "200": {\n "description": "Pet updated.",\n "content": {\n "application/json": {},\n "application/xml": {}\n }\n },\n "405": {\n "description": "Method Not Allowed",\n "content": {\n "application/json": {},\n "application/xml": {}\n }\n }\n },\n "security": [\n {\n "petstore_auth": [\n "write:pets",\n "read:pets"\n ]\n }\n ]\n}\n```\n\n\n\\\nYAML\n```yaml\ntags:\n- pet\nsummary: Updates a pet in the store with form data\noperationId: updatePetWithForm\nparameters:\n- name: petId\n in: path\n description: ID of pet that needs to be updated\n required: true\n schema:\n type: string\nrequestBody:\n content:\n \'application/x-www-form-urlencoded\':\n schema:\n type: object\n properties:\n name:\n description: Updated name of the pet\n type: string\n status:\n description: Updated status of the pet\n type: string\n required:\n - status\nresponses:\n \'200\':\n description: Pet updated.\n content:\n \'application/json\': {}\n \'application/xml\': {}\n \'405\':\n description: Method Not Allowed\n content:\n \'application/json\': {}\n \'application/xml\': {}\nsecurity:\n- petstore_auth:\n - write: pets\n - read:pets\n```\n', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/allowed-fields.ts b/packages/apidom-ls/src/config/openapi/operation/lint/allowed-fields.ts index c5aa9cc622..18ff42a4b9 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/allowed-fields.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/allowed-fields.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const allowedFieldsLint: LinterMeta = { code: ApilintCodes.NOT_ALLOWED_FIELDS, @@ -27,6 +28,7 @@ const allowedFieldsLint: LinterMeta = { 'x-', ], marker: 'key', + targetSpecs: OpenAPI3, }; export default allowedFieldsLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/callbacks--values-type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/callbacks--values-type.ts index d0453df96f..acb2c67e28 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/callbacks--values-type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/callbacks--values-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const callbacksValuesTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_CALLBACKS_VALUES_TYPE, @@ -14,6 +15,7 @@ const callbacksValuesTypeLint: LinterMeta = { markerTarget: 'callbacks', target: 'callbacks', data: {}, + targetSpecs: OpenAPI3, }; export default callbacksValuesTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/deprecated--type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/deprecated--type.ts index 9ce0963715..323047ae4a 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/deprecated--type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/deprecated--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const deprecatedTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_DEPRECATED_TYPE, @@ -13,6 +14,7 @@ const deprecatedTypeLint: LinterMeta = { marker: 'value', target: 'deprecated', data: {}, + targetSpecs: OpenAPI3, }; export default deprecatedTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/description--type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/description--type.ts index 802edf666f..a8a8fe33e8 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/description--type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/description--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const descriptionTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_DESCRIPTION_TYPE, @@ -13,6 +14,7 @@ const descriptionTypeLint: LinterMeta = { marker: 'value', target: 'description', data: {}, + targetSpecs: OpenAPI3, }; export default descriptionTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/external-docs--type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/external-docs--type.ts index 03d48aed08..5793166d94 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/external-docs--type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/external-docs--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const externalDocsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_EXTERNAL_DOCS_TYPE, @@ -13,6 +14,7 @@ const externalDocsTypeLint: LinterMeta = { marker: 'value', target: 'externalDocs', data: {}, + targetSpecs: OpenAPI3, }; export default externalDocsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/operation-id--type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/operation-id--type.ts index 1bfe5fccc0..2611302607 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/operation-id--type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/operation-id--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const operationIdTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_OPERATION_ID_TYPE, @@ -13,6 +14,7 @@ const operationIdTypeLint: LinterMeta = { marker: 'value', target: 'operationId', data: {}, + targetSpecs: OpenAPI3, }; export default operationIdTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/operation-id--unique.ts b/packages/apidom-ls/src/config/openapi/operation/lint/operation-id--unique.ts index 66b3615374..fd7b732b3e 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/operation-id--unique.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/operation-id--unique.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const operationIdUniqueLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_OPERATION_ID_UNIQUE, @@ -14,6 +15,7 @@ const operationIdUniqueLint: LinterMeta = { markerTarget: 'operationId', target: 'operationId', data: {}, + targetSpecs: OpenAPI3, }; export default operationIdUniqueLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/parameters--items-type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/parameters--items-type.ts index c47d7cc7db..5e32db4d9e 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/parameters--items-type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/parameters--items-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const parametersItemsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_PARAMETERS_ITEMS_TYPE, @@ -13,6 +14,7 @@ const parametersItemsTypeLint: LinterMeta = { marker: 'key', target: 'parameters', data: {}, + targetSpecs: OpenAPI3, }; export default parametersItemsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/parameters--type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/parameters--type.ts index ef086da462..dcb9672c28 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/parameters--type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/parameters--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const parametersTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_PARAMETERS_TYPE, @@ -13,6 +14,7 @@ const parametersTypeLint: LinterMeta = { marker: 'value', target: 'parameters', data: {}, + targetSpecs: OpenAPI3, }; export default parametersTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/request-body--allowed.ts b/packages/apidom-ls/src/config/openapi/operation/lint/request-body--allowed.ts index b09b543ccd..cb04150eb2 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/request-body--allowed.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/request-body--allowed.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const requestBodyAllowedLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_REQUEST_BODY_ALLOWED, @@ -14,6 +15,7 @@ const requestBodyAllowedLint: LinterMeta = { markerTarget: 'requestBody', target: 'requestBody', data: {}, + targetSpecs: OpenAPI3, }; export default requestBodyAllowedLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/request-body--tentatively-allowed.ts b/packages/apidom-ls/src/config/openapi/operation/lint/request-body--tentatively-allowed.ts index a7d2759c3e..bcd1979e36 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/request-body--tentatively-allowed.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/request-body--tentatively-allowed.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const requestBodyTentativelyAllowedLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_REQUEST_BODY_TENTATIVELY_ALLOWED, @@ -14,6 +15,7 @@ const requestBodyTentativelyAllowedLint: LinterMeta = { markerTarget: 'requestBody', target: 'requestBody', data: {}, + targetSpecs: OpenAPI3, }; export default requestBodyTentativelyAllowedLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/request-body--type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/request-body--type.ts index c4d8bc9251..5d8a7a2b09 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/request-body--type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/request-body--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const requestBodyTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_REQUEST_BODY_TYPE, @@ -13,6 +14,7 @@ const requestBodyTypeLint: LinterMeta = { marker: 'value', target: 'requestBody', data: {}, + targetSpecs: OpenAPI3, }; export default requestBodyTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/responses--type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/responses--type.ts index 8084774992..7f891f7c67 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/responses--type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/responses--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const responsesTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_RESPONSES_TYPE, @@ -13,6 +14,7 @@ const responsesTypeLint: LinterMeta = { marker: 'value', target: 'responses', data: {}, + targetSpecs: OpenAPI3, }; export default responsesTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/responses-3-0--required.ts b/packages/apidom-ls/src/config/openapi/operation/lint/responses-3-0--required.ts index 7aa6503d21..7ecb3aa920 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/responses-3-0--required.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/responses-3-0--required.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const responsesRequired3_0Lint: LinterMeta = { @@ -22,12 +23,7 @@ const responsesRequired3_0Lint: LinterMeta = { }, ], }, - 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: OpenAPI30, }; export default responsesRequired3_0Lint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/security--items-type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/security--items-type.ts index 37253e8853..8277c44e5d 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/security--items-type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/security--items-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const securityItemsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_SECURITY_VALUES_TYPE, @@ -13,6 +14,7 @@ const securityItemsTypeLint: LinterMeta = { marker: 'key', target: 'security', data: {}, + targetSpecs: OpenAPI3, }; export default securityItemsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/security--type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/security--type.ts index 8ec21969d3..5023922daf 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/security--type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/security--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const securityTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_SECURITY_TYPE, @@ -13,6 +14,7 @@ const securityTypeLint: LinterMeta = { marker: 'value', target: 'security', data: {}, + targetSpecs: OpenAPI3, }; export default securityTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/servers--items-type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/servers--items-type.ts index 89ba969d12..23e4214b90 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/servers--items-type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/servers--items-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const serverItemsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_SERVERS_ITEMS_TYPE, @@ -13,6 +14,7 @@ const serverItemsTypeLint: LinterMeta = { marker: 'key', target: 'servers', data: {}, + targetSpecs: OpenAPI3, }; export default serverItemsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/servers--type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/servers--type.ts index db6813bd53..e1bc612966 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/servers--type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/servers--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const serversTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_SERVERS_TYPE, @@ -13,6 +14,7 @@ const serversTypeLint: LinterMeta = { marker: 'value', target: 'servers', data: {}, + targetSpecs: OpenAPI3, }; export default serversTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/summary--type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/summary--type.ts index 56f56911fa..4c4136918e 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/summary--type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/summary--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const summaryTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_SUMMARY_TYPE, @@ -13,6 +14,7 @@ const summaryTypeLint: LinterMeta = { marker: 'value', target: 'summary', data: {}, + targetSpecs: OpenAPI3, }; export default summaryTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/operation/lint/tags--type.ts b/packages/apidom-ls/src/config/openapi/operation/lint/tags--type.ts index 75c646bb83..41b62fbc20 100644 --- a/packages/apidom-ls/src/config/openapi/operation/lint/tags--type.ts +++ b/packages/apidom-ls/src/config/openapi/operation/lint/tags--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const tagsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_OPERATION_FIELD_TAGS_TYPE, @@ -13,6 +14,7 @@ const tagsTypeLint: LinterMeta = { marker: 'key', target: 'tags', data: {}, + targetSpecs: OpenAPI3, }; export default tagsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/completion.ts b/packages/apidom-ls/src/config/openapi/parameter/completion.ts index e9fed2c370..b04d74e3e7 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/completion.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/completion.ts @@ -3,6 +3,7 @@ import { CompletionFormat, CompletionType, } from '../../../apidom-language-types'; +import { OpenAPI30, OpenAPI31, OpenAPI3 } from '../target-specs'; const completion: ApidomCompletionItem[] = [ { @@ -16,6 +17,7 @@ const completion: ApidomCompletionItem[] = [ kind: 'markdown', value: 'A reference to a Parameter.', }, + targetSpecs: OpenAPI3, }, { label: 'name', @@ -29,12 +31,7 @@ const completion: ApidomCompletionItem[] = [ value: '**REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.\n\n * If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn) is `"path"`, the `name` field MUST correspond to a template expression occurring within the [path](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsPath) field in the [Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsObject). See [Path Templating](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathTemplating) for further information.\n\n * If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.\n\n * For all other cases, the `name` corresponds to the parameter name used by the [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn) property.', }, - 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: OpenAPI30, }, { label: 'name', @@ -48,7 +45,7 @@ const completion: ApidomCompletionItem[] = [ value: '**REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.\n\n * If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn) is `"path"`, the `name` field MUST correspond to a template expression occurring within the [path](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsPath) field in the [Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsObject). See [Path Templating](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathTemplating) for further information.\n\n * If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.\n\n * For all other cases, the `name` corresponds to the parameter name used by the [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn) property.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'in', @@ -62,6 +59,7 @@ const completion: ApidomCompletionItem[] = [ value: '**REQUIRED**. The location of the parameter. Possible values are `"query"`, `"header"`, `"path"` or `"cookie"`.', }, + targetSpecs: OpenAPI3, }, { label: 'description', @@ -75,6 +73,7 @@ const completion: ApidomCompletionItem[] = [ value: 'A brief description of the parameter. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.', }, + targetSpecs: OpenAPI3, }, { label: 'required', @@ -88,12 +87,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Determines whether this parameter is mandatory. If the [parameter location](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn) is `"path"`, this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`.', }, - 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: OpenAPI30, }, { label: 'required', @@ -107,7 +101,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Determines whether this parameter is mandatory. If the [parameter location](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn) is `"path"`, this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'deprecated', @@ -121,6 +115,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is `false`.', }, + targetSpecs: OpenAPI3, }, { label: 'allowEmptyValue', @@ -134,12 +129,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.', }, - 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: OpenAPI30, }, { label: 'allowEmptyValue', @@ -153,7 +143,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'style', @@ -167,6 +157,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`.', }, + targetSpecs: OpenAPI3, }, { label: 'explode', @@ -180,12 +171,7 @@ const completion: ApidomCompletionItem[] = [ value: 'When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`.', }, - 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: OpenAPI30, }, { label: 'explode', @@ -199,7 +185,7 @@ const completion: ApidomCompletionItem[] = [ value: 'When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'allowReserved', @@ -213,6 +199,7 @@ const completion: ApidomCompletionItem[] = [ value: "Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent - encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`.", }, + targetSpecs: OpenAPI3, }, { label: 'schema', @@ -226,12 +213,7 @@ const completion: ApidomCompletionItem[] = [ value: '[Schema Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schemaObject) \\| [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)\n\\\n\\\nThe schema defining the type used for the parameter.', }, - 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: OpenAPI30, }, { label: 'schema', @@ -245,7 +227,7 @@ const completion: ApidomCompletionItem[] = [ value: '[Schema Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schemaObject)\n\\\n\\\nThe schema defining the type used for the parameter.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'example', @@ -259,6 +241,7 @@ const completion: ApidomCompletionItem[] = [ value: "Example of the parameter's potential value. The example SHOULD match the specified schema and encoding properties if present. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` that contains an example, the `example` value SHALL *override* the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.", }, + targetSpecs: OpenAPI3, }, { label: 'examples', @@ -272,12 +255,7 @@ const completion: ApidomCompletionItem[] = [ value: "Map[`string`, [Example Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#exampleObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)]\n\\\n\\\nExamples of the parameter's potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` that contains an example, the `examples` value SHALL *override* the example provided by the schema", }, - 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: OpenAPI30, }, { label: 'examples', @@ -291,7 +269,7 @@ const completion: ApidomCompletionItem[] = [ value: "Map[`string`, [Example Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#exampleObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)]\n\\\n\\\nExamples of the parameter's potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` that contains an example, the `examples` value SHALL *override* the example provided by the schema", }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'content', @@ -305,12 +283,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Map[`string`, [Media Type Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#mediaTypeObject)]\n\\\n\\\nA map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.', }, - 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: OpenAPI30, }, { label: 'content', @@ -324,7 +297,7 @@ const completion: ApidomCompletionItem[] = [ value: 'Map[`string`, [Media Type Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#mediaTypeObject)]\n\\\n\\\nA map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'in', @@ -334,6 +307,7 @@ const completion: ApidomCompletionItem[] = [ format: CompletionFormat.QUOTED, type: CompletionType.VALUE, insertTextFormat: 2, + targetSpecs: OpenAPI3, }, { target: 'in', @@ -343,6 +317,7 @@ const completion: ApidomCompletionItem[] = [ format: CompletionFormat.QUOTED, type: CompletionType.VALUE, insertTextFormat: 2, + targetSpecs: OpenAPI3, }, { target: 'in', @@ -352,6 +327,7 @@ const completion: ApidomCompletionItem[] = [ format: CompletionFormat.QUOTED, type: CompletionType.VALUE, insertTextFormat: 2, + targetSpecs: OpenAPI3, }, { target: 'in', @@ -361,6 +337,7 @@ const completion: ApidomCompletionItem[] = [ format: CompletionFormat.QUOTED, type: CompletionType.VALUE, insertTextFormat: 2, + targetSpecs: OpenAPI3, }, { target: 'style', @@ -370,6 +347,7 @@ const completion: ApidomCompletionItem[] = [ format: CompletionFormat.QUOTED, type: CompletionType.VALUE, insertTextFormat: 2, + targetSpecs: OpenAPI3, }, { target: 'style', @@ -379,6 +357,7 @@ const completion: ApidomCompletionItem[] = [ format: CompletionFormat.QUOTED, type: CompletionType.VALUE, insertTextFormat: 2, + targetSpecs: OpenAPI3, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/parameter/documentation.ts b/packages/apidom-ls/src/config/openapi/parameter/documentation.ts index 6f0fb6a83a..e7e6658be9 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/documentation.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/documentation.ts @@ -1,3 +1,5 @@ +import { OpenAPI30, OpenAPI31, OpenAPI3 } from '../target-specs'; + /** * Omitted fixed fields: * - schema @@ -12,133 +14,105 @@ const documentation = [ { target: '$ref', docs: 'A reference to a Parameter.', + targetSpecs: OpenAPI3, }, { target: 'name', docs: '**REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.\n\n * If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn) is `"path"`, the `name` field MUST correspond to a template expression occurring within the [path](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsPath) field in the [Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsObject). See [Path Templating](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathTemplating) for further information.\n\n * If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.\n\n * For all other cases, the `name` corresponds to the parameter name used by the [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn) property.', - 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: OpenAPI30, }, { target: 'name', docs: '**REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.\n\n * If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn) is `"path"`, the `name` field MUST correspond to a template expression occurring within the [path](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsPath) field in the [Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsObject). See [Path Templating](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathTemplating) for further information.\n\n * If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.\n\n * For all other cases, the `name` corresponds to the parameter name used by the [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn) property.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'in', docs: '**REQUIRED**. The location of the parameter. Possible values are `"query"`, `"header"`, `"path"` or `"cookie"`.', + targetSpecs: OpenAPI3, }, { target: 'description', docs: 'A brief description of the parameter. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.', + targetSpecs: OpenAPI3, }, { target: 'required', docs: 'Determines whether this parameter is mandatory. If the [parameter location](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn) is `"path"`, this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`.', - 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: OpenAPI30, }, { target: 'required', docs: 'Determines whether this parameter is mandatory. If the [parameter location](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn) is `"path"`, this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'deprecated', docs: 'Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is `false`.', + targetSpecs: OpenAPI3, }, { target: 'allowEmptyValue', docs: 'Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.', - 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: OpenAPI30, }, { target: 'allowEmptyValue', docs: 'Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'style', docs: 'Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`.', + targetSpecs: OpenAPI3, }, { target: 'explode', docs: 'When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`.', - 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: OpenAPI30, }, { target: 'explode', docs: 'When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'allowReserved', docs: "Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent - encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`.", + targetSpecs: OpenAPI3, }, { target: 'example', docs: "Example of the parameter's potential value. The example SHOULD match the specified schema and encoding properties if present. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` that contains an example, the `example` value SHALL *override* the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.", + targetSpecs: OpenAPI3, }, { target: 'examples', docs: "Map[`string`, [Example Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#exampleObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)]\n\\\n\\\nExamples of the parameter's potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` that contains an example, the `examples` value SHALL *override* the example provided by the schema", - 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: OpenAPI30, }, { target: 'examples', docs: "Map[`string`, [Example Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#exampleObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)]\n\\\n\\\nExamples of the parameter's potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` that contains an example, the `examples` value SHALL *override* the example provided by the schema", - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'content', docs: 'Map[`string`, [Media Type Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#mediaTypeObject)]\n\\\n\\\nA map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.', - 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: OpenAPI30, }, { target: 'content', docs: 'Map[`string`, [Media Type Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#mediaTypeObject)]\n\\\n\\\nA map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { docs: '#### [Parameter Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterObject)\n\nDescribes a single operation parameter.\n\nA 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).\n\n##### Parameter Locations\nThere are four possible parameter locations specified by the `in` field:\n* path - Used together with [Path Templating](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathTemplating), where the parameter value is actually part of the operation\'s URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`.\n* query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`.\n* header - Custom headers that are expected as part of the request. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive.\n* cookie - Used to pass a specific cookie value to the API.\n\n\n##### Fixed Fields\nField Name | Type | Description\n---|:---:|---\nname | `string` | **REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.\n  |   | * If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn) is `"path"`, the `name` field MUST correspond to a template expression occurring within the [path](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsPath) field in the [Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsObject). See [Path Templating](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathTemplating) for further information.\n  |   | * If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.\n  |   | * For all other cases, the `name` corresponds to the parameter name used by the [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn) property.\nin | `string` | **REQUIRED**. The location of the parameter. Possible values are `"query"`, `"header"`, `"path"` or `"cookie"`.\ndescription | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.\nrequired | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterIn) is `"path"`, this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`.\ndeprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is `false`.\nallowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.\n\nThe rules for serialization of the parameter are specified in one of two ways.\nFor simpler scenarios, a [`schema`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterSchema) and [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterStyle) can describe the structure and syntax of the parameter.\n\nField Name | Type | Description\n---|:---:|---\nstyle | `string` | Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`.\nexplode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`.\nallowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&\'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`.\nschema | [Schema Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schemaObject) | The schema defining the type used for the parameter.\nexample | Any | Example of the parameter\'s potential value. The example SHOULD match the specified schema and encoding properties if present. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` that contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.\nexamples | Map[ `string`, [Example Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#exampleObject) \\| [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)] | Examples of the parameter\'s potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` that contains an example, the `examples` value SHALL _override_ the example provided by the schema.\n\nFor more complex scenarios, the [`content`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterContent) property can define the media type and schema of the parameter.\nA parameter MUST contain either a `schema` property, or a `content` property, but not both.\nWhen `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the parameter.\n\n\nField Name | Type | Description\n---|:---:|---\ncontent | Map[`string`, [Media Type Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.\n\n##### [Style Values](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#style-values)\n\nIn order to support common ways of serializing simple parameters, a set of `style` values are defined.\n\n`style` | [`type`](#dataTypes) | `in` | Comments\n----------- | ------ | -------- | --------\nmatrix | `primitive`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7)\nlabel | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5)\nform | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` with a `csv` (when `explode` is false) or `multi` (when `explode` is true) value from OpenAPI 2.0.\nsimple | `array` | `path`, `header` | Simple style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.2). This option replaces `collectionFormat` with a `csv` value from OpenAPI 2.0.\nspaceDelimited | `array`, `object` | `query` | Space separated array or object values. This option replaces `collectionFormat` equal to `ssv` from OpenAPI 2.0.\npipeDelimited | `array`, `object` | `query` | Pipe separated array or object values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0.\ndeepObject | `object` | `query` | Provides a simple way of rendering nested objects using form parameters.\n\n\n##### Style Examples\n\nAssume a parameter named `color` has one of the following values:\n\n```\n string -> "blue"\n array -> ["blue","black","brown"]\n object -> { "R": 100, "G": 200, "B": 150 }\n```\nThe following table shows examples of rendering differences for each value.\n\n[`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#styleValues) | `explode` | `empty` | `string` | `array` | `object`\n----------- | ------ | -------- | -------- | -------- | -------\nmatrix | false | ;color | ;color=blue | ;color=blue,black,brown | ;color=R,100,G,200,B,150\nmatrix | true | ;color | ;color=blue | ;color=blue;color=black;color=brown | ;R=100;G=200;B=150\nlabel | false | . | .blue | .blue.black.brown | .R.100.G.200.B.150\nlabel | true | . | .blue | .blue.black.brown | .R=100.G=200.B=150\nform | false | color= | color=blue | color=blue,black,brown | color=R,100,G,200,B,150\nform | true | color= | color=blue | color=blue&color=black&color=brown | R=100&G=200&B=150\nsimple | false | n/a | blue | blue,black,brown | R,100,G,200,B,150\nsimple | true | n/a | blue | blue,black,brown | R=100,G=200,B=150\nspaceDelimited | false | n/a | n/a | blue%20black%20brown | R%20100%20G%20200%20B%20150\npipeDelimited | false | n/a | n/a | blue\\|black\\|brown | R\\|100\\|G\\|200\\|B\\|150\ndeepObject | true | n/a | n/a | n/a | color[R]=100&color[G]=200&color[B]=150\n\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions).\n\n##### [Parameter Object Examples](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameter-object-examples#parameter-object-examples)\n\nA header parameter with an array of 64 bit integer numbers:\n\n\n\\\nJSON\n```json\n{\n "name": "token",\n "in": "header",\n "description": "token to be passed as a header",\n "required": true,\n "schema": {\n "type": "array",\n "items": {\n "type": "integer",\n "format": "int64"\n }\n },\n "style": "simple"\n}\n```\n\n\n\\\nYAML\n```yaml\nname: token\nin: header\ndescription: token to be passed as a header\nrequired: true\nschema:\n type: array\n items:\n type: integer\n format: int64\nstyle: simple\n```\n\nA path parameter of a string value:\n```json\n{\n "name": "username",\n "in": "path",\n "description": "username to fetch",\n "required": true,\n "schema": {\n "type": "string"\n }\n}\n```\n\n```yaml\nname: username\nin: path\ndescription: username to fetch\nrequired: true\nschema:\n type: string\n```\n\nAn optional query parameter of a string value, allowing multiple values by repeating the query parameter:\n```json\n{\n "name": "id",\n "in": "query",\n "description": "ID of the object to fetch",\n "required": false,\n "schema": {\n "type": "array",\n "items": {\n "type": "string"\n }\n },\n "style": "form",\n "explode": true\n}\n```\n\n```yaml\nname: id\nin: query\ndescription: ID of the object to fetch\nrequired: false\nschema:\n type: array\n items:\n type: string\nstyle: form\nexplode: true\n```\n\nA free-form query parameter, allowing undefined parameters of a specific type:\n```json\n{\n "in": "query",\n "name": "freeForm",\n "schema": {\n "type": "object",\n "additionalProperties": {\n "type": "integer"\n },\n },\n "style": "form"\n}\n```\n\n```yaml\nin: query\nname: freeForm\nschema:\n type: object\n additionalProperties:\n type: integer\nstyle: form\n```\n\nA complex parameter using `content` to define serialization:\n\n```json\n{\n "in": "query",\n "name": "coordinates",\n "content": {\n "application/json": {\n "schema": {\n "type": "object",\n "required": [\n "lat",\n "long"\n ],\n "properties": {\n "lat": {\n "type": "number"\n },\n "long": {\n "type": "number"\n }\n }\n }\n }\n }\n}\n```\n\n```yaml\nin: query\nname: coordinates\ncontent:\n application/json:\n schema:\n type: object\n required:\n - lat\n - long\n properties:\n lat:\n type: number\n long:\n type: number\n```', - 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: OpenAPI30, }, { docs: '#### [Parameter Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterObject)\n\nDescribes a single operation parameter.\n\nA 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).\n\n##### Parameter Locations\n\nThere are four possible parameter locations specified by the `in` field:\n\n* path - Used together with [Path Templating](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathTemplating), where the parameter value is actually part of the operations URL. This does not include the host or base path of the API. For example, in `/items/{ itemId}`, the path parameter is `itemId`.\n* query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`.\n* header - Custom headers that are expected as part of the request. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive.\n* cookie - Used to pass a specific cookie value to the API.\n\n##### Fixed Fields \n\nField Name | Type | Description\n---|:---:|---\nname | `string` | **REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.\n  |   | * If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn) is `"path"`, the `name` field MUST correspond to a template expression occurring within the [path](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsPath) field in the [Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsObject). See [Path Templating](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathTemplating) for further information.\n  |   | * If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.\n  |   | * For all other cases, the `name` corresponds to the parameter name used by the [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn) property.\nin | `string` | **REQUIRED**. The location of the parameter. Possible values are `"query"`, `"header"`, `"path"` or `"cookie"`.\ndescription | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.\nrequired | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn) is `"path"`, this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`.\ndeprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is `false`.\nallowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.\n\n\\\nThe rules for serialization of the parameter are specified in one of two ways. For simpler scenarios, a schema and style can describe the structure and syntax of the parameter.\n\nField Name | Type | Description\n---|:---:|---\nstyle | `string` | Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`.\nexplode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`.\nallowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&\'()*+,;=` to be included without percent - encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`.\nschema | [Schema Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schemaObject) | The schema defining the type used for the parameter.\nexample | Any | Example of the parameter\'s potential value. The example SHOULD match the specified schema and encoding properties if present. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` that contains an example, the `example` value SHALL *override* the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.\nexamples | Map[`string`, [Example Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#exampleObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)] | Examples of the parameter\'s potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` that contains an example, the `examples` value SHALL *override* the example provided by the schema.\n\n\\\nFor more complex scenarios, the [`content`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterContent) property can define the media type and schema of the parameter. A parameter MUST contain either a `schema` property, or a `content` property, but not both. When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the parameter.\n\nField Name | Type | Description\n---|:---:|---\ncontent | Map[`string`, [Media Type Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.\n\n##### Style Values\n\nIn order to support common ways of serializing simple parameters, a set of `style` values are defined.\n\n`style` | [`type`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#dataTypes) | `in` | Comments\n---|:---:|---:|---\nmatrix | `primitive`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7)\nlabel | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7)\nform | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` with a `csv` (when `explode` is false) or `multi` (when `explode` is true) value from OpenAPI 2.0.\nsimple | `array` | `path`, `header` | Simple style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` with a `csv` value from OpenAPI 2.0.\nspaceDelimited | `array`, `object` | `query` | Space separated array or object values. This option replaces `collectionFormat` equal to `ssv` from OpenAPI 2.0.\npipeDelimited | `array`, `object` | `query` | Pipe separated array or object values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0.\ndeepObject | `object` | `query` | Provides a simple way of rendering nested objects using form parameters.\n\n##### Examples\n\nExternal reference link to [Style Examples](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-examples)\n\nExternal reference link to [Parameter Object Examples](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object-examples)\n\n\\\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions).\n\n', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/allow-empty-value--type.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/allow-empty-value--type.ts index 008f82c576..fb3c0e4afc 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/allow-empty-value--type.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/allow-empty-value--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const allowEmptyValueTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_ALLOW_EMPTY_VALUE_TYPE, @@ -13,6 +14,7 @@ const allowEmptyValueTypeLint: LinterMeta = { marker: 'value', target: 'allowEmptyValue', data: {}, + targetSpecs: OpenAPI3, }; export default allowEmptyValueTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/allow-reserved--type.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/allow-reserved--type.ts index fe862fc463..e140d37a6e 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/allow-reserved--type.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/allow-reserved--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const allowReservedTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_ALLOW_RESERVED_TYPE, @@ -13,6 +14,7 @@ const allowReservedTypeLint: LinterMeta = { marker: 'value', target: 'allowReserved', data: {}, + targetSpecs: OpenAPI3, }; export default allowReservedTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/allowed-fields-3-0.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/allowed-fields-3-0.ts index 61dac13554..378ca329ea 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/allowed-fields-3-0.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/allowed-fields-3-0.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const allowedFields3_0Lint: LinterMeta = { @@ -30,12 +31,7 @@ const allowedFields3_0Lint: LinterMeta = { 'x-', ], marker: 'key', - 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: OpenAPI30, }; export default allowedFields3_0Lint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/allowed-fields-3-1.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/allowed-fields-3-1.ts index e664b0f453..605cf975cc 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/allowed-fields-3-1.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/allowed-fields-3-1.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const allowedFields3_1Lint: LinterMeta = { @@ -35,7 +36,7 @@ const allowedFields3_1Lint: LinterMeta = { params: ['$ref'], }, ], - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }; export default allowedFields3_1Lint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/content--allowed-fields-3-0.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/content--allowed-fields-3-0.ts index 29b4e3fb00..800280e891 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/content--allowed-fields-3-0.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/content--allowed-fields-3-0.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const contentAllowedFields3_0Lint: LinterMeta = { @@ -32,12 +33,7 @@ const contentAllowedFields3_0Lint: LinterMeta = { params: [['content']], }, ], - 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: OpenAPI30, }; export default contentAllowedFields3_0Lint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/content--allowed-fields-3-1.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/content--allowed-fields-3-1.ts index b7048872ac..02cb3b5b9c 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/content--allowed-fields-3-1.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/content--allowed-fields-3-1.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const contentAllowedFields3_1Lint: LinterMeta = { @@ -26,7 +27,7 @@ const contentAllowedFields3_1Lint: LinterMeta = { params: ['$ref'], }, ], - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }; export default contentAllowedFields3_1Lint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/content--values-type.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/content--values-type.ts index 256ab314fe..ca92c05ef2 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/content--values-type.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/content--values-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const contentValuesTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_CONTENT_VALUES_TYPE, @@ -14,6 +15,7 @@ const contentValuesTypeLint: LinterMeta = { markerTarget: 'content', target: 'content', data: {}, + targetSpecs: OpenAPI3, }; export default contentValuesTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/deprecated--type.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/deprecated--type.ts index 0588b0d3b1..89cb7693b0 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/deprecated--type.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/deprecated--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const deprecatedTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_DEPRECATED_TYPE, @@ -13,6 +14,7 @@ const deprecatedTypeLint: LinterMeta = { marker: 'value', target: 'deprecated', data: {}, + targetSpecs: OpenAPI3, }; export default deprecatedTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/description--type.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/description--type.ts index 1d8ae0b677..db3117d728 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/description--type.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/description--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const descriptionTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_DESCRIPTION_TYPE, @@ -13,6 +14,7 @@ const descriptionTypeLint: LinterMeta = { marker: 'value', target: 'description', data: {}, + targetSpecs: OpenAPI3, }; export default descriptionTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/examples--mutually-exclusive.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/examples--mutually-exclusive.ts index 065a4c3ccf..0383f5ebcd 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/examples--mutually-exclusive.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/examples--mutually-exclusive.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const examplesMutuallyExclusiveLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_EXAMPLES_MUTUALLY_EXCLUSIVE, @@ -18,6 +19,7 @@ const examplesMutuallyExclusiveLint: LinterMeta = { params: [['example']], }, ], + targetSpecs: OpenAPI3, }; export default examplesMutuallyExclusiveLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/examples--values-type.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/examples--values-type.ts index ff4a049fbc..ca5de9faa0 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/examples--values-type.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/examples--values-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const examplesValuesTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_EXAMPLES_VALUES_TYPE, @@ -14,6 +15,7 @@ const examplesValuesTypeLint: LinterMeta = { markerTarget: 'examples', target: 'examples', data: {}, + targetSpecs: OpenAPI3, }; export default examplesValuesTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/explode--type.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/explode--type.ts index d0ffac320e..a72c37926b 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/explode--type.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/explode--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const explodeTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_EXPLODE_TYPE, @@ -13,6 +14,7 @@ const explodeTypeLint: LinterMeta = { marker: 'value', target: 'explode', data: {}, + targetSpecs: OpenAPI3, }; export default explodeTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/in--required.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/in--required.ts index 4da24349fe..f942160252 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/in--required.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/in--required.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const inRequiredLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_IN_REQUIRED, @@ -27,6 +28,7 @@ const inRequiredLint: LinterMeta = { params: ['$ref'], }, ], + targetSpecs: OpenAPI3, }; export default inRequiredLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/in--type.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/in--type.ts index e1c454843c..346bbefb97 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/in--type.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/in--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const inTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_IN_TYPE, @@ -13,6 +14,7 @@ const inTypeLint: LinterMeta = { marker: 'value', target: 'in', data: {}, + targetSpecs: OpenAPI3, }; export default inTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/name--required.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/name--required.ts index 9429471a6c..6f5c3056c8 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/name--required.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/name--required.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const nameRequiredLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_NAME_REQUIRED, @@ -27,6 +28,7 @@ const nameRequiredLint: LinterMeta = { params: ['$ref'], }, ], + targetSpecs: OpenAPI3, }; export default nameRequiredLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/name--type.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/name--type.ts index 7e8746c2bb..9bbd21b85f 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/name--type.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/name--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const nameTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_NAME_TYPE, @@ -13,6 +14,7 @@ const nameTypeLint: LinterMeta = { marker: 'value', target: 'name', data: {}, + targetSpecs: OpenAPI3, }; export default nameTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/required--equals.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/required--equals.ts index 291572f92f..7f9ba6b79b 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/required--equals.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/required--equals.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const requiredEqualsLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_REQUIRED_EQUALS, @@ -20,6 +21,7 @@ const requiredEqualsLint: LinterMeta = { }, ], data: {}, + targetSpecs: OpenAPI3, }; export default requiredEqualsLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/required--required.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/required--required.ts index 740cdd3699..ee2cfff42c 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/required--required.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/required--required.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const requiredRequiredLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_REQUIRED_REQUIRED, @@ -32,6 +33,7 @@ const requiredRequiredLint: LinterMeta = { }, ], }, + targetSpecs: OpenAPI3, }; export default requiredRequiredLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/required--type.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/required--type.ts index 2334b8859b..eaaed8b1a5 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/required--type.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/required--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const requiredTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_REQUIRED_TYPE, @@ -13,6 +14,7 @@ const requiredTypeLint: LinterMeta = { marker: 'value', target: 'required', data: {}, + targetSpecs: OpenAPI3, }; export default requiredTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/required-fields.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/required-fields.ts index b5f00a8d2e..e8ecd68804 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/required-fields.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/required-fields.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const requiredFieldsLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_REQUIRED_FIELDS, @@ -31,6 +32,7 @@ const requiredFieldsLint: LinterMeta = { }, ], }, + targetSpecs: OpenAPI3, }; export default requiredFieldsLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/schema--mutually-exclusive.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/schema--mutually-exclusive.ts index d15c64c6a7..3aea865aa5 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/schema--mutually-exclusive.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/schema--mutually-exclusive.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const schemaMutuallyExclusiveLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_SCHEMA_MUTUALLY_EXCLUSIVE, @@ -18,6 +19,7 @@ const schemaMutuallyExclusiveLint: LinterMeta = { params: [['content']], }, ], + targetSpecs: OpenAPI3, }; export default schemaMutuallyExclusiveLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/schema--type.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/schema--type.ts index 7282670ceb..448d4be9d5 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/schema--type.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/schema--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const schemaTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_SCHEMA_TYPE, @@ -13,6 +14,7 @@ const schemaTypeLint: LinterMeta = { marker: 'value', target: 'schema', data: {}, + targetSpecs: OpenAPI3, }; export default schemaTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/style--type.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/style--type.ts index e9d7ae05b6..726740b7d8 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/style--type.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/style--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const styleTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PARAMETER_FIELD_STYLE_TYPE, @@ -13,6 +14,7 @@ const styleTypeLint: LinterMeta = { marker: 'value', target: 'style', data: {}, + targetSpecs: OpenAPI3, }; export default styleTypeLint; 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 2f4e84bf8d..30130f9796 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/completion.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/completion.ts @@ -3,6 +3,7 @@ import { CompletionFormat, CompletionType, } from '../../../apidom-language-types'; +import { OpenAPI30, OpenAPI31, OpenAPI3 } from '../target-specs'; const completion: ApidomCompletionItem[] = [ { @@ -17,12 +18,7 @@ const completion: ApidomCompletionItem[] = [ 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.0.3.md#pathItemObject). In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined.', }, - 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: OpenAPI30, }, { label: '$ref', @@ -35,7 +31,7 @@ const completion: ApidomCompletionItem[] = [ kind: 'markdown', value: 'A reference to a Path Item', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'summary', @@ -48,6 +44,7 @@ const completion: ApidomCompletionItem[] = [ kind: 'markdown', value: 'An optional string summary, intended to apply to all operations in this path.', }, + targetSpecs: OpenAPI3, }, { label: 'description', @@ -61,6 +58,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, + targetSpecs: OpenAPI3, }, { label: 'get', @@ -74,12 +72,7 @@ const completion: ApidomCompletionItem[] = [ value: '[Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.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: OpenAPI30, }, { label: 'get', @@ -93,7 +86,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'put', @@ -107,12 +100,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - 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: OpenAPI30, }, { label: 'put', @@ -126,7 +114,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'post', @@ -140,12 +128,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - 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: OpenAPI30, }, { label: 'post', @@ -159,7 +142,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'delete', @@ -173,12 +156,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - 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: OpenAPI30, }, { label: 'delete', @@ -192,7 +170,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'options', @@ -206,12 +184,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - 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: OpenAPI30, }, { label: 'options', @@ -225,7 +198,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'head', @@ -239,12 +212,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - 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: OpenAPI30, }, { label: 'head', @@ -258,7 +226,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'patch', @@ -272,12 +240,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - 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: OpenAPI30, }, { label: 'patch', @@ -291,7 +254,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'trace', @@ -305,12 +268,7 @@ const completion: ApidomCompletionItem[] = [ 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' }, - ], + targetSpecs: OpenAPI30, }, { label: 'trace', @@ -324,7 +282,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'servers', @@ -338,12 +296,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - 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: OpenAPI30, }, { label: 'servers', @@ -357,7 +310,7 @@ const completion: ApidomCompletionItem[] = [ 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.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'parameters', @@ -371,12 +324,7 @@ const completion: ApidomCompletionItem[] = [ 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).", }, - 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: OpenAPI30, }, { label: 'parameters', @@ -390,7 +338,7 @@ const completion: ApidomCompletionItem[] = [ value: "[[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).", }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/path-item/documentation.ts b/packages/apidom-ls/src/config/openapi/path-item/documentation.ts index 52c82d1b0a..a088f4f47b 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/documentation.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/documentation.ts @@ -1,3 +1,5 @@ +import { OpenAPI30, OpenAPI31, OpenAPI3 } from '../target-specs'; + /** * Omitted fixed fields: * - get @@ -19,68 +21,50 @@ const documentation = [ { target: '$ref', docs: '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.0.3.md#pathItemObject). In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined.', - 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: OpenAPI30, }, { target: '$ref', docs: '**REQUIRED**. The reference identifier. This MUST be in the form of a URI.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'summary', docs: 'An optional string summary, intended to apply to all operations in this path.', + targetSpecs: OpenAPI3, }, { target: 'description', docs: '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.', + targetSpecs: OpenAPI3, }, { target: 'servers', docs: '[[ServerObject](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: OpenAPI31, }, { target: 'servers', docs: '[[ServerObject](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.0.0' }, - { namespace: 'openapi', version: '3.0.1' }, - { namespace: 'openapi', version: '3.0.2' }, - { namespace: 'openapi', version: '3.0.3' }, - ], + targetSpecs: OpenAPI30, }, { target: 'parameters', docs: "[[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.0.0' }, - { namespace: 'openapi', version: '3.0.1' }, - { namespace: 'openapi', version: '3.0.2' }, - { namespace: 'openapi', version: '3.0.3' }, - ], + targetSpecs: OpenAPI30, }, { target: 'parameters', docs: "[[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).", - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { docs: '#### [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#path-item-object)\n\nDescribes the operations available on a single path.\nA Path Item MAY be empty, due to [ACL constraints](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securityFiltering).\nThe path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\n$ref | `string` | 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.0.3.md#pathItemObject). In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined.\nsummary| `string` | An optional, string summary, intended to apply to all operations in this path.\ndescription | `string` | 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.\nget | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject) | A definition of a GET operation on this path.\nput | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject) | A definition of a PUT operation on this path.\npost | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject) | A definition of a POST operation on this path.\ndelete | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject) | A definition of a DELETE operation on this path.\noptions | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject) | A definition of a OPTIONS operation on this path.\nhead | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject) | A definition of a HEAD operation on this path.\npatch | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject) | A definition of a PATCH operation on this path.\ntrace | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject) | A definition of a TRACE operation on this path.\nservers | [[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject)] | An alternative `server` array to service all operations in this path.\nparameters | [[Parameter Object](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)] | A 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](#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).\n\n\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions).\n\n##### Path Item Object Example\n\n\n\\\nJSON\n```json\n{\n "get": {\n "description": "Returns pets based on ID",\n "summary": "Find pets by ID",\n "operationId": "getPetsById",\n "responses": {\n "200": {\n "description": "pet response",\n "content": {\n "*/*": {\n "schema": {\n "type": "array",\n "items": {\n "$ref": "#/components/schemas/Pet"\n }\n }\n }\n }\n },\n "default": {\n "description": "error payload",\n "content": {\n "text/html": {\n "schema": {\n "$ref": "#/components/schemas/ErrorModel"\n }\n }\n }\n }\n }\n },\n "parameters": [\n {\n "name": "id",\n "in": "path",\n "description": "ID of pet to use",\n "required": true,\n "schema": {\n "type": "array",\n "items": {\n "type": "string"\n }\n },\n "style": "simple"\n }\n ]\n}\n```\n\n\n\\\nYAML\n```yaml\nget:\n description: Returns pets based on ID\n summary: Find pets by ID\n operationId: getPetsById\n responses:\n \'200\':\n description: pet response\n content:\n \'*/*\' :\n schema:\n type: array\n items:\n $ref: \'#/components/schemas/Pet\'\n default:\n description: error payload\n content:\n \'text/html\':\n schema:\n $ref: \'#/components/schemas/ErrorModel\'\nparameters:\n- name: id\n in: path\n description: ID of pet to use\n required: true\n schema:\n type: array\n items:\n type: string\n style: simple\n```', - 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: OpenAPI30, }, { docs: '#### [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemObject)\n\nDescribes the operations available on a single path. A Path Item MAY be empty, due to [ACL constraints](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#securityFiltering). The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\n$ref | `string` | Allows for a referenced definition of this path item. The referenced structure MUST be in the form 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).\nsummary | `string` | An optional, string summary, intended to apply to all operations in this path.\ndescription | `string` | A description of the API. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.\tget | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject) | A definition of a GET operation on this path.\nput | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject) | A definition of a PUT operation on this path.\npost | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject) | A definition of a POST operation on this path.\ndelete | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject) | A definition of a DELETE operation on this path.\noptions | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject) | A definition of a OPTIONS operation on this path.\nhead | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject) | A definition of a HEAD operation on this path.\npatch | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject) | A definition of a PATCH operation on this path.\nget | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject) | A definition of a GET operation on this path.\ntrace | [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject) | A definition of a TRACE operation on this path.\nservers | [[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject)] | An alternative `server` array to service all operations in this path.\nparamenters | [[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)] | A 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).\n\n\\\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions).\n\n##### Paths Object Example\n\n\n\\\nJSON\n```json\n{\n "get": {\n "description": "Returns pets based on ID",\n "summary": "Find pets by ID",\n "operationId": "getPetsById",\n "responses": {\n "200": {\n "description": "pet response",\n "content": {\n "*/*": {\n "schema": {\n "type": "array",\n "items": {\n "$ref": "#/components/schemas/Pet"\n }\n }\n }\n }\n },\n "default": {\n "description": "error payload",\n "content": {\n "text/html": {\n "schema": {\n "$ref": "#/components/schemas/ErrorModel"\n }\n }\n }\n }\n }\n },\n "parameters": [\n {\n "name": "id",\n "in": "path",\n "description": "ID of pet to use",\n "required": true,\n "schema": {\n "type": "array",\n "items": {\n "type": "string"\n }\n },\n "style": "simple"\n }\n ]\n}\n```\n\n\n\\\nYAML\n```yaml\nget:\n description: Returns pets based on ID\n summary: Find pets by ID\n operationId: getPetsById\n responses:\n \'200\':\n description: pet response\n content:\n \'*/*\' :\n schema:\n type: array\n items:\n $ref: \'#/components/schemas/Pet\'\n default:\n description: error payload\n content:\n \'text/html\':\n schema:\n $ref: \'#/components/schemas/ErrorModel\'\nparameters:\n- name: id\n in: path\n description: ID of pet to use\n required: true\n schema:\n type: array\n items:\n type: string\n style: simple\n```\n', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/allowed-fields-3-0.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/allowed-fields-3-0.ts index 7252c2741e..7693db5a6a 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/allowed-fields-3-0.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/allowed-fields-3-0.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const allowedFields3_0Lint: LinterMeta = { @@ -29,11 +30,6 @@ const allowedFields3_0Lint: LinterMeta = { 'x-', ], marker: 'key', - 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: OpenAPI30, }; export default allowedFields3_0Lint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/allowed-fields-3-1.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/allowed-fields-3-1.ts index 19b8252d3b..7fd076369d 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/allowed-fields-3-1.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/allowed-fields-3-1.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const allowedFields3_1Lint: LinterMeta = { @@ -34,6 +35,6 @@ const allowedFields3_1Lint: LinterMeta = { params: ['$ref'], }, ], - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }; export default allowedFields3_1Lint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/delete--type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/delete--type.ts index b22ba53b38..61d20cdcc9 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/delete--type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/delete--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const deleteTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_DELETE_TYPE, @@ -13,6 +14,7 @@ const deleteTypeLint: LinterMeta = { marker: 'value', target: 'delete', data: {}, + targetSpecs: OpenAPI3, }; export default deleteTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/description--type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/description--type.ts index 4d43d78552..c474803a08 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/description--type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/description--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const descriptionTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_DESCRIPTION_TYPE, @@ -13,6 +14,7 @@ const descriptionTypeLint: LinterMeta = { marker: 'value', target: 'description', data: {}, + targetSpecs: OpenAPI3, }; export default descriptionTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/get--type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/get--type.ts index 6fc9d62e7d..84478288a3 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/get--type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/get--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const getTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_GET_TYPE, @@ -13,6 +14,7 @@ const getTypeLint: LinterMeta = { marker: 'value', target: 'get', data: {}, + targetSpecs: OpenAPI3, }; export default getTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/head--type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/head--type.ts index 23c12ece22..9143480e09 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/head--type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/head--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const headTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_HEAD_TYPE, @@ -13,6 +14,7 @@ const headTypeLint: LinterMeta = { marker: 'value', target: 'head', data: {}, + targetSpecs: OpenAPI3, }; export default headTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/options--type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/options--type.ts index 2e1e73995a..587cf9a82a 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/options--type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/options--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const optionsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_OPTIONS_TYPE, @@ -13,6 +14,7 @@ const optionsTypeLint: LinterMeta = { marker: 'value', target: 'options', data: {}, + targetSpecs: OpenAPI3, }; export default optionsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/parameters--items-type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/parameters--items-type.ts index 615459acd9..d622286cb6 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/parameters--items-type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/parameters--items-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const parametersItemsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_PARAMETERS_ITEMS_TYPE, @@ -13,6 +14,7 @@ const parametersItemsTypeLint: LinterMeta = { marker: 'key', target: 'parameters', data: {}, + targetSpecs: OpenAPI3, }; export default parametersItemsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/parameters--type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/parameters--type.ts index a301f53229..e6594a3b88 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/parameters--type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/parameters--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const parametersTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_PARAMETERS_TYPE, @@ -13,6 +14,7 @@ const parametersTypeLint: LinterMeta = { marker: 'value', target: 'parameters', data: {}, + targetSpecs: OpenAPI3, }; export default parametersTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/patch--type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/patch--type.ts index 507d9456a8..7335daa394 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/patch--type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/patch--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const patchTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_PATCH_TYPE, @@ -13,6 +14,7 @@ const patchTypeLint: LinterMeta = { marker: 'value', target: 'patch', data: {}, + targetSpecs: OpenAPI3, }; export default patchTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/post--type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/post--type.ts index 3e79350777..ac0bb10f0e 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/post--type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/post--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const postTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_POST_TYPE, @@ -13,6 +14,7 @@ const postTypeLint: LinterMeta = { marker: 'value', target: 'post', data: {}, + targetSpecs: OpenAPI3, }; export default postTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/put--type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/put--type.ts index 56bf7d516c..cb6beef565 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/put--type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/put--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const putTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_PUT_TYPE, @@ -13,6 +14,7 @@ const putTypeLint: LinterMeta = { marker: 'value', target: 'put', data: {}, + targetSpecs: OpenAPI3, }; export default putTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/servers--items-type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/servers--items-type.ts index 9a1c176a2c..c4fb498888 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/servers--items-type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/servers--items-type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const serversItemsTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_SERVERS_ITEMS_TYPE, @@ -13,6 +14,7 @@ const serversItemsTypeLint: LinterMeta = { marker: 'key', target: 'servers', data: {}, + targetSpecs: OpenAPI3, }; export default serversItemsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/servers--type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/servers--type.ts index d8df4dc2ef..d4702a598b 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/servers--type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/servers--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const serversTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_SERVERS_TYPE, @@ -13,6 +14,7 @@ const serversTypeLint: LinterMeta = { marker: 'value', target: 'servers', data: {}, + targetSpecs: OpenAPI3, }; export default serversTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/summary--type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/summary--type.ts index 866ac51c5f..38743fa354 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/summary--type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/summary--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const summaryTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_SUMMARY_TYPE, @@ -13,6 +14,7 @@ const summaryTypeLint: LinterMeta = { marker: 'value', target: 'summary', data: {}, + targetSpecs: OpenAPI3, }; export default summaryTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/path-item/lint/trace--type.ts b/packages/apidom-ls/src/config/openapi/path-item/lint/trace--type.ts index 368d1f476f..f1cd9af799 100644 --- a/packages/apidom-ls/src/config/openapi/path-item/lint/trace--type.ts +++ b/packages/apidom-ls/src/config/openapi/path-item/lint/trace--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const traceTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATH_ITEM_FIELD_TRACE_TYPE, @@ -13,6 +14,7 @@ const traceTypeLint: LinterMeta = { marker: 'value', target: 'trace', data: {}, + targetSpecs: OpenAPI3, }; export default traceTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/paths/documentation.ts b/packages/apidom-ls/src/config/openapi/paths/documentation.ts index 2945685444..442845aa61 100644 --- a/packages/apidom-ls/src/config/openapi/paths/documentation.ts +++ b/packages/apidom-ls/src/config/openapi/paths/documentation.ts @@ -1,16 +1,13 @@ +import { OpenAPI30, OpenAPI31 } from '../target-specs'; + const documentation = [ { docs: '#### [Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsObject)\n\nHolds the relative paths to the individual endpoints and their operations.\nThe path is appended to the URL from the [`Server Object`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject) in order to construct the full URL. The Paths MAY be empty, due to [ACL constraints](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securityFiltering).\n\n##### Patterned Fields\n\nField Pattern | Type | Description\n---|:---:|---\n/{path} | [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a forward slash (`/`). The path is **appended** (no relative URL resolution) to the expanded URL from the [`Server Object`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject)\'s `url` field in order to construct the full URL. [Path templating](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathTemplating) is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it\'s up to the tooling to decide which one to use.\n\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions).\n\n##### Path Templating Matching\n\nAssuming the following paths, the concrete definition, `/pets/mine`, will be matched first if used:\n\n```\n /pets/{petId}\n /pets/mine\n```\n\nThe following paths are considered identical and invalid:\n\n```\n /pets/{petId}\n /pets/{name}\n```\n\nThe following may lead to ambiguous resolution:\n\n```\n /{entity}/me\n /books/{id}\n```\n\n##### Paths Object Example\n\n\n\\\nJSON\n```json\n{\n "/pets": {\n "get": {\n "description": "Returns all pets from the system that the user has access to",\n "responses": {\n "200": {\n "description": "A list of pets.",\n "content": {\n "application/json": {\n "schema": {\n "type": "array",\n "items": {\n "$ref": "#/components/schemas/pet"\n }\n }\n }\n }\n }\n }\n }\n }\n}\n```\n\n\n\\\nYAML\n```yaml\n/pets:\n get:\n description: Returns all pets from the system that the user has access to\n responses:\n \'200\':\n description: A list of pets.\n content:\n application/json:\n schema:\n type: array\n items:\n $ref: \'#/components/schemas/pet\'\n```', - 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: OpenAPI30, }, { docs: '#### [Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsObject)\n\nHolds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the [`Server Object`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject) in order to construct the full URL. The Paths MAY be empty, due to [Access Control List (ACL) constraints](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#securityFiltering).\n\n##### Patterned Fields\n\nField Pattern | Type | Description\n---|:---:|---\n/{path} | [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a forward slash (`/`). The path is **appended** (no relative URL resolution) to the expanded URL from the [Server Object\'s](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject) `url` field in order to construct the full URL. [Path templating](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathTemplating) is allowed. When matching URLs, concrete(non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical.In case of ambiguous matching, it is up to the tooling to decide which one to use.\n\n\\\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions).\n\n##### Path Templating Matching\n\n\n\\\nAssuming the following paths, the concrete definition, `/pets/mine`, will be matched first if used:\n\n\n```yaml\n /pets/{petId}\n /pets/mine\n```\n\n\nThe following paths are considered identical and invalid:\n\n\n```yaml\n /pets/{petId}\n /pets/{name}\n```\n\n\nThe following may lead to ambiguous resolution:\n\n```yaml\n /{entity}/me\n /books/{id}\n```\n\n##### Paths Object Example\n\n\n\\\nJSON\n```json\n{\n "/pets": {\n "get": {\n "description": "Returns all pets from the system that the user has access to",\n "responses": {\n "200": {\n "description": "A list of pets.",\n "content": {\n "application/json": {\n "schema": {\n "type": "array",\n "items": {\n "$ref": "#/components/schemas/pet"\n }\n }\n }\n }\n }\n }\n }\n }\n}\n```\n\n\n\\\nYAML\n```yaml\n /pets:\n get:\n description: Returns all pets from the system that the user has access to\n responses:\n \'200\':\n description: A list of pets.\n content:\n application\\/ json:\n schema:\n type: array\n items:\n $ref: \'#/components/schemas/pet\'\n```\n', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/paths/lint/keys--pattern.ts b/packages/apidom-ls/src/config/openapi/paths/lint/keys--pattern.ts index cc0945bdf8..bf469a5a81 100644 --- a/packages/apidom-ls/src/config/openapi/paths/lint/keys--pattern.ts +++ b/packages/apidom-ls/src/config/openapi/paths/lint/keys--pattern.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const keysPatternLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATHS_KEYS_PATTERN, @@ -12,6 +13,7 @@ const keysPatternLint: LinterMeta = { linterParams: ['^(/|x-)'], marker: 'key', data: {}, + targetSpecs: OpenAPI3, }; export default keysPatternLint; diff --git a/packages/apidom-ls/src/config/openapi/paths/lint/values--type.ts b/packages/apidom-ls/src/config/openapi/paths/lint/values--type.ts index 922b9bb075..3b53e93d18 100644 --- a/packages/apidom-ls/src/config/openapi/paths/lint/values--type.ts +++ b/packages/apidom-ls/src/config/openapi/paths/lint/values--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const valuesTypeLint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_PATHS_VALUES_PATTERN, @@ -12,6 +13,7 @@ const valuesTypeLint: LinterMeta = { linterParams: [['pathItem']], marker: 'key', data: {}, + targetSpecs: OpenAPI3, }; export default valuesTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/reference/completion.ts b/packages/apidom-ls/src/config/openapi/reference/completion.ts index 5c353c2668..e614068cbd 100644 --- a/packages/apidom-ls/src/config/openapi/reference/completion.ts +++ b/packages/apidom-ls/src/config/openapi/reference/completion.ts @@ -3,6 +3,7 @@ import { CompletionFormat, CompletionType, } from '../../../apidom-language-types'; +import { OpenAPI31 } from '../target-specs'; const completion: ApidomCompletionItem[] = [ { @@ -16,7 +17,7 @@ const completion: ApidomCompletionItem[] = [ kind: 'markdown', value: '**REQUIRED**. The reference identifier. This MUST be in the form of a URI.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'summary', @@ -30,7 +31,7 @@ const completion: ApidomCompletionItem[] = [ value: 'A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a `summary` field, then this field has no effect.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { label: 'description', @@ -44,7 +45,7 @@ const completion: ApidomCompletionItem[] = [ value: 'A description which by default SHOULD override that of the referenced component. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. If the referenced object-type does not allow a `description` field, then this field has no effect.', }, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/reference/documentation.ts b/packages/apidom-ls/src/config/openapi/reference/documentation.ts index 84d4f9d673..b78cb78bce 100644 --- a/packages/apidom-ls/src/config/openapi/reference/documentation.ts +++ b/packages/apidom-ls/src/config/openapi/reference/documentation.ts @@ -1,18 +1,20 @@ +import { OpenAPI31 } from '../target-specs'; + const documentation = [ { target: '$ref', docs: '**REQUIRED**. The reference identifier. This MUST be in the form of a URI.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'summary', docs: 'A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a `summary` field, then this field has no effect.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, { target: 'description', docs: 'A description which by default SHOULD override that of the referenced component. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. If the referenced object-type does not allow a `description` field, then this field has no effect.', - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }, ]; diff --git a/packages/apidom-ls/src/config/openapi/reference/lint/$ref--format-uri.ts b/packages/apidom-ls/src/config/openapi/reference/lint/$ref--format-uri.ts index 4c4f7f4c8f..575b968581 100644 --- a/packages/apidom-ls/src/config/openapi/reference/lint/$ref--format-uri.ts +++ b/packages/apidom-ls/src/config/openapi/reference/lint/$ref--format-uri.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI3 } from '../../target-specs'; const $refFormatURILint: LinterMeta = { code: ApilintCodes.OPENAPI3_0_REFERENCE_FIELD_$REF_FORMAT_URI, @@ -12,6 +13,7 @@ const $refFormatURILint: LinterMeta = { marker: 'value', target: '$ref', data: {}, + targetSpecs: OpenAPI3, }; export default $refFormatURILint; diff --git a/packages/apidom-ls/src/config/openapi/reference/lint/$ref-3-0--no-siblings.ts b/packages/apidom-ls/src/config/openapi/reference/lint/$ref-3-0--no-siblings.ts index 71074d5401..664042d32f 100644 --- a/packages/apidom-ls/src/config/openapi/reference/lint/$ref-3-0--no-siblings.ts +++ b/packages/apidom-ls/src/config/openapi/reference/lint/$ref-3-0--no-siblings.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI30 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const $ref3_0NoSiblingsLint: LinterMeta = { @@ -28,12 +29,7 @@ const $ref3_0NoSiblingsLint: LinterMeta = { }, ], }, - 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: OpenAPI30, }; export default $ref3_0NoSiblingsLint; diff --git a/packages/apidom-ls/src/config/openapi/reference/lint/$ref-3-1--allowed-siblings.ts b/packages/apidom-ls/src/config/openapi/reference/lint/$ref-3-1--allowed-siblings.ts index 6813b90264..f638465479 100644 --- a/packages/apidom-ls/src/config/openapi/reference/lint/$ref-3-1--allowed-siblings.ts +++ b/packages/apidom-ls/src/config/openapi/reference/lint/$ref-3-1--allowed-siblings.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const $ref3_1AllowedSiblingsLint: LinterMeta = { @@ -20,7 +21,7 @@ const $ref3_1AllowedSiblingsLint: LinterMeta = { }, ], data: {}, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }; export default $ref3_1AllowedSiblingsLint; diff --git a/packages/apidom-ls/src/config/openapi/reference/lint/description-3-1--type.ts b/packages/apidom-ls/src/config/openapi/reference/lint/description-3-1--type.ts index 4bf0481b03..eb381bc956 100644 --- a/packages/apidom-ls/src/config/openapi/reference/lint/description-3-1--type.ts +++ b/packages/apidom-ls/src/config/openapi/reference/lint/description-3-1--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const description3_1TypeLint: LinterMeta = { @@ -14,7 +15,7 @@ const description3_1TypeLint: LinterMeta = { marker: 'value', target: 'description', data: {}, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }; export default description3_1TypeLint; diff --git a/packages/apidom-ls/src/config/openapi/reference/lint/summary-3-1--type.ts b/packages/apidom-ls/src/config/openapi/reference/lint/summary-3-1--type.ts index e41c5a6391..7bd4be0248 100644 --- a/packages/apidom-ls/src/config/openapi/reference/lint/summary-3-1--type.ts +++ b/packages/apidom-ls/src/config/openapi/reference/lint/summary-3-1--type.ts @@ -2,6 +2,7 @@ import { DiagnosticSeverity } from 'vscode-languageserver-types'; import ApilintCodes from '../../../codes'; import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI31 } from '../../target-specs'; // eslint-disable-next-line @typescript-eslint/naming-convention const summary3_1TypeLint: LinterMeta = { @@ -14,7 +15,7 @@ const summary3_1TypeLint: LinterMeta = { marker: 'value', target: 'summary', data: {}, - targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + targetSpecs: OpenAPI31, }; export default summary3_1TypeLint; diff --git a/packages/apidom-ls/src/config/openapi/target-specs.ts b/packages/apidom-ls/src/config/openapi/target-specs.ts index 3115418838..c74c93f5c8 100644 --- a/packages/apidom-ls/src/config/openapi/target-specs.ts +++ b/packages/apidom-ls/src/config/openapi/target-specs.ts @@ -1,10 +1,11 @@ export const OpenAPI2 = [{ namespace: 'openapi', version: '2.0' }]; -export const OpenAPI30 = [ - { namespace: 'openapi', version: '3.0.0' }, - { namespace: 'openapi', version: '3.0.1' }, - { namespace: 'openapi', version: '3.0.2' }, - { namespace: 'openapi', version: '3.0.3' }, -]; + +export const OpenAPI300 = [{ namespace: 'openapi', version: '3.0.0' }]; +export const OpenAPI301 = [{ namespace: 'openapi', version: '3.0.1' }]; +export const OpenAPI302 = [{ namespace: 'openapi', version: '3.0.2' }]; +export const OpenAPI303 = [{ namespace: 'openapi', version: '3.0.3' }]; + +export const OpenAPI30 = [...OpenAPI300, ...OpenAPI301, ...OpenAPI302, ...OpenAPI303]; export const OpenAPI31 = [{ namespace: 'openapi', version: '3.1.0' }]; export const OpenAPI3 = [...OpenAPI30, ...OpenAPI31]; diff --git a/packages/apidom-ls/test/openapi-json.ts b/packages/apidom-ls/test/openapi-json.ts index 143a392882..6e4e56cd76 100644 --- a/packages/apidom-ls/test/openapi-json.ts +++ b/packages/apidom-ls/test/openapi-json.ts @@ -27,6 +27,7 @@ import { getSourceMap, SourceMap } from '../src/utils/utils'; import { OpenAPi31JsonSchemaValidationProvider } from '../src/services/validation/providers/openapi-31-json-schema-validation-provider'; import { logPerformance, logLevel } from './test-utils'; import testTokens from './test-tokens'; +import { OpenAPI31 } from '../src/config/openapi/target-specs'; const spec = fs.readFileSync(path.join(__dirname, 'fixtures', 'sample-api.json')).toString(); /* const specAjvSimple = fs @@ -84,6 +85,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'jsonSchemaDialect', + targetSpecs: OpenAPI31, }, { documentation: { @@ -95,6 +97,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'servers', + targetSpecs: OpenAPI31, }, { documentation: { @@ -106,6 +109,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'paths', + targetSpecs: OpenAPI31, }, { documentation: { @@ -117,6 +121,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'webhooks', + targetSpecs: OpenAPI31, }, { documentation: { @@ -128,6 +133,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'components', + targetSpecs: OpenAPI31, }, { documentation: { @@ -139,6 +145,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'security', + targetSpecs: OpenAPI31, }, { documentation: { @@ -150,6 +157,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'tags', + targetSpecs: OpenAPI31, }, { documentation: { @@ -161,6 +169,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'externalDocs', + targetSpecs: OpenAPI31, }, ], isIncomplete: false, @@ -182,6 +191,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'openapi', + targetSpecs: OpenAPI31, }, { documentation: { @@ -193,6 +203,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'jsonSchemaDialect', + targetSpecs: OpenAPI31, }, { documentation: { @@ -204,6 +215,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'servers', + targetSpecs: OpenAPI31, }, { documentation: { @@ -215,6 +227,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'paths', + targetSpecs: OpenAPI31, }, { documentation: { @@ -226,6 +239,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'webhooks', + targetSpecs: OpenAPI31, }, { documentation: { @@ -237,6 +251,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'components', + targetSpecs: OpenAPI31, }, { documentation: { @@ -248,6 +263,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'security', + targetSpecs: OpenAPI31, }, { documentation: { @@ -259,6 +275,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'tags', + targetSpecs: OpenAPI31, }, { documentation: { @@ -270,6 +287,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'externalDocs', + targetSpecs: OpenAPI31, }, ], isIncomplete: false, @@ -291,6 +309,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'info', + targetSpecs: OpenAPI31, }, { documentation: { @@ -302,6 +321,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'jsonSchemaDialect', + targetSpecs: OpenAPI31, }, { documentation: { @@ -313,6 +333,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'servers', + targetSpecs: OpenAPI31, }, { documentation: { @@ -324,6 +345,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'paths', + targetSpecs: OpenAPI31, }, { documentation: { @@ -335,6 +357,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'webhooks', + targetSpecs: OpenAPI31, }, { documentation: { @@ -346,6 +369,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'components', + targetSpecs: OpenAPI31, }, { documentation: { @@ -357,6 +381,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'security', + targetSpecs: OpenAPI31, }, { documentation: { @@ -368,6 +393,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'tags', + targetSpecs: OpenAPI31, }, { documentation: { @@ -379,6 +405,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'externalDocs', + targetSpecs: OpenAPI31, }, ], isIncomplete: false, diff --git a/packages/apidom-ls/test/openapi-yaml.ts b/packages/apidom-ls/test/openapi-yaml.ts index b19767e7ce..022c29ec01 100644 --- a/packages/apidom-ls/test/openapi-yaml.ts +++ b/packages/apidom-ls/test/openapi-yaml.ts @@ -151,6 +151,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'openapi', + targetSpecs: OpenAPI31, }, { documentation: { @@ -162,6 +163,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'jsonSchemaDialect', + targetSpecs: OpenAPI31, }, { documentation: { @@ -173,6 +175,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'servers', + targetSpecs: OpenAPI31, }, { documentation: { @@ -184,6 +187,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'paths', + targetSpecs: OpenAPI31, }, { documentation: { @@ -195,6 +199,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'webhooks', + targetSpecs: OpenAPI31, }, { documentation: { @@ -206,6 +211,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'components', + targetSpecs: OpenAPI31, }, { documentation: { @@ -217,6 +223,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'security', + targetSpecs: OpenAPI31, }, { documentation: { @@ -228,6 +235,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'tags', + targetSpecs: OpenAPI31, }, { documentation: { @@ -239,6 +247,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'externalDocs', + targetSpecs: OpenAPI31, }, ], isIncomplete: false, @@ -260,6 +269,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'info', + targetSpecs: OpenAPI31, }, { documentation: { @@ -271,6 +281,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'jsonSchemaDialect', + targetSpecs: OpenAPI31, }, { documentation: { @@ -282,6 +293,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'servers', + targetSpecs: OpenAPI31, }, { documentation: { @@ -293,6 +305,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'paths', + targetSpecs: OpenAPI31, }, { documentation: { @@ -304,6 +317,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'webhooks', + targetSpecs: OpenAPI31, }, { documentation: { @@ -315,6 +329,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'components', + targetSpecs: OpenAPI31, }, { documentation: { @@ -326,6 +341,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'security', + targetSpecs: OpenAPI31, }, { documentation: { @@ -337,6 +353,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'tags', + targetSpecs: OpenAPI31, }, { documentation: { @@ -348,6 +365,7 @@ const completionTestInput = [ insertTextFormat: 2, kind: 14, label: 'externalDocs', + targetSpecs: OpenAPI31, }, ], isIncomplete: false,