diff --git a/packages/apidom-ls/src/config/openapi/config.ts b/packages/apidom-ls/src/config/openapi/config.ts index 574d5c9666..15e2828c04 100644 --- a/packages/apidom-ls/src/config/openapi/config.ts +++ b/packages/apidom-ls/src/config/openapi/config.ts @@ -23,6 +23,7 @@ import securitySchemeMeta from './security-scheme/meta'; import serverMeta from './server/meta'; import serverVariableMeta from './server-variable/meta'; import tagMeta from './tag/meta'; +import xmlMeta from './xml/meta'; import openapi3_1Meta from './openapi3_1/meta'; import schemaMeta from '../common/schema/meta'; import ApilintCodes from '../codes'; @@ -65,6 +66,7 @@ export default { server: serverMeta, serverVariable: serverVariableMeta, tag: tagMeta, + xml: xmlMeta, openApi3_1: openapi3_1Meta, schema: schemaMeta, }; diff --git a/packages/apidom-ls/src/config/openapi/xml/documentation.ts b/packages/apidom-ls/src/config/openapi/xml/documentation.ts new file mode 100644 index 0000000000..350350db44 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/xml/documentation.ts @@ -0,0 +1,34 @@ +const documentation = [ + { + target: 'name', + docs: 'Replaces the name of the element/attribute used for the described schema property. When defined within `items`, it will affect the name of the individual XML elements within the list. When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored.', + }, + { + target: 'namespace', + docs: 'The URI of the namespace definition. This MUST be in the form of an absolute URI.', + }, + { + target: 'prefix', + docs: 'The prefix to be used for the [name](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#xmlName).', + targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + }, + { + target: 'attribute', + docs: 'Declares whether the property definition translates to an attribute instead of an element. Default value is `false`.', + }, + { + target: 'wrapped', + docs: 'MAY be used only for an array definition. Signifies whether the array is wrapped (for example, ``) or unwrapped (``). Default value is `false`. The definition takes effect only when defined alongside `type` being `array` (outside the `items`).', + }, + { + /** + * The original documentation has been trimmed in this implementation for readability purposes + * A new custom section `Additional documentation topics` has been added, + * which adds external links back to the original documentation + */ + docs: '#### XML Object\n\nA metadata object that allows for more fine-tuned XML model definitions.\n\nWhen using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information.\nSee examples for expected behavior.\n\n##### Fixed Fields\nField Name | Type | Description\n---|:---:|---\nname | `string` | Replaces the name of the element/attribute used for the described schema property. When defined within `items`, it will affect the name of the individual XML elements within the list. When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored.\nnamespace | `string` | The URI of the namespace definition. This MUST be in the form of an absolute URI.\nprefix | `string` | The prefix to be used for the [name](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#xmlName).\nattribute | `boolean` | Declares whether the property definition translates to an attribute instead of an element. Default value is `false`.\nwrapped | `boolean` | MAY be used only for an array definition. Signifies whether the array is wrapped (for example, ``) or unwrapped (``). Default value is `false`. The definition takes effect only when defined alongside `type` being `array` (outside the `items`).\n\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions).\n\n\\\n#### Additional documentation topics\n\n##### [XML Object Examples](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#xml-object-examples)\nThe examples of the XML object definitions are included inside a property definition of a [Schema Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schemaObject) with a sample of the XML representation of it.\n\n- [No XML Element](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#no-xml-element)\n- [XML Name Replacement](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#xml-name-replacement)\n- [XML Attribute, Prefix and Namespace](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#xml-attribute-prefix-and-namespace)\n- [XML Arrays](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#xml-arrays)\n', + targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], + }, +]; + +export default documentation; diff --git a/packages/apidom-ls/src/config/openapi/xml/meta.ts b/packages/apidom-ls/src/config/openapi/xml/meta.ts new file mode 100644 index 0000000000..33a6f79694 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/xml/meta.ts @@ -0,0 +1,8 @@ +import documentation from './documentation'; +import { FormatMeta } from '../../../apidom-language-types'; + +const meta: FormatMeta = { + documentation, +}; + +export default meta;