File tree 15 files changed +279
-0
lines changed
packages/apidom-ls/src/config 15 files changed +279
-0
lines changed Original file line number Diff line number Diff line change @@ -793,6 +793,18 @@ enum ApilintCodes {
793
793
OPENAPI3_0_LINK_FIELD_DESCRIPTION_TYPE = 5270300 ,
794
794
OPENAPI3_0_LINK_FIELD_SERVER_TYPE = 5270400 ,
795
795
796
+ OPENAPI3_0_HEADER = 5280000 ,
797
+ OPENAPI3_0_HEADER_FIELD_DESCRIPTION_TYPE = 5280100 ,
798
+ OPENAPI3_0_HEADER_FIELD_REQUIRED_TYPE = 5280200 ,
799
+ OPENAPI3_0_HEADER_FIELD_DEPRECATED_TYPE = 5280300 ,
800
+ OPENAPI3_0_HEADER_FIELD_ALLOW_EMPTY_VALUE_TYPE = 5280400 ,
801
+ OPENAPI3_0_HEADER_FIELD_STYLE_TYPE = 5280500 ,
802
+ OPENAPI3_0_HEADER_FIELD_EXPLODE_TYPE = 5280600 ,
803
+ OPENAPI3_0_HEADER_FIELD_ALLOW_RESERVED_TYPE = 5280700 ,
804
+ OPENAPI3_0_HEADER_FIELD_SCHEMA_TYPE = 5280800 ,
805
+ OPENAPI3_0_HEADER_FIELD_EXAMPLES_VALUES_TYPE = 5280900 ,
806
+ OPENAPI3_0_HEADER_FIELD_CONTENT_VALUES_TYPE = 5281000 ,
807
+
796
808
OPENAPI3_1 = 7000000 ,
797
809
798
810
OPENAPI3_1_OPENAPI_VALUE_PATTERN_3_1_0 = 7000100 ,
Original file line number Diff line number Diff line change
1
+ import ApilintCodes from '../../../codes' ;
2
+ import { LinterMeta } from '../../../../apidom-language-types' ;
3
+
4
+ const allowEmptyValueTypeLint : LinterMeta = {
5
+ code : ApilintCodes . OPENAPI3_0_HEADER_FIELD_ALLOW_EMPTY_VALUE_TYPE ,
6
+ source : 'apilint' ,
7
+ message : 'allowEmptyValue must be a boolean' ,
8
+ severity : 1 ,
9
+ linterFunction : 'apilintType' ,
10
+ linterParams : [ 'boolean' ] ,
11
+ marker : 'value' ,
12
+ target : 'allowEmptyValue' ,
13
+ data : { } ,
14
+ } ;
15
+
16
+ export default allowEmptyValueTypeLint ;
Original file line number Diff line number Diff line change
1
+ import ApilintCodes from '../../../codes' ;
2
+ import { LinterMeta } from '../../../../apidom-language-types' ;
3
+
4
+ const allowReservedTypeLint : LinterMeta = {
5
+ code : ApilintCodes . OPENAPI3_0_HEADER_FIELD_ALLOW_RESERVED_TYPE ,
6
+ source : 'apilint' ,
7
+ message : 'allowReserved must be a boolean' ,
8
+ severity : 1 ,
9
+ linterFunction : 'apilintType' ,
10
+ linterParams : [ 'boolean' ] ,
11
+ marker : 'value' ,
12
+ target : 'allowReserved' ,
13
+ data : { } ,
14
+ } ;
15
+
16
+ export default allowReservedTypeLint ;
Original file line number Diff line number Diff line change
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_0Lint : 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 : [
12
+ [
13
+ 'description' ,
14
+ 'required' ,
15
+ 'deprecated' ,
16
+ 'allowEmptyValue' ,
17
+ 'style' ,
18
+ 'explode' ,
19
+ 'allowReserved' ,
20
+ 'schema' ,
21
+ 'example' ,
22
+ 'examples' ,
23
+ 'content' ,
24
+ '$ref' ,
25
+ ] ,
26
+ 'x-' ,
27
+ ] ,
28
+ marker : 'key' ,
29
+ targetSpecs : [
30
+ { namespace : 'openapi' , version : '3.0.0' } ,
31
+ { namespace : 'openapi' , version : '3.0.1' } ,
32
+ { namespace : 'openapi' , version : '3.0.2' } ,
33
+ { namespace : 'openapi' , version : '3.0.3' } ,
34
+ ] ,
35
+ } ;
36
+
37
+ export default allowedFields3_0Lint ;
Original file line number Diff line number Diff line change
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 : [
12
+ [
13
+ 'description' ,
14
+ 'required' ,
15
+ 'deprecated' ,
16
+ 'allowEmptyValue' ,
17
+ 'style' ,
18
+ 'explode' ,
19
+ 'allowReserved' ,
20
+ 'schema' ,
21
+ 'example' ,
22
+ 'examples' ,
23
+ 'content' ,
24
+ ] ,
25
+ 'x-' ,
26
+ ] ,
27
+ marker : 'key' ,
28
+ conditions : [
29
+ {
30
+ function : 'missingField' ,
31
+ params : [ '$ref' ] ,
32
+ } ,
33
+ ] ,
34
+ targetSpecs : [ { namespace : 'openapi' , version : '3.1.0' } ] ,
35
+ } ;
36
+
37
+ export default allowedFields3_1Lint ;
Original file line number Diff line number Diff line change
1
+ import ApilintCodes from '../../../codes' ;
2
+ import { LinterMeta } from '../../../../apidom-language-types' ;
3
+
4
+ const contentValuesTypeLint : LinterMeta = {
5
+ code : ApilintCodes . OPENAPI3_0_HEADER_FIELD_CONTENT_VALUES_TYPE ,
6
+ source : 'apilint' ,
7
+ message : '"content" members must be Media Type Object' ,
8
+ severity : 1 ,
9
+ linterFunction : 'apilintChildrenOfElementsOrClasses' ,
10
+ linterParams : [ [ 'mediaType' ] ] ,
11
+ marker : 'key' ,
12
+ markerTarget : 'content' ,
13
+ target : 'content' ,
14
+ data : { } ,
15
+ } ;
16
+
17
+ export default contentValuesTypeLint ;
Original file line number Diff line number Diff line change
1
+ import ApilintCodes from '../../../codes' ;
2
+ import { LinterMeta } from '../../../../apidom-language-types' ;
3
+
4
+ const deprecatedTypeLint : LinterMeta = {
5
+ code : ApilintCodes . OPENAPI3_0_HEADER_FIELD_DEPRECATED_TYPE ,
6
+ source : 'apilint' ,
7
+ message : 'deprecated must be a boolean' ,
8
+ severity : 1 ,
9
+ linterFunction : 'apilintType' ,
10
+ linterParams : [ 'boolean' ] ,
11
+ marker : 'value' ,
12
+ target : 'deprecated' ,
13
+ data : { } ,
14
+ } ;
15
+
16
+ export default deprecatedTypeLint ;
Original file line number Diff line number Diff line change
1
+ import ApilintCodes from '../../../codes' ;
2
+ import { LinterMeta } from '../../../../apidom-language-types' ;
3
+
4
+ const descriptionTypeLint : LinterMeta = {
5
+ code : ApilintCodes . OPENAPI3_0_HEADER_FIELD_DESCRIPTION_TYPE ,
6
+ source : 'apilint' ,
7
+ message : 'description must be a string' ,
8
+ severity : 1 ,
9
+ linterFunction : 'apilintType' ,
10
+ linterParams : [ 'string' ] ,
11
+ marker : 'value' ,
12
+ target : 'description' ,
13
+ data : { } ,
14
+ } ;
15
+
16
+ export default descriptionTypeLint ;
Original file line number Diff line number Diff line change
1
+ import ApilintCodes from '../../../codes' ;
2
+ import { LinterMeta } from '../../../../apidom-language-types' ;
3
+
4
+ const examplesValuesTypeLint : LinterMeta = {
5
+ code : ApilintCodes . OPENAPI3_0_HEADER_FIELD_EXAMPLES_VALUES_TYPE ,
6
+ source : 'apilint' ,
7
+ message : '"examples" members must be Example Object' ,
8
+ severity : 1 ,
9
+ linterFunction : 'apilintChildrenOfElementsOrClasses' ,
10
+ linterParams : [ [ 'example' ] ] ,
11
+ marker : 'key' ,
12
+ markerTarget : 'examples' ,
13
+ target : 'examples' ,
14
+ data : { } ,
15
+ } ;
16
+
17
+ export default examplesValuesTypeLint ;
Original file line number Diff line number Diff line change
1
+ import ApilintCodes from '../../../codes' ;
2
+ import { LinterMeta } from '../../../../apidom-language-types' ;
3
+
4
+ const explodeTypeLint : LinterMeta = {
5
+ code : ApilintCodes . OPENAPI3_0_HEADER_FIELD_EXPLODE_TYPE ,
6
+ source : 'apilint' ,
7
+ message : 'explode must be a boolean' ,
8
+ severity : 1 ,
9
+ linterFunction : 'apilintType' ,
10
+ linterParams : [ 'boolean' ] ,
11
+ marker : 'value' ,
12
+ target : 'explode' ,
13
+ data : { } ,
14
+ } ;
15
+
16
+ export default explodeTypeLint ;
Original file line number Diff line number Diff line change
1
+ import allowedFields3_0Lint from './allowed-fields-3-0' ;
2
+ import allowedFields3_1Lint from './allowed-fields-3-1' ;
3
+ import descriptionTypeLint from './description--type' ;
4
+ import requiredTypeLint from './required--type' ;
5
+ import deprecatedTypeLint from './deprecated--type' ;
6
+ import allowEmptyValueTypeLint from './allow-empty-value--type' ;
7
+ import styleTypeLint from './style--type' ;
8
+ import explodeTypeLint from './explode--type' ;
9
+ import allowReservedTypeLint from './allow-reserved--type' ;
10
+ import schemaTypeLint from './schema--type' ;
11
+ import examplesValuesTypeLint from './examples--values-type' ;
12
+ import contentValuesTypeLint from './content--values-type' ;
13
+
14
+ const lints = [
15
+ descriptionTypeLint ,
16
+ requiredTypeLint ,
17
+ deprecatedTypeLint ,
18
+ allowEmptyValueTypeLint ,
19
+ styleTypeLint ,
20
+ explodeTypeLint ,
21
+ allowReservedTypeLint ,
22
+ schemaTypeLint ,
23
+ examplesValuesTypeLint ,
24
+ contentValuesTypeLint ,
25
+ allowedFields3_0Lint ,
26
+ allowedFields3_1Lint ,
27
+ ] ;
28
+
29
+ export default lints ;
Original file line number Diff line number Diff line change
1
+ import ApilintCodes from '../../../codes' ;
2
+ import { LinterMeta } from '../../../../apidom-language-types' ;
3
+
4
+ const requiredTypeLint : LinterMeta = {
5
+ code : ApilintCodes . OPENAPI3_0_HEADER_FIELD_REQUIRED_TYPE ,
6
+ source : 'apilint' ,
7
+ message : 'required must be a boolean' ,
8
+ severity : 1 ,
9
+ linterFunction : 'apilintType' ,
10
+ linterParams : [ 'boolean' ] ,
11
+ marker : 'value' ,
12
+ target : 'required' ,
13
+ data : { } ,
14
+ } ;
15
+
16
+ export default requiredTypeLint ;
Original file line number Diff line number Diff line change
1
+ import ApilintCodes from '../../../codes' ;
2
+ import { LinterMeta } from '../../../../apidom-language-types' ;
3
+
4
+ const schemaTypeLint : LinterMeta = {
5
+ code : ApilintCodes . OPENAPI3_0_HEADER_FIELD_SCHEMA_TYPE ,
6
+ source : 'apilint' ,
7
+ message : 'schema must be an object' ,
8
+ severity : 1 ,
9
+ linterFunction : 'apilintElementOrClass' ,
10
+ linterParams : [ 'schema' ] ,
11
+ marker : 'value' ,
12
+ target : 'schema' ,
13
+ data : { } ,
14
+ } ;
15
+
16
+ export default schemaTypeLint ;
Original file line number Diff line number Diff line change
1
+ import ApilintCodes from '../../../codes' ;
2
+ import { LinterMeta } from '../../../../apidom-language-types' ;
3
+
4
+ const styleTypeLint : LinterMeta = {
5
+ code : ApilintCodes . OPENAPI3_0_HEADER_FIELD_STYLE_TYPE ,
6
+ source : 'apilint' ,
7
+ message : 'style must be a string' ,
8
+ severity : 1 ,
9
+ linterFunction : 'apilintType' ,
10
+ linterParams : [ 'string' ] ,
11
+ marker : 'value' ,
12
+ target : 'style' ,
13
+ data : { } ,
14
+ } ;
15
+
16
+ export default styleTypeLint ;
Original file line number Diff line number Diff line change
1
+ import lint from './lint' ;
1
2
import completion from './completion' ;
2
3
import documentation from './documentation' ;
3
4
import { FormatMeta } from '../../../apidom-language-types' ;
4
5
5
6
const meta : FormatMeta = {
7
+ lint,
6
8
completion,
7
9
documentation,
8
10
} ;
You can’t perform that action at this time.
0 commit comments