diff --git a/packages/apidom-ls/scripts/transform-spec-fragment.js b/packages/apidom-ls/scripts/transform-spec-fragment.js index f9367a8bc..69dadc7fa 100644 --- a/packages/apidom-ls/scripts/transform-spec-fragment.js +++ b/packages/apidom-ls/scripts/transform-spec-fragment.js @@ -4,12 +4,15 @@ */ const transform = (str) => { - console.log(JSON.stringify(str.trim().replace(/(\r\n|\n|\r)/gm, '\n'))); + const transformed = JSON.stringify(str.trim().replace(/(\r\n|\n|\r)/gm, '\n')); + const jsonTransformed = transformed.replace(/```json/m, '\n\\\nJSON\n```json'); + const yamlTransformed = jsonTransformed.replace(/```yaml/m, '\n\\\nYAML\n```yaml'); + console.log(yamlTransformed); }; transform( - `[Contact Object](https://www.asyncapi.com/docs/specifications/v2.3.0#contactObject) -\\ -\\ -Contact information for the exposed API.`, + `\`\`\`json + test + \`\`\` + `, ); diff --git a/packages/apidom-ls/src/config/asyncapi/asyncapi2/complete/asyncapi2.ts b/packages/apidom-ls/src/config/asyncapi/asyncapi2/complete/asyncapi2.ts index 489ca35e3..233aac8d6 100644 --- a/packages/apidom-ls/src/config/asyncapi/asyncapi2/complete/asyncapi2.ts +++ b/packages/apidom-ls/src/config/asyncapi/asyncapi2/complete/asyncapi2.ts @@ -119,7 +119,7 @@ const asyncapiRootComplete: ApidomCompletionItem[] = [ documentation: { kind: 'markdown', value: - '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', + '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n\n\\\nJSON\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n\n\\\nYAML\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', }, }, { diff --git a/packages/apidom-ls/src/config/asyncapi/asyncapi2/docs/asyncapi2.ts b/packages/apidom-ls/src/config/asyncapi/asyncapi2/docs/asyncapi2.ts index 212bc0cbd..2c93618ab 100644 --- a/packages/apidom-ls/src/config/asyncapi/asyncapi2/docs/asyncapi2.ts +++ b/packages/apidom-ls/src/config/asyncapi/asyncapi2/docs/asyncapi2.ts @@ -9,7 +9,7 @@ const asyncapi2Docs = [ }, { target: 'info', - docs: 'The object provides metadata about the API. The metadata can be used by the clients if needed.', + docs: '[Info Object](https://www.asyncapi.com/docs/specifications/v2.3.0#infoObject)\n\\\n\\\nThe object provides metadata about the API. The metadata can be used by the clients if needed.', }, { target: 'servers', diff --git a/packages/apidom-ls/src/config/asyncapi/channel-item/docs/channel-item.ts b/packages/apidom-ls/src/config/asyncapi/channel-item/docs/channel-item.ts index 4eeb1cde4..9cad1cb15 100644 --- a/packages/apidom-ls/src/config/asyncapi/channel-item/docs/channel-item.ts +++ b/packages/apidom-ls/src/config/asyncapi/channel-item/docs/channel-item.ts @@ -13,11 +13,11 @@ const channelDocs = [ }, { target: 'subscribe', - docs: '[Operation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationObject)\n\\\n\\\nA definition of the SUBSCRIBE operation, which defines the messages produced by the application and sent to the channel.\n\\\n\\\nDescribes a publish or a subscribe operation. This provides a place to document how and why messages are sent and received.\n\\\n\\\nFor example, an operation might describe a chat application use case where a user sends a text message to a group. A publish operation describes messages that are received by the chat application, whereas a subscribe operation describes messages that are sent by the chat application.\n\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\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.\nsummary | `string` | A short summary of what the operation is about.\ndescription | `string` | A verbose explanation of the operation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\ntags | [Tags Object](https://www.asyncapi.com/docs/specifications/v2.3.0#tagsObject) | A list of tags for API documentation control. Tags can be used for logical grouping of operations.\nexternalDocs | [External Documentation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#externalDocumentationObject) | Additional external documentation for this operation.\nbindings | [Operation Bindings Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationBindingsObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the operation.\ntraits | [[Operation Trait Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) ] | A list of traits to apply to the operation object. Traits MUST be merged into the operation object using the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) algorithm in the same order they are defined here.\nmessage | [Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | Map["oneOf", [[Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject)]] | A definition of the message that will be published or received by this operation. Map containing a single `oneOf` key is allowed here to specify multiple messages. However, **a message MUST be valid only against one of the message objects.**\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Operation Object Example\n\n```json\n{\n "operationId": "registerUser",\n "summary": "Action to sign a user up.",\n "description": "A longer description",\n "tags": [\n { "name": "user" },\n { "name": "signup" },\n { "name": "register" }\n ],\n "message": {\n "headers": {\n "type": "object",\n "properties": {\n "applicationInstanceId": {\n "description": "Unique identifier for a given instance of the publishing application",\n "type": "string"\n }\n }\n },\n "payload": {\n "type": "object",\n "properties": {\n "user": {\n "$ref": "#/components/schemas/userCreate"\n },\n "signup": {\n "$ref": "#/components/schemas/signup"\n }\n }\n }\n },\n "bindings": {\n "amqp": {\n "ack": false\n }\n },\n "traits": [\n { "$ref": "#/components/operationTraits/kafka" }\n ]\n}\n```\n\n```yaml\noperationId: registerUser\nsummary: Action to sign a user up.\ndescription: A longer description\ntags:\n - name: user\n - name: signup\n - name: register\nmessage:\n headers:\n type: object\n properties:\n applicationInstanceId:\n description: Unique identifier for a given instance of the publishing application\n type: string\n payload:\n type: object\n properties:\n user:\n $ref: "#/components/schemas/userCreate"\n signup:\n $ref: "#/components/schemas/signup"\nbindings:\n amqp:\n ack: false\ntraits:\n - $ref: "#/components/operationTraits/kafka"\n```', + docs: '[Operation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationObject)\n\\\n\\\nA definition of the SUBSCRIBE operation, which defines the messages produced by the application and sent to the channel.\n\\\n\\\nDescribes a publish or a subscribe operation. This provides a place to document how and why messages are sent and received.\n\\\n\\\nFor example, an operation might describe a chat application use case where a user sends a text message to a group. A publish operation describes messages that are received by the chat application, whereas a subscribe operation describes messages that are sent by the chat application.\n\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\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.\nsummary | `string` | A short summary of what the operation is about.\ndescription | `string` | A verbose explanation of the operation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\ntags | [Tags Object](https://www.asyncapi.com/docs/specifications/v2.3.0#tagsObject) | A list of tags for API documentation control. Tags can be used for logical grouping of operations.\nexternalDocs | [External Documentation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#externalDocumentationObject) | Additional external documentation for this operation.\nbindings | [Operation Bindings Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationBindingsObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the operation.\ntraits | [[Operation Trait Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) ] | A list of traits to apply to the operation object. Traits MUST be merged into the operation object using the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) algorithm in the same order they are defined here.\nmessage | [Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | Map["oneOf", [[Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject)]] | A definition of the message that will be published or received by this operation. Map containing a single `oneOf` key is allowed here to specify multiple messages. However, **a message MUST be valid only against one of the message objects.**\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Operation Object Example\n\n\n\\\nJSON\n```json\n{\n "operationId": "registerUser",\n "summary": "Action to sign a user up.",\n "description": "A longer description",\n "tags": [\n { "name": "user" },\n { "name": "signup" },\n { "name": "register" }\n ],\n "message": {\n "headers": {\n "type": "object",\n "properties": {\n "applicationInstanceId": {\n "description": "Unique identifier for a given instance of the publishing application",\n "type": "string"\n }\n }\n },\n "payload": {\n "type": "object",\n "properties": {\n "user": {\n "$ref": "#/components/schemas/userCreate"\n },\n "signup": {\n "$ref": "#/components/schemas/signup"\n }\n }\n }\n },\n "bindings": {\n "amqp": {\n "ack": false\n }\n },\n "traits": [\n { "$ref": "#/components/operationTraits/kafka" }\n ]\n}\n```\n\n\n\\\nYAML\n```yaml\noperationId: registerUser\nsummary: Action to sign a user up.\ndescription: A longer description\ntags:\n - name: user\n - name: signup\n - name: register\nmessage:\n headers:\n type: object\n properties:\n applicationInstanceId:\n description: Unique identifier for a given instance of the publishing application\n type: string\n payload:\n type: object\n properties:\n user:\n $ref: "#/components/schemas/userCreate"\n signup:\n $ref: "#/components/schemas/signup"\nbindings:\n amqp:\n ack: false\ntraits:\n - $ref: "#/components/operationTraits/kafka"\n```', }, { target: 'publish', - docs: '[Operation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationObject)\n\\\n\\\nA definition of the PUBLISH operation, which defines the messages consumed by the application from the channel.\n\\\n\\\nDescribes a publish or a subscribe operation. This provides a place to document how and why messages are sent and received.\n\\\n\\\nFor example, an operation might describe a chat application use case where a user sends a text message to a group. A publish operation describes messages that are received by the chat application, whereas a subscribe operation describes messages that are sent by the chat application.\n\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\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.\nsummary | `string` | A short summary of what the operation is about.\ndescription | `string` | A verbose explanation of the operation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\ntags | [Tags Object](https://www.asyncapi.com/docs/specifications/v2.3.0#tagsObject) | A list of tags for API documentation control. Tags can be used for logical grouping of operations.\nexternalDocs | [External Documentation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#externalDocumentationObject) | Additional external documentation for this operation.\nbindings | [Operation Bindings Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationBindingsObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the operation.\ntraits | [[Operation Trait Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) ] | A list of traits to apply to the operation object. Traits MUST be merged into the operation object using the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) algorithm in the same order they are defined here.\nmessage | [Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | Map["oneOf", [[Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject)]] | A definition of the message that will be published or received by this operation. Map containing a single `oneOf` key is allowed here to specify multiple messages. However, **a message MUST be valid only against one of the message objects.**\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Operation Object Example\n\n```json\n{\n "operationId": "registerUser",\n "summary": "Action to sign a user up.",\n "description": "A longer description",\n "tags": [\n { "name": "user" },\n { "name": "signup" },\n { "name": "register" }\n ],\n "message": {\n "headers": {\n "type": "object",\n "properties": {\n "applicationInstanceId": {\n "description": "Unique identifier for a given instance of the publishing application",\n "type": "string"\n }\n }\n },\n "payload": {\n "type": "object",\n "properties": {\n "user": {\n "$ref": "#/components/schemas/userCreate"\n },\n "signup": {\n "$ref": "#/components/schemas/signup"\n }\n }\n }\n },\n "bindings": {\n "amqp": {\n "ack": false\n }\n },\n "traits": [\n { "$ref": "#/components/operationTraits/kafka" }\n ]\n}\n```\n\n```yaml\noperationId: registerUser\nsummary: Action to sign a user up.\ndescription: A longer description\ntags:\n - name: user\n - name: signup\n - name: register\nmessage:\n headers:\n type: object\n properties:\n applicationInstanceId:\n description: Unique identifier for a given instance of the publishing application\n type: string\n payload:\n type: object\n properties:\n user:\n $ref: "#/components/schemas/userCreate"\n signup:\n $ref: "#/components/schemas/signup"\nbindings:\n amqp:\n ack: false\ntraits:\n - $ref: "#/components/operationTraits/kafka"\n```', + docs: '[Operation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationObject)\n\\\n\\\nA definition of the PUBLISH operation, which defines the messages consumed by the application from the channel.\n\\\n\\\nDescribes a publish or a subscribe operation. This provides a place to document how and why messages are sent and received.\n\\\n\\\nFor example, an operation might describe a chat application use case where a user sends a text message to a group. A publish operation describes messages that are received by the chat application, whereas a subscribe operation describes messages that are sent by the chat application.\n\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\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.\nsummary | `string` | A short summary of what the operation is about.\ndescription | `string` | A verbose explanation of the operation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\ntags | [Tags Object](https://www.asyncapi.com/docs/specifications/v2.3.0#tagsObject) | A list of tags for API documentation control. Tags can be used for logical grouping of operations.\nexternalDocs | [External Documentation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#externalDocumentationObject) | Additional external documentation for this operation.\nbindings | [Operation Bindings Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationBindingsObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the operation.\ntraits | [[Operation Trait Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) ] | A list of traits to apply to the operation object. Traits MUST be merged into the operation object using the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) algorithm in the same order they are defined here.\nmessage | [Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | Map["oneOf", [[Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject)]] | A definition of the message that will be published or received by this operation. Map containing a single `oneOf` key is allowed here to specify multiple messages. However, **a message MUST be valid only against one of the message objects.**\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Operation Object Example\n\n\n\\\nJSON\n```json\n{\n "operationId": "registerUser",\n "summary": "Action to sign a user up.",\n "description": "A longer description",\n "tags": [\n { "name": "user" },\n { "name": "signup" },\n { "name": "register" }\n ],\n "message": {\n "headers": {\n "type": "object",\n "properties": {\n "applicationInstanceId": {\n "description": "Unique identifier for a given instance of the publishing application",\n "type": "string"\n }\n }\n },\n "payload": {\n "type": "object",\n "properties": {\n "user": {\n "$ref": "#/components/schemas/userCreate"\n },\n "signup": {\n "$ref": "#/components/schemas/signup"\n }\n }\n }\n },\n "bindings": {\n "amqp": {\n "ack": false\n }\n },\n "traits": [\n { "$ref": "#/components/operationTraits/kafka" }\n ]\n}\n```\n\n\n\\\nYAML\n```yaml\noperationId: registerUser\nsummary: Action to sign a user up.\ndescription: A longer description\ntags:\n - name: user\n - name: signup\n - name: register\nmessage:\n headers:\n type: object\n properties:\n applicationInstanceId:\n description: Unique identifier for a given instance of the publishing application\n type: string\n payload:\n type: object\n properties:\n user:\n $ref: "#/components/schemas/userCreate"\n signup:\n $ref: "#/components/schemas/signup"\nbindings:\n amqp:\n ack: false\ntraits:\n - $ref: "#/components/operationTraits/kafka"\n```', }, { target: 'parameters', diff --git a/packages/apidom-ls/src/config/asyncapi/contact/docs/contact.ts b/packages/apidom-ls/src/config/asyncapi/contact/docs/contact.ts index 917104467..7caadc304 100644 --- a/packages/apidom-ls/src/config/asyncapi/contact/docs/contact.ts +++ b/packages/apidom-ls/src/config/asyncapi/contact/docs/contact.ts @@ -12,7 +12,7 @@ const contactDocs = [ docs: 'The email address of the contact person/organization. **MUST** be in the format of an email address.', }, { - docs: '#### Contact Object\n\nContact information for the exposed API.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\nname | `string` | The identifying name of the contact person/organization.\nurl | `string` | The URL pointing to the contact information. MUST be in the format of a URL.\nemail | `string` | The email address of the contact person/organization. MUST be in the format of an email address.\n\n\\\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Contact Object Example:\n\n```json\n{\n "name": "API Support",\n "url": "https://www.example.com/support",\n "email": "support@example.com"\n}\n```\n\n```yaml\nname: API Support\nurl: https://www.example.com/support\nemail: support@example.com\n```', + docs: '#### Contact Object\n\nContact information for the exposed API.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\nname | `string` | The identifying name of the contact person/organization.\nurl | `string` | The URL pointing to the contact information. MUST be in the format of a URL.\nemail | `string` | The email address of the contact person/organization. MUST be in the format of an email address.\n\n\\\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Contact Object Example:\n\n\n\\\nJSON\n```json\n{\n "name": "API Support",\n "url": "https://www.example.com/support",\n "email": "support@example.com"\n}\n```\n\n\n\\\nYAML\n```yaml\nname: API Support\nurl: https://www.example.com/support\nemail: support@example.com\n```', }, ]; export default contactDocs; diff --git a/packages/apidom-ls/src/config/asyncapi/external-documentation/docs/externaldocs.ts b/packages/apidom-ls/src/config/asyncapi/external-documentation/docs/externaldocs.ts index 8e59d673e..26f18c5a9 100644 --- a/packages/apidom-ls/src/config/asyncapi/external-documentation/docs/externaldocs.ts +++ b/packages/apidom-ls/src/config/asyncapi/external-documentation/docs/externaldocs.ts @@ -1,6 +1,6 @@ const externalDocsDocs = [ { - docs: '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', + docs: '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n\n\\\nJSON\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n\n\\\nYAML\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', }, { target: 'url', diff --git a/packages/apidom-ls/src/config/asyncapi/license/docs/license.ts b/packages/apidom-ls/src/config/asyncapi/license/docs/license.ts index 233ba90e0..b6dac3756 100644 --- a/packages/apidom-ls/src/config/asyncapi/license/docs/license.ts +++ b/packages/apidom-ls/src/config/asyncapi/license/docs/license.ts @@ -8,7 +8,7 @@ const licenseDocs = [ docs: 'A URL to the license used for the API. **MUST** be in the format of a URL.', }, { - docs: '#### License Object\n\nLicense information for the exposed API.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\nname | `string` | **Required.** The license name used for the API.\nurl | `string` | A URL to the license used for the API. MUST be in the format of a URL.\n\n\\\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### License Object Example:\n\n```json\n{\n "name": "Apache 2.0",\n "url": "https://www.apache.org/licenses/LICENSE-2.0.html"\n}\n```\n\n```yaml\nname: Apache 2.0\nurl: https://www.apache.org/licenses/LICENSE-2.0.html\n```', + docs: '#### License Object\n\nLicense information for the exposed API.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\nname | `string` | **Required.** The license name used for the API.\nurl | `string` | A URL to the license used for the API. MUST be in the format of a URL.\n\n\\\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### License Object Example:\n\n\n\\\nJSON\n```json\n{\n "name": "Apache 2.0",\n "url": "https://www.apache.org/licenses/LICENSE-2.0.html"\n}\n```\n\n\n\\\nYAML\n```yaml\nname: Apache 2.0\nurl: https://www.apache.org/licenses/LICENSE-2.0.html\n```', }, ]; export default licenseDocs; diff --git a/packages/apidom-ls/src/config/asyncapi/operation/docs/operation.ts b/packages/apidom-ls/src/config/asyncapi/operation/docs/operation.ts index 91203d42f..d355bf413 100644 --- a/packages/apidom-ls/src/config/asyncapi/operation/docs/operation.ts +++ b/packages/apidom-ls/src/config/asyncapi/operation/docs/operation.ts @@ -32,7 +32,7 @@ const operationDocs = [ docs: '[Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | Map["oneOf", [[Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject)]]\n\\\n\\\nA definition of the message that will be published or received by this operation. Map containing a single `oneOf` key is allowed here to specify multiple messages. However, **a message MUST be valid only against one of the message objects.**', }, { - docs: '#### Operation Object\n\nDescribes a publish or a subscribe operation. This provides a place to document how and why messages are sent and received.\n\\\n\\\nFor example, an operation might describe a chat application use case where a user sends a text message to a group. A publish operation describes messages that are received by the chat application, whereas a subscribe operation describes messages that are sent by the chat application.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\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.\nsummary | `string` | A short summary of what the operation is about.\ndescription | `string` | A verbose explanation of the operation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\ntags | [Tags Object](https://www.asyncapi.com/docs/specifications/v2.3.0#tagsObject) | A list of tags for API documentation control. Tags can be used for logical grouping of operations.\nexternalDocs | [External Documentation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#externalDocumentationObject) | Additional external documentation for this operation.\nbindings | [Operation Bindings Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationBindingsObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the operation.\ntraits | [[Operation Trait Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) ] | A list of traits to apply to the operation object. Traits MUST be merged into the operation object using the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) algorithm in the same order they are defined here.\nmessage | [Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | Map["oneOf", [[Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject)]] | A definition of the message that will be published or received by this operation. Map containing a single `oneOf` key is allowed here to specify multiple messages. However, **a message MUST be valid only against one of the message objects.**\n\n\\\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Operation Object Example\n\n```json\n{\n "operationId": "registerUser",\n "summary": "Action to sign a user up.",\n "description": "A longer description",\n "tags": [\n { "name": "user" },\n { "name": "signup" },\n { "name": "register" }\n ],\n "message": {\n "headers": {\n "type": "object",\n "properties": {\n "applicationInstanceId": {\n "description": "Unique identifier for a given instance of the publishing application",\n "type": "string"\n }\n }\n },\n "payload": {\n "type": "object",\n "properties": {\n "user": {\n "$ref": "#/components/schemas/userCreate"\n },\n "signup": {\n "$ref": "#/components/schemas/signup"\n }\n }\n }\n },\n "bindings": {\n "amqp": {\n "ack": false\n }\n },\n "traits": [\n { "$ref": "#/components/operationTraits/kafka" }\n ]\n}\n```\n\n```yaml\noperationId: registerUser\nsummary: Action to sign a user up.\ndescription: A longer description\ntags:\n - name: user\n - name: signup\n - name: register\nmessage:\n headers:\n type: object\n properties:\n applicationInstanceId:\n description: Unique identifier for a given instance of the publishing application\n type: string\n payload:\n type: object\n properties:\n user:\n $ref: "#/components/schemas/userCreate"\n signup:\n $ref: "#/components/schemas/signup"\nbindings:\n amqp:\n ack: false\ntraits:\n - $ref: "#/components/operationTraits/kafka"\n```', + docs: '#### Operation Object\n\nDescribes a publish or a subscribe operation. This provides a place to document how and why messages are sent and received.\n\\\n\\\nFor example, an operation might describe a chat application use case where a user sends a text message to a group. A publish operation describes messages that are received by the chat application, whereas a subscribe operation describes messages that are sent by the chat application.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\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.\nsummary | `string` | A short summary of what the operation is about.\ndescription | `string` | A verbose explanation of the operation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\ntags | [Tags Object](https://www.asyncapi.com/docs/specifications/v2.3.0#tagsObject) | A list of tags for API documentation control. Tags can be used for logical grouping of operations.\nexternalDocs | [External Documentation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#externalDocumentationObject) | Additional external documentation for this operation.\nbindings | [Operation Bindings Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationBindingsObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the operation.\ntraits | [[Operation Trait Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) ] | A list of traits to apply to the operation object. Traits MUST be merged into the operation object using the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) algorithm in the same order they are defined here.\nmessage | [Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | Map["oneOf", [[Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject)]] | A definition of the message that will be published or received by this operation. Map containing a single `oneOf` key is allowed here to specify multiple messages. However, **a message MUST be valid only against one of the message objects.**\n\n\\\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Operation Object Example\n\n\n\\\nJSON\n```json\n{\n "operationId": "registerUser",\n "summary": "Action to sign a user up.",\n "description": "A longer description",\n "tags": [\n { "name": "user" },\n { "name": "signup" },\n { "name": "register" }\n ],\n "message": {\n "headers": {\n "type": "object",\n "properties": {\n "applicationInstanceId": {\n "description": "Unique identifier for a given instance of the publishing application",\n "type": "string"\n }\n }\n },\n "payload": {\n "type": "object",\n "properties": {\n "user": {\n "$ref": "#/components/schemas/userCreate"\n },\n "signup": {\n "$ref": "#/components/schemas/signup"\n }\n }\n }\n },\n "bindings": {\n "amqp": {\n "ack": false\n }\n },\n "traits": [\n { "$ref": "#/components/operationTraits/kafka" }\n ]\n}\n```\n\n\n\\\nYAML\n```yaml\noperationId: registerUser\nsummary: Action to sign a user up.\ndescription: A longer description\ntags:\n - name: user\n - name: signup\n - name: register\nmessage:\n headers:\n type: object\n properties:\n applicationInstanceId:\n description: Unique identifier for a given instance of the publishing application\n type: string\n payload:\n type: object\n properties:\n user:\n $ref: "#/components/schemas/userCreate"\n signup:\n $ref: "#/components/schemas/signup"\nbindings:\n amqp:\n ack: false\ntraits:\n - $ref: "#/components/operationTraits/kafka"\n```', }, ]; export default operationDocs; diff --git a/packages/apidom-ls/src/config/asyncapi/parameter/docs/parameter.ts b/packages/apidom-ls/src/config/asyncapi/parameter/docs/parameter.ts index f3835f2a8..a1f08340f 100644 --- a/packages/apidom-ls/src/config/asyncapi/parameter/docs/parameter.ts +++ b/packages/apidom-ls/src/config/asyncapi/parameter/docs/parameter.ts @@ -16,7 +16,7 @@ const parameterDocs = [ docs: 'A reference to a parameter.', }, { - docs: '#### Parameter Object\n\nDescribes a parameter included in a channel name.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A verbose explanation of the parameter. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nschema | [Schema Object](https://www.asyncapi.com/docs/specifications/v2.3.0#schemaObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | Definition of the parameter.\nlocation | `string` | A [runtime expression](https://www.asyncapi.com/docs/specifications/v2.3.0#runtimeExpression) that specifies the location of the parameter value. Even when a definition for the target field exists, it MUST NOT be used to validate this parameter but, instead, the `schema` property MUST be used.\n\n\\\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Parameter Object Example\n\n```json\n{\n "user/{userId}/signup": {\n "parameters": {\n "userId": {\n "description": "Id of the user.",\n "schema": {\n "type": "string"\n },\n "location": "$message.payload#/user/id"\n }\n },\n "subscribe": {\n "message": {\n "$ref": "#/components/messages/userSignedUp"\n }\n }\n }\n}\n```\n\n```yaml\nuser/{userId}/signup:\n parameters:\n userId:\n description: Id of the user.\n schema:\n type: string\n location: $message.payload#/user/id\n subscribe:\n message:\n $ref: "#/components/messages/userSignedUp"\n```', + docs: '#### Parameter Object\n\nDescribes a parameter included in a channel name.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A verbose explanation of the parameter. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nschema | [Schema Object](https://www.asyncapi.com/docs/specifications/v2.3.0#schemaObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | Definition of the parameter.\nlocation | `string` | A [runtime expression](https://www.asyncapi.com/docs/specifications/v2.3.0#runtimeExpression) that specifies the location of the parameter value. Even when a definition for the target field exists, it MUST NOT be used to validate this parameter but, instead, the `schema` property MUST be used.\n\n\\\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Parameter Object Example\n\n\n\\\nJSON\n```json\n{\n "user/{userId}/signup": {\n "parameters": {\n "userId": {\n "description": "Id of the user.",\n "schema": {\n "type": "string"\n },\n "location": "$message.payload#/user/id"\n }\n },\n "subscribe": {\n "message": {\n "$ref": "#/components/messages/userSignedUp"\n }\n }\n }\n}\n```\n\n\n\\\nYAML\n```yaml\nuser/{userId}/signup:\n parameters:\n userId:\n description: Id of the user.\n schema:\n type: string\n location: $message.payload#/user/id\n subscribe:\n message:\n $ref: "#/components/messages/userSignedUp"\n```', }, ]; export default parameterDocs; diff --git a/packages/apidom-ls/src/config/asyncapi/server/docs/server.ts b/packages/apidom-ls/src/config/asyncapi/server/docs/server.ts index 191eaad1b..e6af21282 100644 --- a/packages/apidom-ls/src/config/asyncapi/server/docs/server.ts +++ b/packages/apidom-ls/src/config/asyncapi/server/docs/server.ts @@ -28,7 +28,7 @@ const serverDocs = [ docs: '[Server Bindings Object](https://www.asyncapi.com/docs/specifications/v2.3.0#serverBindingsObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject)\n\\\n\\\nA map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the server.', }, { - docs: '#### Server Object\n\nAn object representing a message broker, a server or any other kind of computer program capable of sending and/or receiving data. This object is used to capture details such as URIs, protocols and security configuration. Variable substitution can be used so that some details, for example usernames and passwords, can be injected by code generation tools.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\nurl | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the AsyncAPI document is being served. Variable substitutions will be made when a variable is named in `{`braces`}`.\nprotocol | `string` | **REQUIRED**. The protocol this URL supports for connection. Supported protocol include, but are not limited to: `amqp`, `amqps`, `http`, `https`, `ibmmq`, `jms`, `kafka`, `kafka-secure`, `anypointmq`, `mqtt`, `secure-mqtt`, `solace`, `stomp`, `stomps`, `ws`, `wss`, `mercure`.\nprotocolVersion | `string` | The version of the protocol used for connection. For instance: AMQP `0.9.1`, HTTP `2.0`, Kafka `1.0.0`, etc.\ndescription | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.\nvariables | Map[`string`, [Server Variable Object](https://www.asyncapi.com/docs/specifications/v2.3.0#serverVariableObject)] | A map between a variable name and its value. The value is used for substitution in the server\'s URL template.\nsecurity | [[Security Requirement Object](https://www.asyncapi.com/docs/specifications/v2.3.0#securityRequirementObject)] | A declaration of which security mechanisms can be used with this server. 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 connection or operation.\nbindings | [Server Bindings Object](https://www.asyncapi.com/docs/specifications/v2.3.0#serverBindingsObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the server.\n\nThis object MAY be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Server Object Example\n\nA single server would be described as:\n\n```json\n{\n "url": "development.gigantic-server.com",\n "description": "Development server",\n "protocol": "kafka",\n "protocolVersion": "1.0.0"\n}\n```\n\n```yaml\nurl: development.gigantic-server.com\ndescription: Development server\nprotocol: kafka\nprotocolVersion: \'1.0.0\'\n```\n\nThe following shows how multiple servers can be described, for example, at the AsyncAPI Object\'s [`servers`](https://www.asyncapi.com/docs/specifications/v2.3.0#A2SServers):\n\n```json\n{\n "servers": {\n "development": {\n "url": "development.gigantic-server.com",\n "description": "Development server",\n "protocol": "amqp",\n "protocolVersion": "0.9.1"\n },\n "staging": {\n "url": "staging.gigantic-server.com",\n "description": "Staging server",\n "protocol": "amqp",\n "protocolVersion": "0.9.1"\n },\n "production": {\n "url": "api.gigantic-server.com",\n "description": "Production server",\n "protocol": "amqp",\n "protocolVersion": "0.9.1"\n }\n }\n}\n```\n\n```yaml\nservers:\n development:\n url: development.gigantic-server.com\n description: Development server\n protocol: amqp\n protocolVersion: 0.9.1\n staging:\n url: staging.gigantic-server.com\n description: Staging server\n protocol: amqp\n protocolVersion: 0.9.1\n production:\n url: api.gigantic-server.com\n description: Production server\n protocol: amqp\n protocolVersion: 0.9.1\n```', + docs: '#### Server Object\n\nAn object representing a message broker, a server or any other kind of computer program capable of sending and/or receiving data. This object is used to capture details such as URIs, protocols and security configuration. Variable substitution can be used so that some details, for example usernames and passwords, can be injected by code generation tools.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\nurl | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the AsyncAPI document is being served. Variable substitutions will be made when a variable is named in `{`braces`}`.\nprotocol | `string` | **REQUIRED**. The protocol this URL supports for connection. Supported protocol include, but are not limited to: `amqp`, `amqps`, `http`, `https`, `ibmmq`, `jms`, `kafka`, `kafka-secure`, `anypointmq`, `mqtt`, `secure-mqtt`, `solace`, `stomp`, `stomps`, `ws`, `wss`, `mercure`.\nprotocolVersion | `string` | The version of the protocol used for connection. For instance: AMQP `0.9.1`, HTTP `2.0`, Kafka `1.0.0`, etc.\ndescription | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.\nvariables | Map[`string`, [Server Variable Object](https://www.asyncapi.com/docs/specifications/v2.3.0#serverVariableObject)] | A map between a variable name and its value. The value is used for substitution in the server\'s URL template.\nsecurity | [[Security Requirement Object](https://www.asyncapi.com/docs/specifications/v2.3.0#securityRequirementObject)] | A declaration of which security mechanisms can be used with this server. 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 connection or operation.\nbindings | [Server Bindings Object](https://www.asyncapi.com/docs/specifications/v2.3.0#serverBindingsObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the server.\n\nThis object MAY be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Server Object Example\n\nA single server would be described as:\n\n\n\\\nJSON\n```json\n{\n "url": "development.gigantic-server.com",\n "description": "Development server",\n "protocol": "kafka",\n "protocolVersion": "1.0.0"\n}\n```\n\n\n\\\nYAML\n```yaml\nurl: development.gigantic-server.com\ndescription: Development server\nprotocol: kafka\nprotocolVersion: \'1.0.0\'\n```\n\nThe following shows how multiple servers can be described, for example, at the AsyncAPI Object\'s [`servers`](https://www.asyncapi.com/docs/specifications/v2.3.0#A2SServers):\n\n\n\\\nJSON\n```json\n{\n "servers": {\n "development": {\n "url": "development.gigantic-server.com",\n "description": "Development server",\n "protocol": "amqp",\n "protocolVersion": "0.9.1"\n },\n "staging": {\n "url": "staging.gigantic-server.com",\n "description": "Staging server",\n "protocol": "amqp",\n "protocolVersion": "0.9.1"\n },\n "production": {\n "url": "api.gigantic-server.com",\n "description": "Production server",\n "protocol": "amqp",\n "protocolVersion": "0.9.1"\n }\n }\n}\n```\n\n\n\\\nYAML\n```yaml\nservers:\n development:\n url: development.gigantic-server.com\n description: Development server\n protocol: amqp\n protocolVersion: 0.9.1\n staging:\n url: staging.gigantic-server.com\n description: Staging server\n protocol: amqp\n protocolVersion: 0.9.1\n production:\n url: api.gigantic-server.com\n description: Production server\n protocol: amqp\n protocolVersion: 0.9.1\n```', }, ]; export default serverDocs; diff --git a/packages/apidom-ls/src/config/asyncapi/servers/docs/servers.ts b/packages/apidom-ls/src/config/asyncapi/servers/docs/servers.ts index f67f8161d..061f6aa80 100644 --- a/packages/apidom-ls/src/config/asyncapi/servers/docs/servers.ts +++ b/packages/apidom-ls/src/config/asyncapi/servers/docs/servers.ts @@ -1,6 +1,6 @@ const serversDocs = [ { - docs: '#### [Servers Object](https://www.asyncapi.com/docs/specifications/v2.3.0#serversObject)\n\nThe Servers Object is a map of [Server Objects](https://www.asyncapi.com/docs/specifications/v2.3.0#serverObject).\n\n##### Patterned Fields\n\nField Pattern | Type | Description\n---|:---:|---\n`^[A-Za-z0-9_\\-]+$` | [Server Object](https://www.asyncapi.com/docs/specifications/v2.3.0#serverObject) | The definition of a server this application MAY connect to.\n\n##### Servers Object Example\n\n```json\n{\n "production": {\n "url": "development.gigantic-server.com",\n "description": "Development server",\n "protocol": "kafka",\n "protocolVersion": "1.0.0"\n }\n}\n```\n\n```yaml\nproduction:\n url: development.gigantic-server.com\n description: Development server\n protocol: kafka\n protocolVersion: \'1.0.0\'\n```', + docs: '#### [Servers Object](https://www.asyncapi.com/docs/specifications/v2.3.0#serversObject)\n\nThe Servers Object is a map of [Server Objects](https://www.asyncapi.com/docs/specifications/v2.3.0#serverObject).\n\n##### Patterned Fields\n\nField Pattern | Type | Description\n---|:---:|---\n`^[A-Za-z0-9_\\-]+$` | [Server Object](https://www.asyncapi.com/docs/specifications/v2.3.0#serverObject) | The definition of a server this application MAY connect to.\n\n##### Servers Object Example\n\n\n\\\nJSON\n```json\n{\n "production": {\n "url": "development.gigantic-server.com",\n "description": "Development server",\n "protocol": "kafka",\n "protocolVersion": "1.0.0"\n }\n}\n```\n\n\n\\\nYAML\n```yaml\nproduction:\n url: development.gigantic-server.com\n description: Development server\n protocol: kafka\n protocolVersion: \'1.0.0\'\n```', }, ]; export default serversDocs; diff --git a/packages/apidom-ls/test/asyncapi-json.ts b/packages/apidom-ls/test/asyncapi-json.ts index a6756d3c6..c61b79fbb 100644 --- a/packages/apidom-ls/test/asyncapi-json.ts +++ b/packages/apidom-ls/test/asyncapi-json.ts @@ -148,7 +148,7 @@ const completionTestInput = [ documentation: { kind: 'markdown', value: - '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', + '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n\n\\\nJSON\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n\n\\\nYAML\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', }, }, ], @@ -246,7 +246,7 @@ const completionTestInput = [ documentation: { kind: 'markdown', value: - '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', + '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n\n\\\nJSON\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n\n\\\nYAML\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', }, }, ], @@ -344,7 +344,7 @@ const completionTestInput = [ documentation: { kind: 'markdown', value: - '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', + '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n\n\\\nJSON\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n\n\\\nYAML\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', }, }, ], @@ -362,7 +362,7 @@ const hoverTestInput = [ contents: { kind: 'markdown', value: - '***subscribe***: **operation**\n\n[Operation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationObject)\n\\\n\\\nA definition of the SUBSCRIBE operation, which defines the messages produced by the application and sent to the channel.\n\\\n\\\nDescribes a publish or a subscribe operation. This provides a place to document how and why messages are sent and received.\n\\\n\\\nFor example, an operation might describe a chat application use case where a user sends a text message to a group. A publish operation describes messages that are received by the chat application, whereas a subscribe operation describes messages that are sent by the chat application.\n\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\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.\nsummary | `string` | A short summary of what the operation is about.\ndescription | `string` | A verbose explanation of the operation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\ntags | [Tags Object](https://www.asyncapi.com/docs/specifications/v2.3.0#tagsObject) | A list of tags for API documentation control. Tags can be used for logical grouping of operations.\nexternalDocs | [External Documentation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#externalDocumentationObject) | Additional external documentation for this operation.\nbindings | [Operation Bindings Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationBindingsObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the operation.\ntraits | [[Operation Trait Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) ] | A list of traits to apply to the operation object. Traits MUST be merged into the operation object using the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) algorithm in the same order they are defined here.\nmessage | [Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | Map["oneOf", [[Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject)]] | A definition of the message that will be published or received by this operation. Map containing a single `oneOf` key is allowed here to specify multiple messages. However, **a message MUST be valid only against one of the message objects.**\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Operation Object Example\n\n```json\n{\n "operationId": "registerUser",\n "summary": "Action to sign a user up.",\n "description": "A longer description",\n "tags": [\n { "name": "user" },\n { "name": "signup" },\n { "name": "register" }\n ],\n "message": {\n "headers": {\n "type": "object",\n "properties": {\n "applicationInstanceId": {\n "description": "Unique identifier for a given instance of the publishing application",\n "type": "string"\n }\n }\n },\n "payload": {\n "type": "object",\n "properties": {\n "user": {\n "$ref": "#/components/schemas/userCreate"\n },\n "signup": {\n "$ref": "#/components/schemas/signup"\n }\n }\n }\n },\n "bindings": {\n "amqp": {\n "ack": false\n }\n },\n "traits": [\n { "$ref": "#/components/operationTraits/kafka" }\n ]\n}\n```\n\n```yaml\noperationId: registerUser\nsummary: Action to sign a user up.\ndescription: A longer description\ntags:\n - name: user\n - name: signup\n - name: register\nmessage:\n headers:\n type: object\n properties:\n applicationInstanceId:\n description: Unique identifier for a given instance of the publishing application\n type: string\n payload:\n type: object\n properties:\n user:\n $ref: "#/components/schemas/userCreate"\n signup:\n $ref: "#/components/schemas/signup"\nbindings:\n amqp:\n ack: false\ntraits:\n - $ref: "#/components/operationTraits/kafka"\n```', + '***subscribe***: **operation**\n\n[Operation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationObject)\n\\\n\\\nA definition of the SUBSCRIBE operation, which defines the messages produced by the application and sent to the channel.\n\\\n\\\nDescribes a publish or a subscribe operation. This provides a place to document how and why messages are sent and received.\n\\\n\\\nFor example, an operation might describe a chat application use case where a user sends a text message to a group. A publish operation describes messages that are received by the chat application, whereas a subscribe operation describes messages that are sent by the chat application.\n\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\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.\nsummary | `string` | A short summary of what the operation is about.\ndescription | `string` | A verbose explanation of the operation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\ntags | [Tags Object](https://www.asyncapi.com/docs/specifications/v2.3.0#tagsObject) | A list of tags for API documentation control. Tags can be used for logical grouping of operations.\nexternalDocs | [External Documentation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#externalDocumentationObject) | Additional external documentation for this operation.\nbindings | [Operation Bindings Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationBindingsObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the operation.\ntraits | [[Operation Trait Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) ] | A list of traits to apply to the operation object. Traits MUST be merged into the operation object using the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) algorithm in the same order they are defined here.\nmessage | [Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | Map["oneOf", [[Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject)]] | A definition of the message that will be published or received by this operation. Map containing a single `oneOf` key is allowed here to specify multiple messages. However, **a message MUST be valid only against one of the message objects.**\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Operation Object Example\n\n\n\\\nJSON\n```json\n{\n "operationId": "registerUser",\n "summary": "Action to sign a user up.",\n "description": "A longer description",\n "tags": [\n { "name": "user" },\n { "name": "signup" },\n { "name": "register" }\n ],\n "message": {\n "headers": {\n "type": "object",\n "properties": {\n "applicationInstanceId": {\n "description": "Unique identifier for a given instance of the publishing application",\n "type": "string"\n }\n }\n },\n "payload": {\n "type": "object",\n "properties": {\n "user": {\n "$ref": "#/components/schemas/userCreate"\n },\n "signup": {\n "$ref": "#/components/schemas/signup"\n }\n }\n }\n },\n "bindings": {\n "amqp": {\n "ack": false\n }\n },\n "traits": [\n { "$ref": "#/components/operationTraits/kafka" }\n ]\n}\n```\n\n\n\\\nYAML\n```yaml\noperationId: registerUser\nsummary: Action to sign a user up.\ndescription: A longer description\ntags:\n - name: user\n - name: signup\n - name: register\nmessage:\n headers:\n type: object\n properties:\n applicationInstanceId:\n description: Unique identifier for a given instance of the publishing application\n type: string\n payload:\n type: object\n properties:\n user:\n $ref: "#/components/schemas/userCreate"\n signup:\n $ref: "#/components/schemas/signup"\nbindings:\n amqp:\n ack: false\ntraits:\n - $ref: "#/components/operationTraits/kafka"\n```', }, range: { start: { line: 10, character: 6 }, end: { line: 10, character: 17 } }, }, diff --git a/packages/apidom-ls/test/asyncapi-yaml.ts b/packages/apidom-ls/test/asyncapi-yaml.ts index 652ab1e29..75b24644e 100644 --- a/packages/apidom-ls/test/asyncapi-yaml.ts +++ b/packages/apidom-ls/test/asyncapi-yaml.ts @@ -177,7 +177,7 @@ const completionTestInput = [ documentation: { kind: 'markdown', value: - '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', + '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n\n\\\nJSON\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n\n\\\nYAML\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', }, }, ], @@ -264,7 +264,7 @@ const completionTestInput = [ documentation: { kind: 'markdown', value: - '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', + '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n\n\\\nJSON\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n\n\\\nYAML\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', }, }, ], @@ -282,7 +282,7 @@ const hoverTestInput = [ contents: { kind: 'markdown', value: - '***subscribe***: **operation**\n\n[Operation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationObject)\n\\\n\\\nA definition of the SUBSCRIBE operation, which defines the messages produced by the application and sent to the channel.\n\\\n\\\nDescribes a publish or a subscribe operation. This provides a place to document how and why messages are sent and received.\n\\\n\\\nFor example, an operation might describe a chat application use case where a user sends a text message to a group. A publish operation describes messages that are received by the chat application, whereas a subscribe operation describes messages that are sent by the chat application.\n\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\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.\nsummary | `string` | A short summary of what the operation is about.\ndescription | `string` | A verbose explanation of the operation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\ntags | [Tags Object](https://www.asyncapi.com/docs/specifications/v2.3.0#tagsObject) | A list of tags for API documentation control. Tags can be used for logical grouping of operations.\nexternalDocs | [External Documentation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#externalDocumentationObject) | Additional external documentation for this operation.\nbindings | [Operation Bindings Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationBindingsObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the operation.\ntraits | [[Operation Trait Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) ] | A list of traits to apply to the operation object. Traits MUST be merged into the operation object using the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) algorithm in the same order they are defined here.\nmessage | [Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | Map["oneOf", [[Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject)]] | A definition of the message that will be published or received by this operation. Map containing a single `oneOf` key is allowed here to specify multiple messages. However, **a message MUST be valid only against one of the message objects.**\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Operation Object Example\n\n```json\n{\n "operationId": "registerUser",\n "summary": "Action to sign a user up.",\n "description": "A longer description",\n "tags": [\n { "name": "user" },\n { "name": "signup" },\n { "name": "register" }\n ],\n "message": {\n "headers": {\n "type": "object",\n "properties": {\n "applicationInstanceId": {\n "description": "Unique identifier for a given instance of the publishing application",\n "type": "string"\n }\n }\n },\n "payload": {\n "type": "object",\n "properties": {\n "user": {\n "$ref": "#/components/schemas/userCreate"\n },\n "signup": {\n "$ref": "#/components/schemas/signup"\n }\n }\n }\n },\n "bindings": {\n "amqp": {\n "ack": false\n }\n },\n "traits": [\n { "$ref": "#/components/operationTraits/kafka" }\n ]\n}\n```\n\n```yaml\noperationId: registerUser\nsummary: Action to sign a user up.\ndescription: A longer description\ntags:\n - name: user\n - name: signup\n - name: register\nmessage:\n headers:\n type: object\n properties:\n applicationInstanceId:\n description: Unique identifier for a given instance of the publishing application\n type: string\n payload:\n type: object\n properties:\n user:\n $ref: "#/components/schemas/userCreate"\n signup:\n $ref: "#/components/schemas/signup"\nbindings:\n amqp:\n ack: false\ntraits:\n - $ref: "#/components/operationTraits/kafka"\n```', + '***subscribe***: **operation**\n\n[Operation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationObject)\n\\\n\\\nA definition of the SUBSCRIBE operation, which defines the messages produced by the application and sent to the channel.\n\\\n\\\nDescribes a publish or a subscribe operation. This provides a place to document how and why messages are sent and received.\n\\\n\\\nFor example, an operation might describe a chat application use case where a user sends a text message to a group. A publish operation describes messages that are received by the chat application, whereas a subscribe operation describes messages that are sent by the chat application.\n\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\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.\nsummary | `string` | A short summary of what the operation is about.\ndescription | `string` | A verbose explanation of the operation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\ntags | [Tags Object](https://www.asyncapi.com/docs/specifications/v2.3.0#tagsObject) | A list of tags for API documentation control. Tags can be used for logical grouping of operations.\nexternalDocs | [External Documentation Object](https://www.asyncapi.com/docs/specifications/v2.3.0#externalDocumentationObject) | Additional external documentation for this operation.\nbindings | [Operation Bindings Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationBindingsObject) \\| [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the operation.\ntraits | [[Operation Trait Object](https://www.asyncapi.com/docs/specifications/v2.3.0#operationTraitObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) ] | A list of traits to apply to the operation object. Traits MUST be merged into the operation object using the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) algorithm in the same order they are defined here.\nmessage | [Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject) | Map["oneOf", [[Message Object](https://www.asyncapi.com/docs/specifications/v2.3.0#messageObject) | [Reference Object](https://www.asyncapi.com/docs/specifications/v2.3.0#referenceObject)]] | A definition of the message that will be published or received by this operation. Map containing a single `oneOf` key is allowed here to specify multiple messages. However, **a message MUST be valid only against one of the message objects.**\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### Operation Object Example\n\n\n\\\nJSON\n```json\n{\n "operationId": "registerUser",\n "summary": "Action to sign a user up.",\n "description": "A longer description",\n "tags": [\n { "name": "user" },\n { "name": "signup" },\n { "name": "register" }\n ],\n "message": {\n "headers": {\n "type": "object",\n "properties": {\n "applicationInstanceId": {\n "description": "Unique identifier for a given instance of the publishing application",\n "type": "string"\n }\n }\n },\n "payload": {\n "type": "object",\n "properties": {\n "user": {\n "$ref": "#/components/schemas/userCreate"\n },\n "signup": {\n "$ref": "#/components/schemas/signup"\n }\n }\n }\n },\n "bindings": {\n "amqp": {\n "ack": false\n }\n },\n "traits": [\n { "$ref": "#/components/operationTraits/kafka" }\n ]\n}\n```\n\n\n\\\nYAML\n```yaml\noperationId: registerUser\nsummary: Action to sign a user up.\ndescription: A longer description\ntags:\n - name: user\n - name: signup\n - name: register\nmessage:\n headers:\n type: object\n properties:\n applicationInstanceId:\n description: Unique identifier for a given instance of the publishing application\n type: string\n payload:\n type: object\n properties:\n user:\n $ref: "#/components/schemas/userCreate"\n signup:\n $ref: "#/components/schemas/signup"\nbindings:\n amqp:\n ack: false\ntraits:\n - $ref: "#/components/operationTraits/kafka"\n```', }, range: { start: { line: 8, character: 4 }, end: { line: 8, character: 13 } }, }, diff --git a/packages/apidom-ls/test/complete.ts b/packages/apidom-ls/test/complete.ts index a2ebbdc7c..83b69e6bc 100644 --- a/packages/apidom-ls/test/complete.ts +++ b/packages/apidom-ls/test/complete.ts @@ -231,7 +231,7 @@ describe('apidom-ls-complete', function () { documentation: { kind: 'markdown', value: - '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', + '#### External Documentation Object\n\\\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A short description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.\nurl | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.\n\nThis object can be extended with [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.3.0#specificationExtensions).\n\n##### External Documentation Object Example\n\n\n\\\nJSON\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n\n\\\nYAML\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', }, }, ], diff --git a/packages/apidom-ls/test/openapi-yaml.ts b/packages/apidom-ls/test/openapi-yaml.ts index f1999ba6c..6c7d4d659 100644 --- a/packages/apidom-ls/test/openapi-yaml.ts +++ b/packages/apidom-ls/test/openapi-yaml.ts @@ -138,7 +138,7 @@ const hoverTestInput = [ contents: { kind: 'markdown', value: - '**operation**\n\nhttps://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationObject\n\n#### Operation Object\n\nDescribes a single API operation on a path.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\n[tags](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationTags) | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.\n[summary](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationSummary) | `string` | A short summary of what the operation does.\n[description](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationDescription) | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.\n[externalDocs](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationExternalDocs) | [External Documentation Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#externalDocumentationObject) | Additional external documentation for this operation.\n[operationId](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationId) | `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.\n[parameters](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationParameters) | [[Parameter Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#parameterObject) \\| [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/master/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/master/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/master/versions/3.1.0.md#parameterName) and [location](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#parameterIn). The list can use the [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/master/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/master/versions/3.1.0.md#componentsParameters).\n[requestBody](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationRequestBody) | [Request Body Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#requestBodyObject) \\| [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/master/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.\n[responses](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationResponses) | [Responses Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#responsesObject) | The list of possible responses as they are returned from executing this operation.\n[callbacks](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationCallbacks) | Map[`string`, [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#callbackObject) \\| [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/master/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/master/versions/3.1.0.md#callbackObject) that describes a request that may be initiated by the API provider and the expected responses.\n[deprecated](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationDeprecated) | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`.\n[security](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationSecurity) | [[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.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/master/versions/3.1.0.md#oasSecurity). To remove a top-level security declaration, an empty array can be used.\n[servers](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationServers) | [[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/master/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\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#specificationExtensions).\n\n##### Operation Object Example\n\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```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```', + '**operation**\n\nhttps://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationObject\n\n#### Operation Object\n\nDescribes a single API operation on a path.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\n[tags](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationTags) | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.\n[summary](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationSummary) | `string` | A short summary of what the operation does.\n[description](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationDescription) | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.\n[externalDocs](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationExternalDocs) | [External Documentation Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#externalDocumentationObject) | Additional external documentation for this operation.\n[operationId](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationId) | `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.\n[parameters](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationParameters) | [[Parameter Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#parameterObject) \\| [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/master/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/master/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/master/versions/3.1.0.md#parameterName) and [location](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#parameterIn). The list can use the [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/master/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/master/versions/3.1.0.md#componentsParameters).\n[requestBody](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationRequestBody) | [Request Body Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#requestBodyObject) \\| [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/master/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.\n[responses](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationResponses) | [Responses Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#responsesObject) | The list of possible responses as they are returned from executing this operation.\n[callbacks](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationCallbacks) | Map[`string`, [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#callbackObject) \\| [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/master/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/master/versions/3.1.0.md#callbackObject) that describes a request that may be initiated by the API provider and the expected responses.\n[deprecated](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationDeprecated) | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`.\n[security](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationSecurity) | [[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.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/master/versions/3.1.0.md#oasSecurity). To remove a top-level security declaration, an empty array can be used.\n[servers](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#operationServers) | [[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/master/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\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/master/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 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```', }, range: { start: { line: 9, character: 4 }, end: { line: 9, character: 8 } }, },