Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/apidom-ls/src/config/openapi/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import operationMeta from './operation/meta';
import parameterMeta from './parameter/meta';
import pathItemMeta from './path-item/meta';
import pathsMeta from './paths/meta';
import requestBodyMeta from './request-body/meta';
import responseMeta from './response/meta';
import responsesMeta from './responses/meta';
import securityRequirementMeta from './security-requirement/meta';
Expand Down Expand Up @@ -52,6 +53,7 @@ export default {
parameter: parameterMeta,
pathItem: pathItemMeta,
paths: pathsMeta,
requestBody: requestBodyMeta,
response: responseMeta,
responses: responsesMeta,
securityRequirement: securityRequirementMeta,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const documentation = [
{
target: 'description',
docs: 'A brief description of the request body. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.',
},
{
target: 'content',
docs: 'Map[`string`, [Media Type Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#mediaTypeObject)]\n\\\n\\\n**REQUIRED**. The content of the request body. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*',
},
{
target: 'required',
docs: 'Determines if the request body is required in the request. Defaults to `false`.',
},
{
docs: '#### Request Body Object\n\nDescribes a single request body.\n\n##### Fixed Fields\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.\ncontent | Map[`string`, [Media Type Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*\nrequired | `boolean` | Determines if the request body is required in the request. Defaults to `false`.\n\n\\\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions).\n\n##### Request Body Examples\n\nA request body with a referenced model definition.\n\n\\\nJSON\n```json\n{\n "description": "user to add to the system",\n "content": {\n "application/json": {\n "schema": {\n "$ref": "#/components/schemas/User"\n },\n "examples": {\n "user" : {\n "summary": "User Example", \n "externalValue": "https://foo.bar/examples/user-example.json"\n } \n }\n },\n "application/xml": {\n "schema": {\n "$ref": "#/components/schemas/User"\n },\n "examples": {\n "user" : {\n "summary": "User example in XML",\n "externalValue": "https://foo.bar/examples/user-example.xml"\n }\n }\n },\n "text/plain": {\n "examples": {\n "user" : {\n "summary": "User example in Plain text",\n "externalValue": "https://foo.bar/examples/user-example.txt" \n }\n } \n },\n "*/*": {\n "examples": {\n "user" : {\n "summary": "User example in other format",\n "externalValue": "https://foo.bar/examples/user-example.whatever"\n }\n }\n }\n }\n}\n```\n\n\n\\\nYAML\n```yaml\ndescription: user to add to the system\ncontent: \n \'application/json\':\n schema:\n $ref: \'#/components/schemas/User\'\n examples:\n user:\n summary: User Example\n externalValue: \'https://foo.bar/examples/user-example.json\'\n \'application/xml\':\n schema:\n $ref: \'#/components/schemas/User\'\n examples:\n user:\n summary: User example in XML\n externalValue: \'https://foo.bar/examples/user-example.xml\'\n \'text/plain\':\n examples:\n user:\n summary: User example in Plain text\n externalValue: \'https://foo.bar/examples/user-example.txt\'\n \'*/*\':\n examples:\n user: \n summary: User example in other format\n externalValue: \'https://foo.bar/examples/user-example.whatever\'\n```\n\nA body parameter that is an array of string values:\n```json\n{\n "description": "user to add to the system",\n "required": true,\n "content": {\n "text/plain": {\n "schema": {\n "type": "array",\n "items": {\n "type": "string"\n }\n }\n }\n }\n}\n```\n\n```yaml\ndescription: user to add to the system\nrequired: true\ncontent:\n text/plain:\n schema:\n type: array\n items:\n type: string\n```',
},
];

export default documentation;
8 changes: 8 additions & 0 deletions packages/apidom-ls/src/config/openapi/request-body/meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import documentation from './documentation';
import { FormatMeta } from '../../../apidom-language-types';

const meta: FormatMeta = {
documentation,
};

export default meta;