Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ls): add support for OpenAPI 3.0.4 #4628

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/apidom-ls/src/config/codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ enum ApilintCodes {
OPENAPI3_0_OPENAPI_VALUE_PATTERN_3_0_1,
OPENAPI3_0_OPENAPI_VALUE_PATTERN_3_0_2,
OPENAPI3_0_OPENAPI_VALUE_PATTERN_3_0_3,
OPENAPI3_0_OPENAPI_VALUE_PATTERN_3_0_4,

OPENAPI3_0_OPEN_API = 5010000,
OPENAPI3_0_OPEN_API_FIELD_INFO_TYPE = 5010100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { OpenAPI30, OpenAPI31 } from '../target-specs.ts';

const documentation = [
{
docs: "#### [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callbackObject)\n\nA map of possible out-of band callbacks related to the parent operation.\nEach value in the map is a [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathItemObject) that describes a set of requests that may be initiated by the API provider and the expected responses.\nThe key value used to identify the path item object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.\n\n##### Patterned Fields\nField Pattern | Type | Description\n---|:---:|---\n{expression} | [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathItemObject) | A Path Item Object used to define a callback request and expected responses. A [complete example](https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/callback-example.yaml) is available.\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##### Key Expression\n\nThe key that identifies the [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathItemObject) is a [runtime expression](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#runtimeExpression) that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request.\nA simple example might be `$request.body#/url`.\nHowever, using a [runtime expression](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#runtimeExpression) the complete HTTP message can be accessed.\nThis includes accessing any part of a body that a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) can reference.\n\nFor example, given the following HTTP request:\n\n```http\nPOST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1\nHost: example.org\nContent-Type: application/json\nContent-Length: 187\n\n{\n \"failedUrl\" : \"http://clientdomain.com/failed\",\n \"successUrls\" : [\n \"http://clientdomain.com/fast\",\n \"http://clientdomain.com/medium\",\n \"http://clientdomain.com/slow\"\n ]\n}\n\n201 Created\nLocation: http://example.org/subscription/1\n```\n\nThe following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named `eventType` and a query parameter named `queryUrl`.\n\nExpression | Value\n---|:---\n$url | http://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning\n$method | POST\n$request.path.eventType | myevent\n$request.query.queryUrl | http://clientdomain.com/stillrunning\n$request.header.content-Type | application/json\n$request.body#/failedUrl | http://clientdomain.com/failed\n$request.body#/successUrls/2 | http://clientdomain.com/medium\n$response.header.Location | http://example.org/subscription/1\n\n\n##### Callback Object Examples\n\nThe following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is an example of how to use a callback object to describe a WebHook callback that goes with the subscription operation to enable registering for the WebHook.\n\n\n\\\nYAML\n```yaml\nmyCallback:\n '{$request.query.queryUrl}':\n post:\n requestBody:\n description: Callback payload\n content:\n 'application/json':\n schema:\n $ref: '#/components/schemas/SomePayload'\n responses:\n '200':\n description: callback successfully processed\n```\n\nThe following example shows a callback where the server is hard-coded, but the query string parameters are populated from the `id` and `email` property in the request body.\n\n```yaml\ntransactionCallback:\n 'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':\n post:\n requestBody:\n description: Callback payload\n content:\n 'application/json':\n schema:\n $ref: '#/components/schemas/SomePayload'\n responses:\n '200':\n description: callback successfully processed\n```",
docs: "#### [Callback Object](https://spec.openapis.org/oas/v3.0.4.html#callback-object)\n\nA map of possible out-of band callbacks related to the parent operation.\nEach value in the map is a [Path Item Object](https://spec.openapis.org/oas/v3.0.4.html#path-item-object) that describes a set of requests that may be initiated by the API provider and the expected responses.\nThe key value used to identify the path item object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.\n\n##### Patterned Fields\nField Pattern | Type | Description\n---|:---:|---\n{expression} | [Path Item Object](https://spec.openapis.org/oas/v3.0.4.html#path-item-object) | A Path Item Object used to define a callback request and expected responses. A [complete example](https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/callback-example.yaml) is available.\n\nThis object MAY be extended with [Specification Extensions](https://spec.openapis.org/oas/v3.0.4.html#specification-extensions).\n\n##### Key Expression\n\nThe key that identifies the [Path Item Object](https://spec.openapis.org/oas/v3.0.4.html#path-item-object) is a [runtime expression](https://spec.openapis.org/oas/v3.0.4.html#runtime-expressions) that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request.\nA simple example might be `$request.body#/url`.\nHowever, using a [runtime expression](https://spec.openapis.org/oas/v3.0.4.html#runtime-expressions) the complete HTTP message can be accessed.\nThis includes accessing any part of a body that a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) can reference.\n\nFor example, given the following HTTP request:\n\n```http\nPOST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1\nHost: example.org\nContent-Type: application/json\nContent-Length: 187\n\n{\n \"failedUrl\" : \"http://clientdomain.com/failed\",\n \"successUrls\" : [\n \"http://clientdomain.com/fast\",\n \"http://clientdomain.com/medium\",\n \"http://clientdomain.com/slow\"\n ]\n}\n\n201 Created\nLocation: http://example.org/subscription/1\n```\n\nThe following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named `eventType` and a query parameter named `queryUrl`.\n\nExpression | Value\n---|:---\n$url | http://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning\n$method | POST\n$request.path.eventType | myevent\n$request.query.queryUrl | http://clientdomain.com/stillrunning\n$request.header.content-Type | application/json\n$request.body#/failedUrl | http://clientdomain.com/failed\n$request.body#/successUrls/2 | http://clientdomain.com/medium\n$response.header.Location | http://example.org/subscription/1\n\n\n##### Callback Object Examples\n\nThe following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is an example of how to use a callback object to describe a WebHook callback that goes with the subscription operation to enable registering for the WebHook.\n\n\n\\\nYAML\n```yaml\nmyCallback:\n '{$request.query.queryUrl}':\n post:\n requestBody:\n description: Callback payload\n content:\n 'application/json':\n schema:\n $ref: '#/components/schemas/SomePayload'\n responses:\n '200':\n description: callback successfully processed\n```\n\nThe following example shows a callback where the server is hard-coded, but the query string parameters are populated from the `id` and `email` property in the request body.\n\n```yaml\ntransactionCallback:\n 'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':\n post:\n requestBody:\n description: Callback payload\n content:\n 'application/json':\n schema:\n $ref: '#/components/schemas/SomePayload'\n responses:\n '200':\n description: callback successfully processed\n```",
targetSpecs: OpenAPI30,
},
{
Expand Down
20 changes: 10 additions & 10 deletions packages/apidom-ls/src/config/openapi/components/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[`string`, [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\\\nAn object to hold reusable [Schema Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schemaObject).',
'Map[`string`, [Schema Object](https://spec.openapis.org/oas/v3.0.4.html#schema-object) \\| [Reference Object](https://spec.openapis.org/oas/v3.0.4.html#reference-object)]\n\\\n\\\nAn object to hold reusable [Schema Objects](https://spec.openapis.org/oas/v3.0.4.html#schema-object).',
},
targetSpecs: OpenAPI30,
},
Expand Down Expand Up @@ -44,7 +44,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[`string`, [Response Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#responseObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)]\n\\\n\\\nAn object to hold reusable [Response Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#responseObject).',
'Map[`string`, [Response Object](https://spec.openapis.org/oas/v3.0.4.html#response-object) | [Reference Object](https://spec.openapis.org/oas/v3.0.4.html#reference-object)]\n\\\n\\\nAn object to hold reusable [Response Objects](https://spec.openapis.org/oas/v3.0.4.html#response-object).',
},
targetSpecs: OpenAPI30,
},
Expand Down Expand Up @@ -72,7 +72,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[`string`, [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\\\nAn object to hold reusable [Parameter Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterObject).',
'Map[`string`, [Parameter Object](https://spec.openapis.org/oas/v3.0.4.html#parameter-object) | [Reference Object](https://spec.openapis.org/oas/v3.0.4.html#reference-object)]\n\\\n\\\nAn object to hold reusable [Parameter Objects](https://spec.openapis.org/oas/v3.0.4.html#parameter-object).',
},
targetSpecs: OpenAPI30,
},
Expand Down Expand Up @@ -100,7 +100,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
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\\\nAn object to hold reusable [Example Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#exampleObject).',
'Map[`string`, [Example Object](https://spec.openapis.org/oas/v3.0.4.html#example-object) | [Reference Object](https://spec.openapis.org/oas/v3.0.4.html#reference-object)]\n\\\n\\\nAn object to hold reusable [Example Objects](https://spec.openapis.org/oas/v3.0.4.html#example-object).',
},
targetSpecs: OpenAPI30,
},
Expand Down Expand Up @@ -128,7 +128,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[`string`, [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\\\nAn object to hold reusable [Request Body Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#requestBodyObject).',
'Map[`string`, [Request Body Object](https://spec.openapis.org/oas/v3.0.4.html#request-body-object) | [Reference Object](https://spec.openapis.org/oas/v3.0.4.html#reference-object)]\n\\\n\\\nAn object to hold reusable [Request Body Objects](https://spec.openapis.org/oas/v3.0.4.html#request-body-object).',
},
targetSpecs: OpenAPI30,
},
Expand Down Expand Up @@ -156,7 +156,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[`string`, [Header Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#headerObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)]\n\\\n\\\nAn object to hold reusable [Header Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#headerObject).',
'Map[`string`, [Header Object](https://spec.openapis.org/oas/v3.0.4.html#header-object) | [Reference Object](https://spec.openapis.org/oas/v3.0.4.html#reference-object)]\n\\\n\\\nAn object to hold reusable [Header Objects](https://spec.openapis.org/oas/v3.0.4.html#header-object).',
},
targetSpecs: OpenAPI30,
},
Expand Down Expand Up @@ -184,7 +184,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[`string`, [Security Scheme Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securitySchemeObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)]\n\\\n\\\nAn object to hold reusable [Security Scheme Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securitySchemeObject).',
'Map[`string`, [Security Scheme Object](https://spec.openapis.org/oas/v3.0.4.html#security-scheme-object) | [Reference Object](https://spec.openapis.org/oas/v3.0.4.html#reference-object)]\n\\\n\\\nAn object to hold reusable [Security Scheme Objects](https://spec.openapis.org/oas/v3.0.4.html#security-scheme-object).',
},
targetSpecs: OpenAPI30,
},
Expand Down Expand Up @@ -212,7 +212,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[`string`, [Link Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#linkObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)]\n\\\n\\\nAn object to hold reusable [Link Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#linkObject).',
'Map[`string`, [Link Object](https://spec.openapis.org/oas/v3.0.4.html#link-object) | [Reference Object](https://spec.openapis.org/oas/v3.0.4.html#reference-object)]\n\\\n\\\nAn object to hold reusable [Link Objects](https://spec.openapis.org/oas/v3.0.4.html#link-object).',
},
targetSpecs: OpenAPI30,
},
Expand All @@ -226,7 +226,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[`string`, [Link Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#linkObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)]\n\\\n\\\nAn object to hold reusable [Link Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#linkObject).',
'Map[`string`, [Link Object](https://spec.openapis.org/oas/v3.0.4.html#link-object) | [Reference Object](https://spec.openapis.org/oas/v3.0.4.html#reference-object)]\n\\\n\\\nAn object to hold reusable [Link Objects](https://spec.openapis.org/oas/v3.0.4.html#link-object).',
},
targetSpecs: OpenAPI31,
},
Expand All @@ -240,7 +240,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
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\\\nAn object to hold reusable [Callback Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callbackObject).',
'Map[`string`, [Callback Object](https://spec.openapis.org/oas/v3.0.4.html#callback-object) | [Reference Object](https://spec.openapis.org/oas/v3.0.4.html#reference-object)]\n\\\n\\\nAn object to hold reusable [Callback Objects](https://spec.openapis.org/oas/v3.0.4.html#callback-object).',
},
targetSpecs: OpenAPI30,
},
Expand Down
Loading
Loading