Skip to content

Commit

Permalink
feat(ls): provide OpenAPI 3.1.0 Example allowed fields link rule
Browse files Browse the repository at this point in the history
Refs #2061
  • Loading branch information
char0n committed Oct 28, 2022
1 parent ecfeac5 commit 2536994
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 2 additions & 0 deletions packages/apidom-ls/src/config/openapi/example/lint/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -10,6 +11,7 @@ const lints = [
valueMutuallyExclusiveLint,
externalValueFormatURILint,
allowedFields3_0Lint,
allowedFields3_1Lint,
];

export default lints;

0 comments on commit 2536994

Please sign in to comment.