Skip to content

Commit 03e6b97

Browse files
committed
refactor(ls): remove unnecessary targetSpec fields
Currently we only support OpenAPI 3.1.0 and 3.0.x versions. Every rule (documentation, completion, linting) that is not explicitly annotated with targetSpec is assumed to be the same for both specification versions. If in future, we introduce OpenAPI 2.0, we would first need to annotate all the common rules explicitly with union targetSpecs of OpenAPI 3.1.0 and 3.0.x.
1 parent 01cd0e7 commit 03e6b97

File tree

7 files changed

+0
-49
lines changed

7 files changed

+0
-49
lines changed

packages/apidom-ls/src/config/openapi/info/lint/terms-of-service--format-uri.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ const termsOfServiceFormatURILint: LinterMeta = {
1010
marker: 'value',
1111
target: 'termsOfService',
1212
data: {},
13-
targetSpecs: [
14-
{ namespace: 'openapi', version: '3.0.0' },
15-
{ namespace: 'openapi', version: '3.0.1' },
16-
{ namespace: 'openapi', version: '3.0.2' },
17-
{ namespace: 'openapi', version: '3.0.3' },
18-
{ namespace: 'openapi', version: '3.1.0' },
19-
],
2013
};
2114

2215
export default termsOfServiceFormatURILint;

packages/apidom-ls/src/config/openapi/info/lint/terms-of-service--type.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ const termsOfServiceTypeLint: LinterMeta = {
1111
marker: 'value',
1212
target: 'termsOfService',
1313
data: {},
14-
targetSpecs: [
15-
{ namespace: 'openapi', version: '3.0.0' },
16-
{ namespace: 'openapi', version: '3.0.1' },
17-
{ namespace: 'openapi', version: '3.0.2' },
18-
{ namespace: 'openapi', version: '3.0.3' },
19-
{ namespace: 'openapi', version: '3.1.0' },
20-
],
2114
};
2215

2316
export default termsOfServiceTypeLint;

packages/apidom-ls/src/config/openapi/info/lint/title--required.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@ const titleRequiredLint: LinterMeta = {
1919
},
2020
],
2121
},
22-
targetSpecs: [
23-
{ namespace: 'openapi', version: '3.0.0' },
24-
{ namespace: 'openapi', version: '3.0.1' },
25-
{ namespace: 'openapi', version: '3.0.2' },
26-
{ namespace: 'openapi', version: '3.0.3' },
27-
{ namespace: 'openapi', version: '3.1.0' },
28-
],
2922
};
3023

3124
export default titleRequiredLint;

packages/apidom-ls/src/config/openapi/info/lint/title--type.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ const titleTypeLint: LinterMeta = {
1111
marker: 'value',
1212
target: 'title',
1313
data: {},
14-
targetSpecs: [
15-
{ namespace: 'openapi', version: '3.0.0' },
16-
{ namespace: 'openapi', version: '3.0.1' },
17-
{ namespace: 'openapi', version: '3.0.2' },
18-
{ namespace: 'openapi', version: '3.0.3' },
19-
{ namespace: 'openapi', version: '3.1.0' },
20-
],
2114
};
2215

2316
export default titleTypeLint;

packages/apidom-ls/src/config/openapi/server-variable/lint/allowed-fields.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ const allowedFieldsLint: LinterMeta = {
99
linterFunction: 'allowedFields',
1010
linterParams: [['enum', 'default', 'description'], 'x-'],
1111
marker: 'key',
12-
targetSpecs: [
13-
{ namespace: 'openapi', version: '3.0.0' },
14-
{ namespace: 'openapi', version: '3.0.1' },
15-
{ namespace: 'openapi', version: '3.0.2' },
16-
{ namespace: 'openapi', version: '3.0.3' },
17-
{ namespace: 'openapi', version: '3.1.0' },
18-
],
1912
};
2013

2114
export default allowedFieldsLint;

packages/apidom-ls/src/config/openapi/server/lint/allowed-fields.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ const allowedFieldsLint: LinterMeta = {
99
linterFunction: 'allowedFields',
1010
linterParams: [['url', 'description', 'variables'], 'x-'],
1111
marker: 'key',
12-
targetSpecs: [
13-
{ namespace: 'openapi', version: '3.0.0' },
14-
{ namespace: 'openapi', version: '3.0.1' },
15-
{ namespace: 'openapi', version: '3.0.2' },
16-
{ namespace: 'openapi', version: '3.0.3' },
17-
{ namespace: 'openapi', version: '3.1.0' },
18-
],
1912
};
2013

2114
export default allowedFieldsLint;

packages/apidom-ls/src/config/openapi/server/lint/url--format-uri.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ const urlFormatURILint: LinterMeta = {
1010
marker: 'value',
1111
target: 'url',
1212
data: {},
13-
targetSpecs: [
14-
{ namespace: 'openapi', version: '3.0.0' },
15-
{ namespace: 'openapi', version: '3.0.1' },
16-
{ namespace: 'openapi', version: '3.0.2' },
17-
{ namespace: 'openapi', version: '3.0.3' },
18-
{ namespace: 'openapi', version: '3.1.0' },
19-
],
2013
};
2114

2215
export default urlFormatURILint;

0 commit comments

Comments
 (0)