From 2536994aa8b71d452e16e97ccf079f1dac88ac24 Mon Sep 17 00:00:00 2001 From: Vladimir Gorej Date: Fri, 28 Oct 2022 13:14:41 +0200 Subject: [PATCH] feat(ls): provide OpenAPI 3.1.0 Example allowed fields link rule Refs #2061 --- .../example/lint/allowed-fields-3-1.ts | 22 +++++++++++++++++++ .../src/config/openapi/example/lint/index.ts | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 packages/apidom-ls/src/config/openapi/example/lint/allowed-fields-3-1.ts diff --git a/packages/apidom-ls/src/config/openapi/example/lint/allowed-fields-3-1.ts b/packages/apidom-ls/src/config/openapi/example/lint/allowed-fields-3-1.ts new file mode 100644 index 0000000000..e3bcb05346 --- /dev/null +++ b/packages/apidom-ls/src/config/openapi/example/lint/allowed-fields-3-1.ts @@ -0,0 +1,22 @@ +import ApilintCodes from '../../../codes'; +import { LinterMeta } from '../../../../apidom-language-types'; + +// eslint-disable-next-line @typescript-eslint/naming-convention +const allowedFields3_1Lint: LinterMeta = { + code: ApilintCodes.NOT_ALLOWED_FIELDS, + source: 'apilint', + message: 'Object includes not allowed fields', + severity: 1, + linterFunction: 'allowedFields', + linterParams: [['summary', 'description', 'value', 'externalValue'], 'x-'], + marker: 'key', + conditions: [ + { + function: 'missingField', + params: ['$ref'], + }, + ], + targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], +}; + +export default allowedFields3_1Lint; diff --git a/packages/apidom-ls/src/config/openapi/example/lint/index.ts b/packages/apidom-ls/src/config/openapi/example/lint/index.ts index 250a260b42..59320d9c2f 100644 --- a/packages/apidom-ls/src/config/openapi/example/lint/index.ts +++ b/packages/apidom-ls/src/config/openapi/example/lint/index.ts @@ -1,4 +1,5 @@ import allowedFields3_0Lint from './allowed-fields-3-0'; +import allowedFields3_1Lint from './allowed-fields-3-1'; import summaryTypeLint from './summary--type'; import descriptionTypeLint from './description--type'; import valueMutuallyExclusiveLint from './value--mutually-exclusive'; @@ -10,6 +11,7 @@ const lints = [ valueMutuallyExclusiveLint, externalValueFormatURILint, allowedFields3_0Lint, + allowedFields3_1Lint, ]; export default lints;