Skip to content

Commit 1cf87b8

Browse files
committed
feat(ls): provide OpenAPI 3.1 Response allowed fields link rule
Refs #2061
1 parent 3fe4a0b commit 1cf87b8

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import ApilintCodes from '../../../codes';
2+
import { LinterMeta } from '../../../../apidom-language-types';
3+
4+
// eslint-disable-next-line @typescript-eslint/naming-convention
5+
const allowedFields3_1Lint: LinterMeta = {
6+
code: ApilintCodes.NOT_ALLOWED_FIELDS,
7+
source: 'apilint',
8+
message: 'Object includes not allowed fields',
9+
severity: 1,
10+
linterFunction: 'allowedFields',
11+
linterParams: [['description', 'headers', 'content', 'links'], 'x-'],
12+
marker: 'key',
13+
conditions: [
14+
{
15+
function: 'missingField',
16+
params: ['$ref'],
17+
},
18+
],
19+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
20+
};
21+
22+
export default allowedFields3_1Lint;

packages/apidom-ls/src/config/openapi/response/lint/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import allowedFields3_0Lint from './allowed-fields-3-0';
2+
import allowedFields3_1Lint from './allowed-fields-3-1';
23
import descriptionTypeLint from './description--type';
34
import descriptionRequiredLint from './description--required';
45
import headersValuesTypeLint from './headers--values-type';
@@ -12,6 +13,7 @@ const lints = [
1213
contentValuesTypeLint,
1314
linksValuesTypeLint,
1415
allowedFields3_0Lint,
16+
allowedFields3_1Lint,
1517
];
1618

1719
export default lints;

0 commit comments

Comments
 (0)