-
Notifications
You must be signed in to change notification settings - Fork 14
/
allowed-fields-openapi-2-0.ts
57 lines (54 loc) · 1.37 KB
/
allowed-fields-openapi-2-0.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { DiagnosticSeverity } from 'vscode-languageserver-types';
import ApilintCodes from '../../../codes';
import { LinterMeta } from '../../../../apidom-language-types';
import { OpenAPI2 } from '../../../openapi/target-specs';
// eslint-disable-next-line @typescript-eslint/naming-convention
const allowedFieldsOpenAPI2_0Lint: LinterMeta = {
code: ApilintCodes.NOT_ALLOWED_FIELDS,
source: 'apilint',
message: 'Object includes not allowed fields',
/**
* Technically additional JSON Schema keywords can be present, they are just unsupported.
* That's why we use Warning severity here instead of Error.
*/
severity: DiagnosticSeverity.Warning,
linterFunction: 'allowedFields',
linterParams: [
[
'$ref',
'format',
'title',
'description',
'default',
'multipleOf',
'maximum',
'exclusiveMaximum',
'minimum',
'exclusiveMinimum',
'maxLength',
'minLength',
'pattern',
'maxItems',
'minItems',
'uniqueItems',
'maxProperties',
'minProperties',
'required',
'enum',
'type',
'items',
'allOf',
'properties',
'additionalProperties',
'discriminator',
'readOnly',
'xml',
'externalDocs',
'example',
],
'x-',
],
marker: 'key',
targetSpecs: OpenAPI2,
};
export default allowedFieldsOpenAPI2_0Lint;