From 3f213b5c67e723413273a564838f11fdfd704c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Gorej?= Date: Wed, 3 Jan 2024 16:58:17 +0100 Subject: [PATCH 1/5] feat(ls): add rules for OpenAPI 2.0 Items Object (#3622) Refs #3605 --- packages/apidom-ls/src/config/codes.ts | 17 + .../apidom-ls/src/config/openapi/config.ts | 2 + .../src/config/openapi/items/completion.ts | 428 ++++++++++++++++++ .../src/config/openapi/items/documentation.ts | 94 ++++ .../openapi/items/lint/allowed-fields.ts | 39 ++ .../items/lint/collection-format--equals.ts | 20 + .../config/openapi/items/lint/enum--type.ts | 20 + .../items/lint/exclusive-maximum--type.ts | 20 + .../items/lint/exclusive-minimum--type.ts | 20 + .../config/openapi/items/lint/format--type.ts | 20 + .../src/config/openapi/items/lint/index.ts | 37 ++ .../openapi/items/lint/items--required.ts | 35 ++ .../config/openapi/items/lint/items--type.ts | 20 + .../openapi/items/lint/max-length--type.ts | 20 + .../openapi/items/lint/maximum--type.ts | 20 + .../openapi/items/lint/min-length--type.ts | 20 + .../openapi/items/lint/minimum--type.ts | 20 + .../openapi/items/lint/multiple-of--type.ts | 20 + .../config/openapi/items/lint/type--equals.ts | 20 + .../openapi/items/lint/type--required.ts | 28 ++ .../openapi/items/lint/unique-items--type.ts | 20 + .../src/config/openapi/items/meta.ts | 12 + .../config/openapi/parameter/completion.ts | 50 ++ .../openapi/parameter/lint/type--equals.ts | 2 +- 24 files changed, 1003 insertions(+), 1 deletion(-) create mode 100644 packages/apidom-ls/src/config/openapi/items/completion.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/documentation.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/allowed-fields.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/collection-format--equals.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/enum--type.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/exclusive-maximum--type.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/exclusive-minimum--type.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/format--type.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/index.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/items--required.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/items--type.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/max-length--type.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/maximum--type.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/min-length--type.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/minimum--type.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/multiple-of--type.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/type--equals.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/type--required.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/lint/unique-items--type.ts create mode 100644 packages/apidom-ls/src/config/openapi/items/meta.ts diff --git a/packages/apidom-ls/src/config/codes.ts b/packages/apidom-ls/src/config/codes.ts index c6e3b73382..d90be22d75 100644 --- a/packages/apidom-ls/src/config/codes.ts +++ b/packages/apidom-ls/src/config/codes.ts @@ -735,6 +735,23 @@ enum ApilintCodes { OPENAPI2_PARAMETER_FIELD_ENUM_TYPE = 3101800, OPENAPI2_PARAMETER_FIELD_MULTIPLE_OF_TYPE = 3101900, + OPENAPI2_ITEMS = 3110000, + OPENAPI2_ITEMS_FIELD_TYPE_EQUALS = 3110100, + OPENAPI2_ITEMS_FIELD_TYPE_REQUIRED, + OPENAPI2_ITEMS_FIELD_FORMAT_TYPE = 3110200, + OPENAPI2_ITEMS_FIELD_ITEMS_TYPE = 3110300, + OPENAPI2_ITEMS_FIELD_ITEMS_REQUIRED, + OPENAPI2_ITEMS_FIELD_COLLECTION_FORMAT_EQUALS = 3110400, + OPENAPI2_ITEMS_FIELD_MAXIMUM_TYPE = 3110500, + OPENAPI2_ITEMS_FIELD_EXCLUSIVE_MAXIMUM_TYPE = 3110600, + OPENAPI2_ITEMS_FIELD_MINIMUM_TYPE = 3110700, + OPENAPI2_ITEMS_FIELD_EXCLUSIVE_MINIMUM_TYPE = 3110800, + OPENAPI2_ITEMS_FIELD_MAX_LENGTH_TYPE = 3110900, + OPENAPI2_ITEMS_FIELD_MIN_LENGTH_TYPE = 3111000, + OPENAPI2_ITEMS_FIELD_UNIQUE_ITEMS_TYPE = 3111100, + OPENAPI2_ITEMS_FIELD_ENUM_TYPE = 3111200, + OPENAPI2_ITEMS_FIELD_MULTIPLE_OF_TYPE = 3111300, + OPENAPI3_0 = 5000000, OPENAPI3_0_OPENAPI_VALUE_PATTERN_3_0_0 = 5000100, diff --git a/packages/apidom-ls/src/config/openapi/config.ts b/packages/apidom-ls/src/config/openapi/config.ts index 6c35976e49..d9e0f35ed7 100644 --- a/packages/apidom-ls/src/config/openapi/config.ts +++ b/packages/apidom-ls/src/config/openapi/config.ts @@ -34,6 +34,7 @@ import swaggerMeta from './swagger/meta'; import tagMeta from './tag/meta'; import xmlMeta from './xml/meta'; import pathTemplateMeta from './path-template/meta'; +import itemsMeta from './items/meta'; import schemaMeta from '../common/schema/meta'; import ApilintCodes from '../codes'; @@ -83,6 +84,7 @@ export default { swagger: swaggerMeta, tag: tagMeta, xml: xmlMeta, + items: itemsMeta, schema: schemaMeta, 'path-template': pathTemplateMeta, }; diff --git a/packages/apidom-ls/src/config/openapi/items/completion.ts b/packages/apidom-ls/src/config/openapi/items/completion.ts new file mode 100644 index 0000000000..c2c14763eb --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/completion.ts @@ -0,0 +1,428 @@ +import { + ApidomCompletionItem, + CompletionFormat, + CompletionType, +} from '../../../apidom-language-types'; +import { OpenAPI2 } from '../target-specs'; + +const completion: ApidomCompletionItem[] = [ + { + label: 'type', + insertText: 'type', + kind: 14, + format: CompletionFormat.QUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '**Required.** The internal type of the array. The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, or `"array"`. Files and models are not allowed.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'format', + insertText: 'format', + kind: 14, + format: CompletionFormat.QUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + 'The extending format for the previously mentioned [`type`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameterType). See [Data Type Formats](#dataTypeFormat) for further details.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'items', + insertText: 'items', + kind: 14, + format: CompletionFormat.OBJECT, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '[Items Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#itemsObject)\n\\\n\\\n**Required if [`type`](#parameterType) is "array".** Describes the type of items in the array.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'collectionFormat', + insertText: 'collectionFormat', + kind: 14, + format: CompletionFormat.QUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + 'Determines the format of the array if type array is used. Possible values are:\n\n* `csv` - comma separated values `foo,bar`.\n* `ssv` - space separated values `foo bar`.\n* `tsv` - tab separated values `foo\\tbar`.\n* `pipes` - pipe separated values `foo|bar`.\n\nDefault value is `csv`.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'default', + insertText: 'default', + kind: 14, + format: CompletionFormat.UNQUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '`Any`\n\\\n\\\nDeclares the value of the item that the server will use if none is provided. (Note: "default" has no meaning for required items.) See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. Unlike JSON Schema this value MUST conform to the defined [`type`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#itemsType) for the data type.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'maximum', + insertText: 'maximum', + kind: 14, + format: CompletionFormat.UNQUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '`number`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'exclusiveMaximum', + insertText: 'exclusiveMaximum', + kind: 14, + format: CompletionFormat.UNQUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '`boolean`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'minimum', + insertText: 'minimum', + kind: 14, + format: CompletionFormat.UNQUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '`number`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'exclusiveMinimum', + insertText: 'exclusiveMinimum', + kind: 14, + format: CompletionFormat.UNQUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '`boolean`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'maxLength', + insertText: 'maxLength', + kind: 14, + format: CompletionFormat.UNQUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '`integer`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'minLength', + insertText: 'minLength', + kind: 14, + format: CompletionFormat.UNQUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '`integer`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'pattern', + insertText: 'pattern', + kind: 14, + format: CompletionFormat.QUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: 'See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'maxItems', + insertText: 'maxItems', + kind: 14, + format: CompletionFormat.UNQUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '`integer`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'minItems', + insertText: 'minItems', + kind: 14, + format: CompletionFormat.UNQUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '`integer`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'uniqueItems', + insertText: 'uniqueItems', + kind: 14, + format: CompletionFormat.UNQUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '`boolean`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'enum', + insertText: 'enum', + kind: 14, + format: CompletionFormat.ARRAY, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '`[*]`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1.', + }, + targetSpecs: OpenAPI2, + }, + { + label: 'multipleOf', + insertText: 'multipleOf', + kind: 14, + format: CompletionFormat.UNQUOTED, + type: CompletionType.PROPERTY, + insertTextFormat: 2, + documentation: { + kind: 'markdown', + value: + '`number`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.', + }, + targetSpecs: OpenAPI2, + }, + { + target: 'type', + label: 'string', + insertText: 'string', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'type', + label: 'number', + insertText: 'number', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'type', + label: 'integer', + insertText: 'integer', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'type', + label: 'boolean', + insertText: 'boolean', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'type', + label: 'array', + insertText: 'array', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'format', + label: 'int32', + insertText: 'int32', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'format', + label: 'int64', + insertText: 'int64', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'format', + label: 'float', + insertText: 'float', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'format', + label: 'double', + insertText: 'double', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'format', + label: 'byte', + insertText: 'byte', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'format', + label: 'binary', + insertText: 'binary', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'format', + label: 'date', + insertText: 'date', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'format', + label: 'date-time', + insertText: 'date-time', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'format', + label: 'password', + insertText: 'password', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'collectionFormat', + label: 'csv', + insertText: 'csv', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'collectionFormat', + label: 'ssv', + insertText: 'ssv', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'collectionFormat', + label: 'tsv', + insertText: 'tsv', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'collectionFormat', + label: 'pipes', + insertText: 'pipes', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, +]; + +export default completion; diff --git a/packages/apidom-ls/src/config/openapi/items/documentation.ts b/packages/apidom-ls/src/config/openapi/items/documentation.ts new file mode 100644 index 0000000000..33a12aa15a --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/documentation.ts @@ -0,0 +1,94 @@ +import { OpenAPI2 } from '../target-specs'; + +const documentation = [ + { + target: 'type', + docs: '**Required.** The internal type of the array. The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, or `"array"`. Files and models are not allowed.', + targetSpecs: OpenAPI2, + }, + { + target: 'format', + docs: 'The extending format for the previously mentioned [`type`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameterType). See [Data Type Formats](#dataTypeFormat) for further details.', + targetSpecs: OpenAPI2, + }, + { + target: 'items', + docs: '[Items Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#itemsObject)\n\\\n\\\n**Required if [`type`](#parameterType) is "array".** Describes the type of items in the array.', + targetSpecs: OpenAPI2, + }, + { + target: 'collectionFormat', + docs: 'Determines the format of the array if type array is used. Possible values are:\n\n* `csv` - comma separated values `foo,bar`.\n* `ssv` - space separated values `foo bar`.\n* `tsv` - tab separated values `foo\\tbar`.\n* `pipes` - pipe separated values `foo|bar`.\n\nDefault value is `csv`.', + targetSpecs: OpenAPI2, + }, + { + target: 'default', + docs: '`Any`\n\\\n\\\nDeclares the value of the item that the server will use if none is provided. (Note: "default" has no meaning for required items.) See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. Unlike JSON Schema this value MUST conform to the defined [`type`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#itemsType) for the data type.', + targetSpecs: OpenAPI2, + }, + { + target: 'maximum', + docs: '`number`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.', + targetSpecs: OpenAPI2, + }, + { + target: 'exclusiveMaximum', + docs: '`boolean`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.', + targetSpecs: OpenAPI2, + }, + { + target: 'minimum', + docs: '`number`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.', + targetSpecs: OpenAPI2, + }, + { + target: 'exclusiveMinimum', + docs: '`boolean`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.', + targetSpecs: OpenAPI2, + }, + { + target: 'maxLength', + docs: '`integer`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.', + targetSpecs: OpenAPI2, + }, + { + target: 'minLength', + docs: '`integer`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.', + targetSpecs: OpenAPI2, + }, + { + target: 'pattern', + docs: 'See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.', + targetSpecs: OpenAPI2, + }, + { + target: 'maxItems', + docs: '`integer`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.', + targetSpecs: OpenAPI2, + }, + { + target: 'minItems', + docs: '`integer`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.', + targetSpecs: OpenAPI2, + }, + { + target: 'uniqueItems', + docs: '`boolean`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.', + targetSpecs: OpenAPI2, + }, + { + target: 'enum', + docs: '`[*]`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1.', + targetSpecs: OpenAPI2, + }, + { + target: 'multipleOf', + docs: '`number`\n\\\n\\\nSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.', + targetSpecs: OpenAPI2, + }, + { + docs: '#### [Items Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#items-object)\n\nA limited subset of JSON-Schema\'s items object. It is used by parameter definitions that are not located [`in`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameterIn) `"body"`.\n\n##### Fixed Fields\nField Name | Type | Description\n---|:---:|---\ntype | `string` | **Required.** The internal type of the array. The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, or `"array"`. Files and models are not allowed.\nformat | `string` | The extending format for the previously mentioned [`type`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameterType). See [Data Type Formats](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#dataTypeFormat) for further details.\nitems | [Items Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#itemsObject) | **Required if [`type`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#itemsType) is "array".** Describes the type of items in the array.\ncollectionFormat | `string` | Determines the format of the array if type array is used. Possible values are: `csv` - comma separated values `foo,bar`. `ssv` - space separated values `foo bar`. `tsv` - tab separated values `foo\\tbar`. `pipes` - pipe separated values `foo|bar`. Default value is `csv`.\ndefault | * | Declares the value of the item that the server will use if none is provided. (Note: "default" has no meaning for required items.) See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. Unlike JSON Schema this value MUST conform to the defined [`type`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#itemsType) for the data type.\nmaximum | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.\nexclusiveMaximum | `boolean` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.\nminimum | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.\nexclusiveMinimum | `boolean` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.\nmaxLength | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.\nminLength | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.\npattern | `string` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.\nmaxItems | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.\nminItems | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.\nuniqueItems | `boolean` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.\nenum | [*] | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1.\nmultipleOf | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.\n\n##### Patterned Objects\n\nField Pattern | Type | Description\n---|:---:|---\n^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#vendorExtensions) for further details.\n\n##### Items Object Examples\n\nItems must be of type string and have the minimum length of 2 characters:\n\n```js\n{\n "type": "string",\n "minLength": 2\n}\n```\n\n\n\\\nYAML\n```yaml\ntype: string\nminLength: 2\n```\n\nAn array of arrays, the internal array being of type integer, numbers must be between 0 and 63 (inclusive):\n\n```js\n{\n "type": "array",\n "items": {\n "type": "integer",\n "minimum": 0,\n "maximum": 63\n }\n}\n```\n\n```yaml\ntype: array\nitems:\n type: integer\n minimum: 0\n maximum: 63\n```', + targetSpecs: OpenAPI2, + }, +]; +export default documentation; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/allowed-fields.ts b/packages/apidom-ls/src/config/openapi/items/lint/allowed-fields.ts new file mode 100644 index 0000000000..5643147432 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/allowed-fields.ts @@ -0,0 +1,39 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const allowedFieldsLint: LinterMeta = { + code: ApilintCodes.NOT_ALLOWED_FIELDS, + source: 'apilint', + message: 'Object includes not allowed fields', + severity: DiagnosticSeverity.Error, + linterFunction: 'allowedFields', + linterParams: [ + [ + 'type', + 'format', + 'items', + 'collectionFormat', + 'default', + 'maximum', + 'exclusiveMaximum', + 'minimum', + 'exclusiveMinimum', + 'maxLength', + 'minLength', + 'pattern', + 'maxItems', + 'minItems', + 'uniqueItems', + 'enum', + 'multipleOf', + ], + 'x-', + ], + marker: 'key', + targetSpecs: OpenAPI2, +}; + +export default allowedFieldsLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/collection-format--equals.ts b/packages/apidom-ls/src/config/openapi/items/lint/collection-format--equals.ts new file mode 100644 index 0000000000..8d770f21ac --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/collection-format--equals.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const collectionFormatEqualsLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_COLLECTION_FORMAT_EQUALS, + source: 'apilint', + message: "'collectionFormat' must be one of allowed values: 'csv', 'ssv', 'tsv', 'pipes'", + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintValueOrArray', + linterParams: [['csv', 'ssv', 'tsv', 'pipes']], + marker: 'value', + target: 'collectionFormat', + data: {}, + targetSpecs: OpenAPI2, +}; + +export default collectionFormatEqualsLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/enum--type.ts b/packages/apidom-ls/src/config/openapi/items/lint/enum--type.ts new file mode 100644 index 0000000000..d870266cac --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/enum--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const enumTypeLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_ENUM_TYPE, + source: 'apilint', + message: 'enum must be an array', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintType', + linterParams: ['array'], + marker: 'value', + target: 'enum', + data: {}, + targetSpecs: OpenAPI2, +}; + +export default enumTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/exclusive-maximum--type.ts b/packages/apidom-ls/src/config/openapi/items/lint/exclusive-maximum--type.ts new file mode 100644 index 0000000000..81a329a20a --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/exclusive-maximum--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const exclusiveMaximumTypeLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_EXCLUSIVE_MAXIMUM_TYPE, + source: 'apilint', + message: 'exclusiveMaximum must be a boolean', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintType', + linterParams: ['boolean'], + marker: 'value', + target: 'exclusiveMaximum', + data: {}, + targetSpecs: OpenAPI2, +}; + +export default exclusiveMaximumTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/exclusive-minimum--type.ts b/packages/apidom-ls/src/config/openapi/items/lint/exclusive-minimum--type.ts new file mode 100644 index 0000000000..31b22702b8 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/exclusive-minimum--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const exclusiveMinimumTypeLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_EXCLUSIVE_MINIMUM_TYPE, + source: 'apilint', + message: 'exclusiveMinimum must be a boolean', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintType', + linterParams: ['boolean'], + marker: 'value', + target: 'exclusiveMinimum', + data: {}, + targetSpecs: OpenAPI2, +}; + +export default exclusiveMinimumTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/format--type.ts b/packages/apidom-ls/src/config/openapi/items/lint/format--type.ts new file mode 100644 index 0000000000..c676cafdbc --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/format--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const formatTypeLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_FORMAT_TYPE, + source: 'apilint', + message: 'format must be a string', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintType', + linterParams: ['string'], + marker: 'value', + target: 'format', + data: {}, + targetSpecs: OpenAPI2, +}; + +export default formatTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/index.ts b/packages/apidom-ls/src/config/openapi/items/lint/index.ts new file mode 100644 index 0000000000..730e767a3a --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/index.ts @@ -0,0 +1,37 @@ +import allowedFieldsLint from './allowed-fields'; +import typeEqualsLint from './type--equals'; +import typeRequiredLint from './type--required'; +import formatTypeLint from './format--type'; +import itemsTypeLint from './items--type'; +import itemsRequiredLint from './items--required'; +import collectionFormatEqualsLint from './collection-format--equals'; +import maximumTypeLint from './maximum--type'; +import exclusiveMaximumTypeLint from './exclusive-maximum--type'; +import minimumTypeLint from './minimum--type'; +import exclusiveMinimumTypeLint from './exclusive-minimum--type'; +import maxLengthTypeLint from './max-length--type'; +import minLengthTypeLint from './min-length--type'; +import uniqueItemsTypeLint from './unique-items--type'; +import enumTypeLint from './enum--type'; +import multipleOfTypeLint from './multiple-of--type'; + +const lints = [ + typeEqualsLint, + typeRequiredLint, + formatTypeLint, + itemsTypeLint, + itemsRequiredLint, + collectionFormatEqualsLint, + maximumTypeLint, + exclusiveMaximumTypeLint, + minimumTypeLint, + exclusiveMinimumTypeLint, + maxLengthTypeLint, + minLengthTypeLint, + uniqueItemsTypeLint, + enumTypeLint, + multipleOfTypeLint, + allowedFieldsLint, +]; + +export default lints; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/items--required.ts b/packages/apidom-ls/src/config/openapi/items/lint/items--required.ts new file mode 100644 index 0000000000..3658b0ba02 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/items--required.ts @@ -0,0 +1,35 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const itemsRequiredLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_ITEMS_REQUIRED, + source: 'apilint', + message: "should have an 'items' if 'type'=array", + severity: DiagnosticSeverity.Error, + linterFunction: 'hasRequiredField', + linterParams: ['items'], + marker: 'key', + conditions: [ + { + targets: [{ path: 'type' }], + function: 'apilintContainsValue', + params: ['array'], + }, + ], + data: { + quickFix: [ + { + message: "add 'items' field", + action: 'addChild', + snippetYaml: 'items: \n \n', + snippetJson: '"items": {\n \n },\n', + }, + ], + }, + targetSpecs: OpenAPI2, +}; + +export default itemsRequiredLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/items--type.ts b/packages/apidom-ls/src/config/openapi/items/lint/items--type.ts new file mode 100644 index 0000000000..99f025d4df --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/items--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const itemsTypeLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_ITEMS_TYPE, + source: 'apilint', + message: "'items' must be an object", + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintElementOrClass', + linterParams: ['items'], + marker: 'value', + target: 'items', + data: {}, + targetSpecs: OpenAPI2, +}; + +export default itemsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/max-length--type.ts b/packages/apidom-ls/src/config/openapi/items/lint/max-length--type.ts new file mode 100644 index 0000000000..b243f13541 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/max-length--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const maxLengthTypeLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_MAX_LENGTH_TYPE, + source: 'apilint', + message: 'maxLength must be an integer', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintNumber', + linterParams: [true, true, true], + marker: 'value', + target: 'maxLength', + data: {}, + targetSpecs: OpenAPI2, +}; + +export default maxLengthTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/maximum--type.ts b/packages/apidom-ls/src/config/openapi/items/lint/maximum--type.ts new file mode 100644 index 0000000000..19f9cd9013 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/maximum--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const maximumTypeLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_MAXIMUM_TYPE, + source: 'apilint', + message: 'maximum must be a number', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintType', + linterParams: ['number'], + marker: 'value', + target: 'maximum', + data: {}, + targetSpecs: OpenAPI2, +}; + +export default maximumTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/min-length--type.ts b/packages/apidom-ls/src/config/openapi/items/lint/min-length--type.ts new file mode 100644 index 0000000000..50fa871e2a --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/min-length--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const minLengthTypeLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_MIN_LENGTH_TYPE, + source: 'apilint', + message: 'minLength must be an integer', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintNumber', + linterParams: [true, true, true], + marker: 'value', + target: 'minLength', + data: {}, + targetSpecs: OpenAPI2, +}; + +export default minLengthTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/minimum--type.ts b/packages/apidom-ls/src/config/openapi/items/lint/minimum--type.ts new file mode 100644 index 0000000000..b6f0e59f6c --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/minimum--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const minimumTypeLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_MINIMUM_TYPE, + source: 'apilint', + message: 'minimum must be a number', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintType', + linterParams: ['number'], + marker: 'value', + target: 'minimum', + data: {}, + targetSpecs: OpenAPI2, +}; + +export default minimumTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/multiple-of--type.ts b/packages/apidom-ls/src/config/openapi/items/lint/multiple-of--type.ts new file mode 100644 index 0000000000..ea540442d4 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/multiple-of--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const multipleOfTypeLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_MULTIPLE_OF_TYPE, + source: 'apilint', + message: 'multipleOf must be a number', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintType', + linterParams: ['number'], + marker: 'value', + target: 'multipleOf', + data: {}, + targetSpecs: OpenAPI2, +}; + +export default multipleOfTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/type--equals.ts b/packages/apidom-ls/src/config/openapi/items/lint/type--equals.ts new file mode 100644 index 0000000000..48fc8b3218 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/type--equals.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const typeEqualsLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_TYPE_EQUALS, + source: 'apilint', + message: "'type' must be one of allowed values: string, number, integer, boolean, array", + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintValueOrArray', + linterParams: [['string', 'number', 'integer', 'boolean', 'array']], + marker: 'value', + target: 'type', + data: {}, + targetSpecs: OpenAPI2, +}; + +export default typeEqualsLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/type--required.ts b/packages/apidom-ls/src/config/openapi/items/lint/type--required.ts new file mode 100644 index 0000000000..8e2126191d --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/type--required.ts @@ -0,0 +1,28 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const typeRequiredLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_TYPE_REQUIRED, + source: 'apilint', + message: "should always have a 'type'", + severity: DiagnosticSeverity.Error, + linterFunction: 'hasRequiredField', + linterParams: ['type'], + marker: 'key', + data: { + quickFix: [ + { + message: "add 'type' field", + action: 'addChild', + snippetYaml: 'type: \n ', + snippetJson: '"type": ,\n ', + }, + ], + }, + targetSpecs: OpenAPI2, +}; + +export default typeRequiredLint; diff --git a/packages/apidom-ls/src/config/openapi/items/lint/unique-items--type.ts b/packages/apidom-ls/src/config/openapi/items/lint/unique-items--type.ts new file mode 100644 index 0000000000..fa41607aac --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/lint/unique-items--type.ts @@ -0,0 +1,20 @@ +import { DiagnosticSeverity } from 'vscode-languageserver-types'; + +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; +import { OpenAPI2 } from '../../target-specs'; + +const uniqueItemsTypeLint: LinterMeta = { + code: ApilintCodes.OPENAPI2_ITEMS_FIELD_UNIQUE_ITEMS_TYPE, + source: 'apilint', + message: 'uniqueItems must be a boolean', + severity: DiagnosticSeverity.Error, + linterFunction: 'apilintType', + linterParams: ['boolean'], + marker: 'value', + target: 'uniqueItems', + data: {}, + targetSpecs: OpenAPI2, +}; + +export default uniqueItemsTypeLint; diff --git a/packages/apidom-ls/src/config/openapi/items/meta.ts b/packages/apidom-ls/src/config/openapi/items/meta.ts new file mode 100644 index 0000000000..381bda653d --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/items/meta.ts @@ -0,0 +1,12 @@ +import lint from './lint'; +import completion from './completion'; +import documentation from './documentation'; +import { FormatMeta } from '../../../apidom-language-types'; + +const meta: FormatMeta = { + lint, + completion, + documentation, +}; + +export default meta; diff --git a/packages/apidom-ls/src/config/openapi/parameter/completion.ts b/packages/apidom-ls/src/config/openapi/parameter/completion.ts index 04b0eb12a4..8b677ba9ba 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/completion.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/completion.ts @@ -830,6 +830,56 @@ const completion: ApidomCompletionItem[] = [ insertTextFormat: 2, targetSpecs: OpenAPI2, }, + { + target: 'collectionFormat', + label: 'csv', + insertText: 'csv', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'collectionFormat', + label: 'ssv', + insertText: 'ssv', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'collectionFormat', + label: 'tsv', + insertText: 'tsv', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'collectionFormat', + label: 'pipes', + insertText: 'pipes', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, + { + target: 'collectionFormat', + label: 'multi', + insertText: 'multi', + kind: 12, + format: CompletionFormat.QUOTED, + type: CompletionType.VALUE, + insertTextFormat: 2, + targetSpecs: OpenAPI2, + }, { target: 'style', label: 'form', diff --git a/packages/apidom-ls/src/config/openapi/parameter/lint/type--equals.ts b/packages/apidom-ls/src/config/openapi/parameter/lint/type--equals.ts index d0657b271c..d6a4e52c2e 100644 --- a/packages/apidom-ls/src/config/openapi/parameter/lint/type--equals.ts +++ b/packages/apidom-ls/src/config/openapi/parameter/lint/type--equals.ts @@ -7,7 +7,7 @@ import { OpenAPI2 } from '../../target-specs'; const typeEqualsLint: LinterMeta = { code: ApilintCodes.OPENAPI2_PARAMETER_FIELD_TYPE_EQUALS, source: 'apilint', - message: "'in' must be one of allowed values: query, header, path, formData, body", + message: "'type' must be one of allowed values: string, number, integer, boolean, array, file", severity: DiagnosticSeverity.Error, linterFunction: 'apilintValueOrArray', linterParams: [['string', 'number', 'integer', 'boolean', 'array', 'file']], From a4d678c0c01aa4acaf7cee2cbdc04953866d7b89 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:40:22 +0000 Subject: [PATCH 2/5] chore(deps-dev): bump @testing-library/jest-dom from 6.1.6 to 6.2.0 (#3623) --- package-lock.json | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index b8b7afe2dd..5aed104f0d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8674,9 +8674,9 @@ } }, "node_modules/@testing-library/jest-dom": { - "version": "6.1.6", - "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.1.6.tgz", - "integrity": "sha512-YwuiOdYEcxhfC2u5iNKlvg2Q5MgbutovP6drq7J1HrCbvR+G58BbtoCoq+L/kNlrNFsu2Kt3jaFAviLVxYHJZg==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.2.0.tgz", + "integrity": "sha512-+BVQlJ9cmEn5RDMUS8c2+TU6giLvzaHZ8sU/x0Jj7fk+6/46wPdwlgOPcpxS17CjcanBi/3VmGMqVr2rmbUmNw==", "dev": true, "dependencies": { "@adobe/css-tools": "^4.3.2", @@ -8684,7 +8684,7 @@ "aria-query": "^5.0.0", "chalk": "^3.0.0", "css.escape": "^1.5.1", - "dom-accessibility-api": "^0.5.6", + "dom-accessibility-api": "^0.6.3", "lodash": "^4.17.15", "redent": "^3.0.0" }, @@ -8760,6 +8760,12 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/@testing-library/jest-dom/node_modules/dom-accessibility-api": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz", + "integrity": "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==", + "dev": true + }, "node_modules/@testing-library/jest-dom/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", From 26d7cfd40f3ac94ff688e3172f277d7cfdd1eef3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:47:45 +0000 Subject: [PATCH 3/5] chore(deps): bump @mui/icons-material from 5.15.2 to 5.15.3 (#3624) --- package-lock.json | 8 ++++---- packages/apidom-playground/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5aed104f0d..29edda1510 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6462,9 +6462,9 @@ } }, "node_modules/@mui/icons-material": { - "version": "5.15.2", - "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.15.2.tgz", - "integrity": "sha512-Vs0Z6cd6ieTavMjqPvIJJfwsKaCLdRSErk5LjKdZlBqk7r2SR6roDyhVTQuZOeCzjEFj0qZ4iVPp2DJZRwuYbw==", + "version": "5.15.3", + "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.15.3.tgz", + "integrity": "sha512-7LEs8AnO2Se/XYH+CcJndRsGAE+M8KAExiiQHf0V11poqmPVGcbbY82Ry2IUYf9+rOilCVnWI18ErghZ625BPQ==", "dependencies": { "@babel/runtime": "^7.23.6" }, @@ -38472,7 +38472,7 @@ "dependencies": { "@emotion/react": "=11.11.3", "@emotion/styled": "=11.11.0", - "@mui/icons-material": "=5.15.2", + "@mui/icons-material": "=5.15.3", "@mui/material": "=5.15.2", "@swagger-api/apidom-ast": "*", "@swagger-api/apidom-core": "*", diff --git a/packages/apidom-playground/package.json b/packages/apidom-playground/package.json index b6d27f250c..308b9353ab 100644 --- a/packages/apidom-playground/package.json +++ b/packages/apidom-playground/package.json @@ -24,7 +24,7 @@ "dependencies": { "@emotion/react": "=11.11.3", "@emotion/styled": "=11.11.0", - "@mui/icons-material": "=5.15.2", + "@mui/icons-material": "=5.15.3", "@mui/material": "=5.15.2", "@swagger-api/apidom-ast": "*", "@swagger-api/apidom-core": "*", From ca9532fdc41659a7bf755dff2621957d429289ab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:54:51 +0000 Subject: [PATCH 4/5] chore(deps): bump @mui/material from 5.15.2 to 5.15.3 (#3625) --- package-lock.json | 80 ++++++++++++------------- packages/apidom-playground/package.json | 2 +- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/package-lock.json b/package-lock.json index 29edda1510..927577b6da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6422,14 +6422,14 @@ } }, "node_modules/@mui/base": { - "version": "5.0.0-beta.29", - "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.29.tgz", - "integrity": "sha512-OXfUssYrB6ch/xpBVHMKAjThPlI9VyGGKdvQLMXef2j39wXfcxPlUVQlwia/lmE3rxWIGvbwkZsDtNYzLMsDUg==", + "version": "5.0.0-beta.30", + "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.30.tgz", + "integrity": "sha512-dc38W4W3K42atE9nSaOeoJ7/x9wGIfawdwC/UmMxMLlZ1iSsITQ8dQJaTATCbn98YvYPINK/EH541YA5enQIPQ==", "dependencies": { "@babel/runtime": "^7.23.6", "@floating-ui/react-dom": "^2.0.4", - "@mui/types": "^7.2.11", - "@mui/utils": "^5.15.2", + "@mui/types": "^7.2.12", + "@mui/utils": "^5.15.3", "@popperjs/core": "^2.11.8", "clsx": "^2.0.0", "prop-types": "^15.8.1" @@ -6453,9 +6453,9 @@ } }, "node_modules/@mui/core-downloads-tracker": { - "version": "5.15.2", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.2.tgz", - "integrity": "sha512-0vk4ckS2w1F5PmkSXSd7F/QuRlNcPqWTJ8CPl+HQRLTIhJVS/VKEI+3dQufOdKfn2wS+ecnvlvXerbugs+xZ8Q==", + "version": "5.15.3", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.3.tgz", + "integrity": "sha512-sWeihiVyxdJjpLkp8SHkTy9kt2M/o11M60G1MzwljGL2BXdM3Ktzqv5QaQHdi00y7Y1ulvtI3GOSxP2xU8mQJw==", "funding": { "type": "opencollective", "url": "https://opencollective.com/mui-org" @@ -6487,16 +6487,16 @@ } }, "node_modules/@mui/material": { - "version": "5.15.2", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.15.2.tgz", - "integrity": "sha512-JnoIrpNmEHG5uC1IyEdgsnDiaiuCZnUIh7f9oeAr87AvBmNiEJPbo7XrD7kBTFWwp+b97rQ12QdSs9CLhT2n/A==", + "version": "5.15.3", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.15.3.tgz", + "integrity": "sha512-DODBBMouyq1B5f3YkEWL9vO8pGCxuEGqtfpltF6peMJzz/78tJFyLQsDas9MNLC/8AdFu2BQdkK7wox5UBPTAA==", "dependencies": { "@babel/runtime": "^7.23.6", - "@mui/base": "5.0.0-beta.29", - "@mui/core-downloads-tracker": "^5.15.2", - "@mui/system": "^5.15.2", - "@mui/types": "^7.2.11", - "@mui/utils": "^5.15.2", + "@mui/base": "5.0.0-beta.30", + "@mui/core-downloads-tracker": "^5.15.3", + "@mui/system": "^5.15.3", + "@mui/types": "^7.2.12", + "@mui/utils": "^5.15.3", "@types/react-transition-group": "^4.4.10", "clsx": "^2.0.0", "csstype": "^3.1.2", @@ -6531,12 +6531,12 @@ } }, "node_modules/@mui/private-theming": { - "version": "5.15.2", - "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.15.2.tgz", - "integrity": "sha512-KlXx5TH1Mw9omSY+Q6rz5TA/P71meSYaAOeopiW8s6o433+fnOxS17rZbmd1RnDZGCo+j24TfCavQuCMBAZnQA==", + "version": "5.15.3", + "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.15.3.tgz", + "integrity": "sha512-Q79MhVMmywC1l5bMsMZq5PsIudr1MNPJnx9/EqdMP0vpz5iNvFpnLmxsD7d8/hqTWgFAljI+LH3jX8MxlZH9Gw==", "dependencies": { "@babel/runtime": "^7.23.6", - "@mui/utils": "^5.15.2", + "@mui/utils": "^5.15.3", "prop-types": "^15.8.1" }, "engines": { @@ -6557,9 +6557,9 @@ } }, "node_modules/@mui/styled-engine": { - "version": "5.15.2", - "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.15.2.tgz", - "integrity": "sha512-fYEN3IZzbebeHwAmQHhxwruiOIi8W74709qXg/7tgtHV4byQSmPgnnKsZkg0hFlzjEbcJIRZyZI0qEecgpR2cg==", + "version": "5.15.3", + "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.15.3.tgz", + "integrity": "sha512-+d5XZCTeemOO/vBfWGEeHgTm8fjU1Psdgm+xAw+uegycO2EnoA/EfGSaG5UwZ6g3b66y48Mkxi35AggShMr88w==", "dependencies": { "@babel/runtime": "^7.23.6", "@emotion/cache": "^11.11.0", @@ -6588,15 +6588,15 @@ } }, "node_modules/@mui/system": { - "version": "5.15.2", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.15.2.tgz", - "integrity": "sha512-I7CzLiHDtU/BTobJgSk+wPGGWG95K8lYfdFEnq//wOgSrLDAdOVvl2gleDxJWO+yAbGz4RKEOnR9KuD+xQZH4A==", + "version": "5.15.3", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.15.3.tgz", + "integrity": "sha512-ewVU4eRgo4VfNMGpO61cKlfWmH7l9s6rA8EknRzuMX3DbSLfmtW2WJJg6qPwragvpPIir0Pp/AdWVSDhyNy5Tw==", "dependencies": { "@babel/runtime": "^7.23.6", - "@mui/private-theming": "^5.15.2", - "@mui/styled-engine": "^5.15.2", - "@mui/types": "^7.2.11", - "@mui/utils": "^5.15.2", + "@mui/private-theming": "^5.15.3", + "@mui/styled-engine": "^5.15.3", + "@mui/types": "^7.2.12", + "@mui/utils": "^5.15.3", "clsx": "^2.0.0", "csstype": "^3.1.2", "prop-types": "^15.8.1" @@ -6627,9 +6627,9 @@ } }, "node_modules/@mui/types": { - "version": "7.2.11", - "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.11.tgz", - "integrity": "sha512-KWe/QTEsFFlFSH+qRYf3zoFEj3z67s+qAuSnMMg+gFwbxG7P96Hm6g300inQL1Wy///gSRb8juX7Wafvp93m3w==", + "version": "7.2.12", + "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.12.tgz", + "integrity": "sha512-3kaHiNm9khCAo0pVe0RenketDSFoZGAlVZ4zDjB/QNZV0XiCj+sh1zkX0VVhQPgYJDlBEzAag+MHJ1tU3vf0Zw==", "peerDependencies": { "@types/react": "^17.0.0 || ^18.0.0" }, @@ -6640,9 +6640,9 @@ } }, "node_modules/@mui/utils": { - "version": "5.15.2", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.15.2.tgz", - "integrity": "sha512-6dGM9/guFKBlFRHA7/mbM+E7wE7CYDy9Ny4JLtD3J+NTyhi8nd8YxlzgAgTaTVqY0BpdQ2zdfB/q6+p2EdGM0w==", + "version": "5.15.3", + "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.15.3.tgz", + "integrity": "sha512-mT3LiSt9tZWCdx1pl7q4Q5tNo6gdZbvJel286ZHGuj6LQQXjWNAh8qiF9d+LogvNUI+D7eLkTnj605d1zoazfg==", "dependencies": { "@babel/runtime": "^7.23.6", "@types/prop-types": "^15.7.11", @@ -12102,9 +12102,9 @@ } }, "node_modules/clsx": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.0.0.tgz", - "integrity": "sha512-rQ1+kcj+ttHG0MKVGBUXwayCCF1oh39BF5COIpRzuCEv8Mwjv0XucrI2ExNTOn9IlLifGClWQcU9BrZORvtw6Q==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.0.tgz", + "integrity": "sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg==", "engines": { "node": ">=6" } @@ -38473,7 +38473,7 @@ "@emotion/react": "=11.11.3", "@emotion/styled": "=11.11.0", "@mui/icons-material": "=5.15.3", - "@mui/material": "=5.15.2", + "@mui/material": "=5.15.3", "@swagger-api/apidom-ast": "*", "@swagger-api/apidom-core": "*", "@swagger-api/apidom-ns-asyncapi-2": "*", diff --git a/packages/apidom-playground/package.json b/packages/apidom-playground/package.json index 308b9353ab..531d60e550 100644 --- a/packages/apidom-playground/package.json +++ b/packages/apidom-playground/package.json @@ -25,7 +25,7 @@ "@emotion/react": "=11.11.3", "@emotion/styled": "=11.11.0", "@mui/icons-material": "=5.15.3", - "@mui/material": "=5.15.2", + "@mui/material": "=5.15.3", "@swagger-api/apidom-ast": "*", "@swagger-api/apidom-core": "*", "@swagger-api/apidom-ns-asyncapi-2": "*", From df7ab18515ee75f129eb6f4f384dcb99810a02e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Jan 2024 00:03:24 +0000 Subject: [PATCH 5/5] chore(deps): bump axios from 1.6.3 to 1.6.4 (#3626) --- package-lock.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 927577b6da..e513fd91df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10740,11 +10740,11 @@ } }, "node_modules/axios": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.3.tgz", - "integrity": "sha512-fWyNdeawGam70jXSVlKl+SUNVcL6j6W79CuSIPfi6HnDUmSCH6gyUys/HrqHeA/wU0Az41rRgean494d0Jb+ww==", + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.4.tgz", + "integrity": "sha512-heJnIs6N4aa1eSthhN9M5ioILu8Wi8vmQW9iHQ9NUvfkJb0lEEDUiIdQNAuBtfUt3FxReaKdpQA5DbmMOqzF/A==", "dependencies": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.4", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -16847,9 +16847,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", "funding": [ { "type": "individual",