Skip to content

Commit d973f6d

Browse files
authored
feat(ls): add support for OpenAPI 3.0.4 (#4628)
Refs #4612
1 parent 8a011e6 commit d973f6d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+470
-412
lines changed

packages/apidom-ls/src/config/codes.ts

+1
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,7 @@ enum ApilintCodes {
848848
OPENAPI3_0_OPENAPI_VALUE_PATTERN_3_0_1,
849849
OPENAPI3_0_OPENAPI_VALUE_PATTERN_3_0_2,
850850
OPENAPI3_0_OPENAPI_VALUE_PATTERN_3_0_3,
851+
OPENAPI3_0_OPENAPI_VALUE_PATTERN_3_0_4,
851852

852853
OPENAPI3_0_OPEN_API = 5010000,
853854
OPENAPI3_0_OPEN_API_FIELD_INFO_TYPE = 5010100,

packages/apidom-ls/src/config/openapi/callback/documentation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { OpenAPI30, OpenAPI31 } from '../target-specs.ts';
22

33
const documentation = [
44
{
5-
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```",
5+
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```",
66
targetSpecs: OpenAPI30,
77
},
88
{

packages/apidom-ls/src/config/openapi/components/completion.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const completion: ApidomCompletionItem[] = [
1616
documentation: {
1717
kind: 'markdown',
1818
value:
19-
'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).',
19+
'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).',
2020
},
2121
targetSpecs: OpenAPI30,
2222
},
@@ -44,7 +44,7 @@ const completion: ApidomCompletionItem[] = [
4444
documentation: {
4545
kind: 'markdown',
4646
value:
47-
'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).',
47+
'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).',
4848
},
4949
targetSpecs: OpenAPI30,
5050
},
@@ -72,7 +72,7 @@ const completion: ApidomCompletionItem[] = [
7272
documentation: {
7373
kind: 'markdown',
7474
value:
75-
'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).',
75+
'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).',
7676
},
7777
targetSpecs: OpenAPI30,
7878
},
@@ -100,7 +100,7 @@ const completion: ApidomCompletionItem[] = [
100100
documentation: {
101101
kind: 'markdown',
102102
value:
103-
'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).',
103+
'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).',
104104
},
105105
targetSpecs: OpenAPI30,
106106
},
@@ -128,7 +128,7 @@ const completion: ApidomCompletionItem[] = [
128128
documentation: {
129129
kind: 'markdown',
130130
value:
131-
'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).',
131+
'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).',
132132
},
133133
targetSpecs: OpenAPI30,
134134
},
@@ -156,7 +156,7 @@ const completion: ApidomCompletionItem[] = [
156156
documentation: {
157157
kind: 'markdown',
158158
value:
159-
'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).',
159+
'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).',
160160
},
161161
targetSpecs: OpenAPI30,
162162
},
@@ -184,7 +184,7 @@ const completion: ApidomCompletionItem[] = [
184184
documentation: {
185185
kind: 'markdown',
186186
value:
187-
'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).',
187+
'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).',
188188
},
189189
targetSpecs: OpenAPI30,
190190
},
@@ -212,7 +212,7 @@ const completion: ApidomCompletionItem[] = [
212212
documentation: {
213213
kind: 'markdown',
214214
value:
215-
'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).',
215+
'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).',
216216
},
217217
targetSpecs: OpenAPI30,
218218
},
@@ -226,7 +226,7 @@ const completion: ApidomCompletionItem[] = [
226226
documentation: {
227227
kind: 'markdown',
228228
value:
229-
'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).',
229+
'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).',
230230
},
231231
targetSpecs: OpenAPI31,
232232
},
@@ -240,7 +240,7 @@ const completion: ApidomCompletionItem[] = [
240240
documentation: {
241241
kind: 'markdown',
242242
value:
243-
'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).',
243+
'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).',
244244
},
245245
targetSpecs: OpenAPI30,
246246
},

0 commit comments

Comments
 (0)