@redocly/openapi-core 1.25.15 → 1.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/__tests__/utils.ts +0 -3
- package/lib/bundle.js +3 -3
- package/lib/config/all.js +129 -48
- package/lib/config/builtIn.d.ts +1 -1
- package/lib/config/builtIn.js +5 -3
- package/lib/config/config-resolvers.d.ts +3 -1
- package/lib/config/config-resolvers.js +16 -14
- package/lib/config/config.d.ts +2 -2
- package/lib/config/config.js +38 -20
- package/lib/config/minimal.js +124 -49
- package/lib/config/recommended-strict.js +123 -48
- package/lib/config/recommended.js +122 -47
- package/lib/config/rules.d.ts +2 -2
- package/lib/config/spec.d.ts +3 -0
- package/lib/config/spec.js +30 -0
- package/lib/config/types.d.ts +23 -23
- package/lib/config/utils.d.ts +1 -1
- package/lib/config/utils.js +33 -23
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/lint.js +3 -3
- package/lib/oas-types.d.ts +11 -11
- package/lib/oas-types.js +6 -6
- package/lib/rules/arazzo/criteria-unique.d.ts +2 -2
- package/lib/rules/arazzo/index.d.ts +2 -2
- package/lib/rules/arazzo/index.js +6 -6
- package/lib/rules/arazzo/parameters-unique.d.ts +2 -2
- package/lib/rules/arazzo/requestBody-replacements-unique.d.ts +2 -2
- package/lib/rules/arazzo/sourceDescription-type.d.ts +2 -0
- package/lib/rules/arazzo/{source-description-type.js → sourceDescription-type.js} +5 -3
- package/lib/rules/arazzo/sourceDescriptions-name-unique.d.ts +2 -2
- package/lib/rules/arazzo/sourceDescriptions-not-empty.d.ts +2 -0
- package/lib/rules/arazzo/sourceDescriptions-not-empty.js +18 -0
- package/lib/rules/arazzo/step-onFailure-unique.d.ts +2 -2
- package/lib/rules/arazzo/step-onSuccess-unique.d.ts +2 -2
- package/lib/rules/arazzo/stepId-unique.d.ts +2 -2
- package/lib/rules/arazzo/workflow-dependsOn.d.ts +2 -2
- package/lib/rules/arazzo/workflowId-unique.d.ts +2 -2
- package/lib/rules/async2/index.js +5 -2
- package/lib/rules/async3/index.js +5 -2
- package/lib/rules/common/assertions/index.d.ts +2 -2
- package/lib/rules/common/struct.d.ts +2 -0
- package/lib/rules/common/{spec.js → struct.js} +3 -3
- package/lib/rules/oas2/index.js +5 -2
- package/lib/rules/oas3/index.js +5 -2
- package/lib/rules/spot/no-criteria-xpath.d.ts +2 -2
- package/lib/rules/spot/parameters-not-in-body.d.ts +2 -2
- package/lib/rules/spot/version-enum.d.ts +2 -2
- package/lib/types/arazzo.d.ts +1 -1
- package/lib/types/arazzo.js +3 -16
- package/lib/types/redocly-yaml.d.ts +6 -8
- package/lib/types/redocly-yaml.js +47 -13
- package/lib/typings/arazzo.d.ts +1 -6
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +3 -2
- package/lib/visitors.d.ts +5 -6
- package/package.json +1 -3
- package/src/__tests__/lint.test.ts +3 -3
- package/src/bundle.ts +3 -3
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +228 -72
- package/src/config/__tests__/__snapshots__/config.test.ts.snap +16 -3
- package/src/config/__tests__/config-resolvers.test.ts +14 -2
- package/src/config/__tests__/config.test.ts +11 -6
- package/src/config/all.ts +129 -48
- package/src/config/builtIn.ts +10 -8
- package/src/config/config-resolvers.ts +37 -45
- package/src/config/config.ts +46 -22
- package/src/config/minimal.ts +124 -49
- package/src/config/recommended-strict.ts +123 -48
- package/src/config/recommended.ts +122 -47
- package/src/config/rules.ts +2 -2
- package/src/config/spec.ts +31 -0
- package/src/config/types.ts +27 -33
- package/src/config/utils.ts +38 -26
- package/src/index.ts +1 -1
- package/src/lint.ts +6 -6
- package/src/oas-types.ts +19 -20
- package/src/rules/arazzo/__tests__/criteria-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/no-criteria-xpath.test.ts +1 -2
- package/src/rules/arazzo/__tests__/parameters-not-in-body.test.ts +1 -2
- package/src/rules/arazzo/__tests__/parameters-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/requestBody-replacements-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/source-description-type.test.ts +2 -4
- package/src/rules/arazzo/__tests__/sourceDescription-name-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/sourceDescriptions-not-empty.test.ts +104 -0
- package/src/rules/arazzo/__tests__/step-onFailure-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/step-onSuccess-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/stepId-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/version-enum.test.ts +1 -2
- package/src/rules/arazzo/__tests__/workflow-dependsOn.test.ts +3 -6
- package/src/rules/arazzo/__tests__/workflowId-unique.test.ts +2 -4
- package/src/rules/arazzo/criteria-unique.ts +2 -2
- package/src/rules/arazzo/index.ts +22 -22
- package/src/rules/arazzo/parameters-unique.ts +2 -2
- package/src/rules/arazzo/requestBody-replacements-unique.ts +2 -2
- package/src/rules/arazzo/{source-description-type.ts → sourceDescription-type.ts} +6 -5
- package/src/rules/arazzo/sourceDescriptions-name-unique.ts +2 -2
- package/src/rules/arazzo/sourceDescriptions-not-empty.ts +17 -0
- package/src/rules/arazzo/step-onFailure-unique.ts +2 -2
- package/src/rules/arazzo/step-onSuccess-unique.ts +2 -2
- package/src/rules/arazzo/stepId-unique.ts +2 -2
- package/src/rules/arazzo/workflow-dependsOn.ts +2 -2
- package/src/rules/arazzo/workflowId-unique.ts +2 -2
- package/src/rules/async2/index.ts +5 -2
- package/src/rules/async3/index.ts +5 -2
- package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +1 -1
- package/src/rules/common/__tests__/{spec.test.ts → struct.test.ts} +35 -35
- package/src/rules/common/assertions/index.ts +2 -2
- package/src/rules/common/{spec.ts → struct.ts} +2 -2
- package/src/rules/oas2/index.ts +5 -2
- package/src/rules/oas3/__tests__/spec/spec.test.ts +10 -10
- package/src/rules/oas3/index.ts +5 -2
- package/src/rules/spot/no-criteria-xpath.ts +2 -2
- package/src/rules/spot/parameters-not-in-body.ts +2 -2
- package/src/rules/spot/version-enum.ts +2 -2
- package/src/types/arazzo.ts +2 -14
- package/src/types/redocly-yaml.ts +48 -17
- package/src/typings/arazzo.ts +1 -10
- package/src/utils.ts +4 -2
- package/src/visitors.ts +4 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/rules/arazzo/source-description-type.d.ts +0 -2
- package/lib/rules/common/spec.d.ts +0 -2
- package/lib/rules/spot/no-actions-type-end.d.ts +0 -2
- package/lib/rules/spot/no-actions-type-end.js +0 -28
- package/src/rules/arazzo/__tests__/no-actions-type-end.test.ts +0 -122
- package/src/rules/spot/no-actions-type-end.ts +0 -27
|
@@ -6,7 +6,7 @@ StyleguideConfig {
|
|
|
6
6
|
"_usedVersions": Set {},
|
|
7
7
|
"configFile": undefined,
|
|
8
8
|
"decorators": {
|
|
9
|
-
"
|
|
9
|
+
"arazzo1": {},
|
|
10
10
|
"async2": {
|
|
11
11
|
"oas2": {},
|
|
12
12
|
"oas3_0": {},
|
|
@@ -50,7 +50,7 @@ StyleguideConfig {
|
|
|
50
50
|
"pluginPaths": [],
|
|
51
51
|
"plugins": [],
|
|
52
52
|
"preprocessors": {
|
|
53
|
-
"
|
|
53
|
+
"arazzo1": {},
|
|
54
54
|
"async2": {
|
|
55
55
|
"oas2": {},
|
|
56
56
|
"oas3_0": {},
|
|
@@ -119,7 +119,20 @@ StyleguideConfig {
|
|
|
119
119
|
},
|
|
120
120
|
"recommendedFallback": false,
|
|
121
121
|
"rules": {
|
|
122
|
-
"
|
|
122
|
+
"arazzo1": {
|
|
123
|
+
"oas2": {
|
|
124
|
+
"no-empty-servers": "error",
|
|
125
|
+
"operation-summary": "error",
|
|
126
|
+
},
|
|
127
|
+
"oas3_0": {
|
|
128
|
+
"no-empty-servers": "error",
|
|
129
|
+
"operation-summary": "error",
|
|
130
|
+
},
|
|
131
|
+
"oas3_1": {
|
|
132
|
+
"no-empty-servers": "error",
|
|
133
|
+
"operation-summary": "error",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
123
136
|
"async2": {
|
|
124
137
|
"oas2": {
|
|
125
138
|
"no-empty-servers": "error",
|
|
@@ -389,11 +389,23 @@ describe('resolveStyleguideConfig', () => {
|
|
|
389
389
|
|
|
390
390
|
describe('resolveApis', () => {
|
|
391
391
|
it('should resolve apis styleguideConfig and merge minimal extends', async () => {
|
|
392
|
+
const baseStyleguideConfig: StyleguideRawConfig = {
|
|
393
|
+
oas3_1Rules: {
|
|
394
|
+
'operation-2xx-response': 'error',
|
|
395
|
+
},
|
|
396
|
+
};
|
|
397
|
+
const mergedStyleguidePreset = resolveStyleguideConfig({
|
|
398
|
+
styleguideConfig: { ...baseStyleguideConfig, extends: ['minimal'] },
|
|
399
|
+
});
|
|
392
400
|
const rawConfig: RawConfig = {
|
|
393
401
|
apis: {
|
|
394
402
|
petstore: {
|
|
395
403
|
root: 'some/path',
|
|
396
|
-
styleguide: {
|
|
404
|
+
styleguide: {
|
|
405
|
+
oas3_1Rules: {
|
|
406
|
+
'operation-2xx-response': 'error',
|
|
407
|
+
},
|
|
408
|
+
},
|
|
397
409
|
},
|
|
398
410
|
},
|
|
399
411
|
styleguide: {
|
|
@@ -401,7 +413,7 @@ describe('resolveApis', () => {
|
|
|
401
413
|
},
|
|
402
414
|
};
|
|
403
415
|
const apisResult = await resolveApis({ rawConfig });
|
|
404
|
-
expect(apisResult['petstore'].styleguide).toEqual(await
|
|
416
|
+
expect(apisResult['petstore'].styleguide).toEqual(await mergedStyleguidePreset);
|
|
405
417
|
});
|
|
406
418
|
|
|
407
419
|
it('should not merge recommended extends by default by every level', async () => {
|
|
@@ -117,7 +117,7 @@ describe('getMergedConfig', () => {
|
|
|
117
117
|
"_usedVersions": Set {},
|
|
118
118
|
"configFile": "redocly.yaml",
|
|
119
119
|
"decorators": {
|
|
120
|
-
"
|
|
120
|
+
"arazzo1": {},
|
|
121
121
|
"async2": {},
|
|
122
122
|
"async3": {},
|
|
123
123
|
"oas2": {},
|
|
@@ -130,7 +130,7 @@ describe('getMergedConfig', () => {
|
|
|
130
130
|
"pluginPaths": [],
|
|
131
131
|
"plugins": [],
|
|
132
132
|
"preprocessors": {
|
|
133
|
-
"
|
|
133
|
+
"arazzo1": {},
|
|
134
134
|
"async2": {},
|
|
135
135
|
"async3": {},
|
|
136
136
|
"oas2": {},
|
|
@@ -146,7 +146,9 @@ describe('getMergedConfig', () => {
|
|
|
146
146
|
},
|
|
147
147
|
"recommendedFallback": false,
|
|
148
148
|
"rules": {
|
|
149
|
-
"
|
|
149
|
+
"arazzo1": {
|
|
150
|
+
"operation-summary": "warn",
|
|
151
|
+
},
|
|
150
152
|
"async2": {
|
|
151
153
|
"operation-summary": "warn",
|
|
152
154
|
},
|
|
@@ -230,7 +232,7 @@ describe('getMergedConfig', () => {
|
|
|
230
232
|
"_usedVersions": Set {},
|
|
231
233
|
"configFile": "redocly.yaml",
|
|
232
234
|
"decorators": {
|
|
233
|
-
"
|
|
235
|
+
"arazzo1": {},
|
|
234
236
|
"async2": {},
|
|
235
237
|
"async3": {},
|
|
236
238
|
"oas2": {},
|
|
@@ -243,7 +245,7 @@ describe('getMergedConfig', () => {
|
|
|
243
245
|
"pluginPaths": [],
|
|
244
246
|
"plugins": [],
|
|
245
247
|
"preprocessors": {
|
|
246
|
-
"
|
|
248
|
+
"arazzo1": {},
|
|
247
249
|
"async2": {},
|
|
248
250
|
"async3": {},
|
|
249
251
|
"oas2": {},
|
|
@@ -261,7 +263,10 @@ describe('getMergedConfig', () => {
|
|
|
261
263
|
},
|
|
262
264
|
"recommendedFallback": false,
|
|
263
265
|
"rules": {
|
|
264
|
-
"
|
|
266
|
+
"arazzo1": {
|
|
267
|
+
"no-empty-servers": "error",
|
|
268
|
+
"operation-summary": "error",
|
|
269
|
+
},
|
|
265
270
|
"async2": {
|
|
266
271
|
"no-empty-servers": "error",
|
|
267
272
|
"operation-summary": "error",
|
package/src/config/all.ts
CHANGED
|
@@ -2,52 +2,47 @@ import type { PluginStyleguideConfig } from './types';
|
|
|
2
2
|
|
|
3
3
|
const all: PluginStyleguideConfig<'built-in'> = {
|
|
4
4
|
rules: {
|
|
5
|
+
struct: 'error',
|
|
6
|
+
},
|
|
7
|
+
oas2Rules: {
|
|
8
|
+
'boolean-parameter-prefixes': 'error',
|
|
5
9
|
'info-contact': 'error',
|
|
6
10
|
'info-license': 'error',
|
|
7
11
|
'info-license-url': 'error',
|
|
8
12
|
'info-license-strict': 'error',
|
|
9
|
-
'
|
|
10
|
-
'tags-alphabetical': 'error',
|
|
11
|
-
'parameter-description': 'error',
|
|
13
|
+
'no-path-trailing-slash': 'error',
|
|
12
14
|
'no-identical-paths': 'error',
|
|
13
15
|
'no-ambiguous-paths': 'error',
|
|
14
|
-
'no-
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'operation-2xx-response': 'error',
|
|
21
|
-
'operation-4xx-response': 'error',
|
|
22
|
-
'operation-operationId': 'error',
|
|
16
|
+
'no-invalid-schema-examples': 'error',
|
|
17
|
+
'no-invalid-parameter-examples': 'error',
|
|
18
|
+
'no-http-verbs-in-paths': 'error',
|
|
19
|
+
'no-enum-type-mismatch': 'error',
|
|
20
|
+
'no-unresolved-refs': 'error',
|
|
21
|
+
'no-required-schema-properties-undefined': 'error',
|
|
23
22
|
'operation-summary': 'error',
|
|
23
|
+
'operation-operationId': 'error',
|
|
24
24
|
'operation-operationId-unique': 'error',
|
|
25
25
|
'operation-operationId-url-safe': 'error',
|
|
26
|
+
'operation-description': 'error',
|
|
27
|
+
'operation-2xx-response': 'error',
|
|
28
|
+
'operation-4xx-response': 'error',
|
|
26
29
|
'operation-parameters-unique': 'error',
|
|
27
30
|
'operation-tag-defined': 'error',
|
|
28
|
-
'security-defined': 'error',
|
|
29
31
|
'operation-singular-tag': 'error',
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
+
'parameter-description': 'error',
|
|
33
|
+
'path-declaration-must-exist': 'error',
|
|
34
|
+
'path-not-include-query': 'error',
|
|
35
|
+
'path-parameters-defined': 'error',
|
|
32
36
|
'paths-kebab-case': 'error',
|
|
33
|
-
'no-http-verbs-in-paths': 'error',
|
|
34
37
|
'path-excludes-patterns': {
|
|
35
38
|
severity: 'error',
|
|
36
39
|
patterns: [],
|
|
37
40
|
},
|
|
38
|
-
spec: 'error',
|
|
39
|
-
'no-invalid-schema-examples': 'error',
|
|
40
|
-
'no-invalid-parameter-examples': 'error',
|
|
41
|
-
'scalar-property-missing-example': 'error',
|
|
42
|
-
'spec-strict-refs': 'error',
|
|
43
41
|
'path-http-verbs-order': 'error',
|
|
44
42
|
'path-params-defined': 'error',
|
|
43
|
+
'path-segment-plural': 'error',
|
|
45
44
|
'required-string-property-missing-min-length': 'error',
|
|
46
45
|
'response-contains-header': 'error',
|
|
47
|
-
'no-required-schema-properties-undefined': 'error',
|
|
48
|
-
},
|
|
49
|
-
oas2Rules: {
|
|
50
|
-
'boolean-parameter-prefixes': 'error',
|
|
51
46
|
'request-mime-type': {
|
|
52
47
|
severity: 'error',
|
|
53
48
|
allowedValues: ['application/json'],
|
|
@@ -57,8 +52,29 @@ const all: PluginStyleguideConfig<'built-in'> = {
|
|
|
57
52
|
allowedValues: ['application/json'],
|
|
58
53
|
},
|
|
59
54
|
'response-contains-property': 'error',
|
|
55
|
+
'security-defined': 'error',
|
|
56
|
+
'spec-strict-refs': 'error',
|
|
57
|
+
'scalar-property-missing-example': 'error',
|
|
58
|
+
'tag-description': 'error',
|
|
59
|
+
'tags-alphabetical': 'error',
|
|
60
60
|
},
|
|
61
61
|
oas3_0Rules: {
|
|
62
|
+
'array-parameter-serialization': 'error',
|
|
63
|
+
'boolean-parameter-prefixes': 'error',
|
|
64
|
+
'component-name-unique': 'error',
|
|
65
|
+
'info-contact': 'error',
|
|
66
|
+
'info-license': 'error',
|
|
67
|
+
'info-license-url': 'error',
|
|
68
|
+
'info-license-strict': 'error',
|
|
69
|
+
'no-path-trailing-slash': 'error',
|
|
70
|
+
'no-identical-paths': 'error',
|
|
71
|
+
'no-ambiguous-paths': 'error',
|
|
72
|
+
'no-invalid-schema-examples': 'error',
|
|
73
|
+
'no-invalid-parameter-examples': 'error',
|
|
74
|
+
'no-http-verbs-in-paths': 'error',
|
|
75
|
+
'no-enum-type-mismatch': 'error',
|
|
76
|
+
'no-unresolved-refs': 'error',
|
|
77
|
+
'no-required-schema-properties-undefined': 'error',
|
|
62
78
|
'no-invalid-media-type-examples': 'error',
|
|
63
79
|
'no-server-example.com': 'error',
|
|
64
80
|
'no-server-trailing-slash': 'error',
|
|
@@ -67,8 +83,31 @@ const all: PluginStyleguideConfig<'built-in'> = {
|
|
|
67
83
|
'no-unused-components': 'error',
|
|
68
84
|
'no-undefined-server-variable': 'error',
|
|
69
85
|
'no-server-variables-empty-enum': 'error',
|
|
86
|
+
'operation-summary': 'error',
|
|
87
|
+
'operation-operationId': 'error',
|
|
88
|
+
'operation-operationId-unique': 'error',
|
|
89
|
+
'operation-operationId-url-safe': 'error',
|
|
90
|
+
'operation-description': 'error',
|
|
91
|
+
'operation-2xx-response': 'error',
|
|
92
|
+
'operation-4xx-response': 'error',
|
|
70
93
|
'operation-4xx-problem-details-rfc7807': 'error',
|
|
71
|
-
'
|
|
94
|
+
'operation-parameters-unique': 'error',
|
|
95
|
+
'operation-tag-defined': 'error',
|
|
96
|
+
'operation-singular-tag': 'error',
|
|
97
|
+
'parameter-description': 'error',
|
|
98
|
+
'path-declaration-must-exist': 'error',
|
|
99
|
+
'path-not-include-query': 'error',
|
|
100
|
+
'path-parameters-defined': 'error',
|
|
101
|
+
'paths-kebab-case': 'error',
|
|
102
|
+
'path-excludes-patterns': {
|
|
103
|
+
severity: 'error',
|
|
104
|
+
patterns: [],
|
|
105
|
+
},
|
|
106
|
+
'path-http-verbs-order': 'error',
|
|
107
|
+
'path-params-defined': 'error',
|
|
108
|
+
'path-segment-plural': 'error',
|
|
109
|
+
'required-string-property-missing-min-length': 'error',
|
|
110
|
+
'response-contains-header': 'error',
|
|
72
111
|
'request-mime-type': {
|
|
73
112
|
severity: 'error',
|
|
74
113
|
allowedValues: ['application/json'],
|
|
@@ -77,12 +116,31 @@ const all: PluginStyleguideConfig<'built-in'> = {
|
|
|
77
116
|
severity: 'error',
|
|
78
117
|
allowedValues: ['application/json'],
|
|
79
118
|
},
|
|
80
|
-
'component-name-unique': 'error',
|
|
81
119
|
'response-contains-property': 'error',
|
|
120
|
+
'security-defined': 'error',
|
|
121
|
+
'spec-strict-refs': 'error',
|
|
122
|
+
'scalar-property-missing-example': 'error',
|
|
82
123
|
'spec-components-invalid-map-name': 'error',
|
|
83
|
-
'
|
|
124
|
+
'tag-description': 'error',
|
|
125
|
+
'tags-alphabetical': 'error',
|
|
84
126
|
},
|
|
85
127
|
oas3_1Rules: {
|
|
128
|
+
'array-parameter-serialization': 'error',
|
|
129
|
+
'boolean-parameter-prefixes': 'error',
|
|
130
|
+
'component-name-unique': 'error',
|
|
131
|
+
'info-contact': 'error',
|
|
132
|
+
'info-license': 'error',
|
|
133
|
+
'info-license-url': 'error',
|
|
134
|
+
'info-license-strict': 'error',
|
|
135
|
+
'no-path-trailing-slash': 'error',
|
|
136
|
+
'no-identical-paths': 'error',
|
|
137
|
+
'no-ambiguous-paths': 'error',
|
|
138
|
+
'no-invalid-schema-examples': 'error',
|
|
139
|
+
'no-invalid-parameter-examples': 'error',
|
|
140
|
+
'no-http-verbs-in-paths': 'error',
|
|
141
|
+
'no-enum-type-mismatch': 'error',
|
|
142
|
+
'no-unresolved-refs': 'error',
|
|
143
|
+
'no-required-schema-properties-undefined': 'error',
|
|
86
144
|
'no-invalid-media-type-examples': 'error',
|
|
87
145
|
'no-server-example.com': 'error',
|
|
88
146
|
'no-server-trailing-slash': 'error',
|
|
@@ -91,8 +149,31 @@ const all: PluginStyleguideConfig<'built-in'> = {
|
|
|
91
149
|
'no-unused-components': 'error',
|
|
92
150
|
'no-undefined-server-variable': 'error',
|
|
93
151
|
'no-server-variables-empty-enum': 'error',
|
|
152
|
+
'parameter-description': 'error',
|
|
153
|
+
'path-declaration-must-exist': 'error',
|
|
154
|
+
'path-not-include-query': 'error',
|
|
155
|
+
'path-parameters-defined': 'error',
|
|
156
|
+
'paths-kebab-case': 'error',
|
|
157
|
+
'path-excludes-patterns': {
|
|
158
|
+
severity: 'error',
|
|
159
|
+
patterns: [],
|
|
160
|
+
},
|
|
161
|
+
'path-http-verbs-order': 'error',
|
|
162
|
+
'path-params-defined': 'error',
|
|
163
|
+
'path-segment-plural': 'error',
|
|
164
|
+
'operation-summary': 'error',
|
|
165
|
+
'operation-operationId': 'error',
|
|
166
|
+
'operation-operationId-unique': 'error',
|
|
167
|
+
'operation-operationId-url-safe': 'error',
|
|
168
|
+
'operation-description': 'error',
|
|
169
|
+
'operation-2xx-response': 'error',
|
|
170
|
+
'operation-4xx-response': 'error',
|
|
94
171
|
'operation-4xx-problem-details-rfc7807': 'error',
|
|
95
|
-
'
|
|
172
|
+
'operation-parameters-unique': 'error',
|
|
173
|
+
'operation-tag-defined': 'error',
|
|
174
|
+
'operation-singular-tag': 'error',
|
|
175
|
+
'required-string-property-missing-min-length': 'error',
|
|
176
|
+
'response-contains-header': 'error',
|
|
96
177
|
'request-mime-type': {
|
|
97
178
|
severity: 'error',
|
|
98
179
|
allowedValues: ['application/json'],
|
|
@@ -101,47 +182,47 @@ const all: PluginStyleguideConfig<'built-in'> = {
|
|
|
101
182
|
severity: 'error',
|
|
102
183
|
allowedValues: ['application/json'],
|
|
103
184
|
},
|
|
104
|
-
'component-name-unique': 'error',
|
|
105
185
|
'response-contains-property': 'error',
|
|
186
|
+
'security-defined': 'error',
|
|
187
|
+
'spec-strict-refs': 'error',
|
|
188
|
+
'scalar-property-missing-example': 'error',
|
|
106
189
|
'spec-components-invalid-map-name': 'error',
|
|
107
|
-
'
|
|
190
|
+
'tag-description': 'error',
|
|
191
|
+
'tags-alphabetical': 'error',
|
|
108
192
|
},
|
|
109
193
|
async2Rules: {
|
|
110
|
-
|
|
194
|
+
'channels-kebab-case': 'error',
|
|
111
195
|
'info-contact': 'error',
|
|
112
196
|
'info-license-strict': 'error',
|
|
197
|
+
'no-channel-trailing-slash': 'error',
|
|
113
198
|
'operation-operationId': 'error',
|
|
114
199
|
'tag-description': 'error',
|
|
115
200
|
'tags-alphabetical': 'error',
|
|
116
|
-
'channels-kebab-case': 'error',
|
|
117
|
-
'no-channel-trailing-slash': 'error',
|
|
118
201
|
},
|
|
119
202
|
async3Rules: {
|
|
120
|
-
|
|
203
|
+
'channels-kebab-case': 'error',
|
|
121
204
|
'info-contact': 'error',
|
|
122
205
|
'info-license-strict': 'error',
|
|
206
|
+
'no-channel-trailing-slash': 'error',
|
|
123
207
|
'operation-operationId': 'error',
|
|
124
208
|
'tag-description': 'error',
|
|
125
209
|
'tags-alphabetical': 'error',
|
|
126
|
-
'channels-kebab-case': 'error',
|
|
127
|
-
'no-channel-trailing-slash': 'error',
|
|
128
210
|
},
|
|
129
|
-
|
|
130
|
-
|
|
211
|
+
arazzo1Rules: {
|
|
212
|
+
'criteria-unique': 'error',
|
|
213
|
+
'no-criteria-xpath': 'error',
|
|
131
214
|
'parameters-not-in-body': 'error',
|
|
215
|
+
'parameters-unique': 'error',
|
|
216
|
+
'requestBody-replacements-unique': 'error',
|
|
132
217
|
'sourceDescription-type': 'error',
|
|
133
|
-
'
|
|
134
|
-
'
|
|
218
|
+
'step-onSuccess-unique': 'error',
|
|
219
|
+
'step-onFailure-unique': 'error',
|
|
135
220
|
'stepId-unique': 'error',
|
|
136
221
|
'sourceDescription-name-unique': 'error',
|
|
222
|
+
'sourceDescriptions-not-empty': 'error',
|
|
223
|
+
'version-enum': 'error',
|
|
224
|
+
'workflowId-unique': 'error',
|
|
137
225
|
'workflow-dependsOn': 'error',
|
|
138
|
-
'parameters-unique': 'error',
|
|
139
|
-
'step-onSuccess-unique': 'error',
|
|
140
|
-
'step-onFailure-unique': 'error',
|
|
141
|
-
'requestBody-replacements-unique': 'error',
|
|
142
|
-
'no-criteria-xpath': 'error',
|
|
143
|
-
'no-actions-type-end': 'error',
|
|
144
|
-
'criteria-unique': 'error',
|
|
145
226
|
},
|
|
146
227
|
};
|
|
147
228
|
|
package/src/config/builtIn.ts
CHANGED
|
@@ -2,51 +2,53 @@ import recommended from './recommended';
|
|
|
2
2
|
import recommendedStrict from './recommended-strict';
|
|
3
3
|
import all from './all';
|
|
4
4
|
import minimal from './minimal';
|
|
5
|
+
import spec from './spec';
|
|
5
6
|
import { rules as oas3Rules, preprocessors as oas3Preprocessors } from '../rules/oas3';
|
|
6
7
|
import { rules as oas2Rules, preprocessors as oas2Preprocessors } from '../rules/oas2';
|
|
7
8
|
import { rules as async2Rules, preprocessors as async2Preprocessors } from '../rules/async2';
|
|
8
9
|
import { rules as async3Rules, preprocessors as async3Preprocessors } from '../rules/async3';
|
|
9
|
-
import { rules as
|
|
10
|
+
import { rules as arazzo1Rules, preprocessors as arazzoPreprocessors } from '../rules/arazzo';
|
|
10
11
|
import { decorators as oas3Decorators } from '../decorators/oas3';
|
|
11
12
|
import { decorators as oas2Decorators } from '../decorators/oas2';
|
|
12
13
|
import { decorators as async2Decorators } from '../decorators/async2';
|
|
13
14
|
import { decorators as async3Decorators } from '../decorators/async3';
|
|
14
|
-
import { decorators as
|
|
15
|
+
import { decorators as arazzo1Decorators } from '../decorators/arazzo';
|
|
15
16
|
|
|
16
|
-
import type {
|
|
17
|
+
import type { StyleguideRawConfig, Plugin } from './types';
|
|
17
18
|
|
|
18
19
|
export const builtInConfigs: Record<string, StyleguideRawConfig> = {
|
|
19
20
|
recommended,
|
|
20
21
|
'recommended-strict': recommendedStrict,
|
|
21
22
|
minimal,
|
|
22
23
|
all,
|
|
24
|
+
spec,
|
|
23
25
|
'redocly-registry': {
|
|
24
26
|
decorators: { 'registry-dependencies': 'on' },
|
|
25
27
|
},
|
|
26
28
|
};
|
|
27
29
|
|
|
28
|
-
export const defaultPlugin: Plugin = {
|
|
30
|
+
export const defaultPlugin: Plugin<'built-in'> = {
|
|
29
31
|
id: '', // default plugin doesn't have id
|
|
30
32
|
rules: {
|
|
31
33
|
oas3: oas3Rules,
|
|
32
34
|
oas2: oas2Rules,
|
|
33
35
|
async2: async2Rules,
|
|
34
36
|
async3: async3Rules,
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
+
arazzo1: arazzo1Rules,
|
|
38
|
+
},
|
|
37
39
|
preprocessors: {
|
|
38
40
|
oas3: oas3Preprocessors,
|
|
39
41
|
oas2: oas2Preprocessors,
|
|
40
42
|
async2: async2Preprocessors,
|
|
41
43
|
async3: async3Preprocessors,
|
|
42
|
-
|
|
44
|
+
arazzo1: arazzoPreprocessors,
|
|
43
45
|
},
|
|
44
46
|
decorators: {
|
|
45
47
|
oas3: oas3Decorators,
|
|
46
48
|
oas2: oas2Decorators,
|
|
47
49
|
async2: async2Decorators,
|
|
48
50
|
async3: async3Decorators,
|
|
49
|
-
|
|
51
|
+
arazzo1: arazzo1Decorators,
|
|
50
52
|
},
|
|
51
53
|
configs: builtInConfigs,
|
|
52
54
|
};
|
|
@@ -261,8 +261,8 @@ export async function resolvePlugins(
|
|
|
261
261
|
if (pluginModule.rules.async3) {
|
|
262
262
|
plugin.rules.async3 = prefixRules(pluginModule.rules.async3, id);
|
|
263
263
|
}
|
|
264
|
-
if (pluginModule.rules.
|
|
265
|
-
plugin.rules.
|
|
264
|
+
if (pluginModule.rules.arazzo1) {
|
|
265
|
+
plugin.rules.arazzo1 = prefixRules(pluginModule.rules.arazzo1, id);
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
if (pluginModule.preprocessors) {
|
|
@@ -271,7 +271,7 @@ export async function resolvePlugins(
|
|
|
271
271
|
!pluginModule.preprocessors.oas2 &&
|
|
272
272
|
!pluginModule.preprocessors.async2 &&
|
|
273
273
|
!pluginModule.preprocessors.async3 &&
|
|
274
|
-
!pluginModule.preprocessors.
|
|
274
|
+
!pluginModule.preprocessors.arazzo1
|
|
275
275
|
) {
|
|
276
276
|
throw new Error(
|
|
277
277
|
`Plugin \`preprocessors\` must have \`oas3\`, \`oas2\` or \`async2\` preprocessors "${p}.`
|
|
@@ -290,8 +290,8 @@ export async function resolvePlugins(
|
|
|
290
290
|
if (pluginModule.preprocessors.async3) {
|
|
291
291
|
plugin.preprocessors.async3 = prefixRules(pluginModule.preprocessors.async3, id);
|
|
292
292
|
}
|
|
293
|
-
if (pluginModule.preprocessors.
|
|
294
|
-
plugin.preprocessors.
|
|
293
|
+
if (pluginModule.preprocessors.arazzo1) {
|
|
294
|
+
plugin.preprocessors.arazzo1 = prefixRules(pluginModule.preprocessors.arazzo1, id);
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
|
|
@@ -301,7 +301,7 @@ export async function resolvePlugins(
|
|
|
301
301
|
!pluginModule.decorators.oas2 &&
|
|
302
302
|
!pluginModule.decorators.async2 &&
|
|
303
303
|
!pluginModule.decorators.async3 &&
|
|
304
|
-
!pluginModule.decorators.
|
|
304
|
+
!pluginModule.decorators.arazzo1
|
|
305
305
|
) {
|
|
306
306
|
throw new Error(
|
|
307
307
|
`Plugin \`decorators\` must have \`oas3\`, \`oas2\`, \`async2\` or \`async3\` decorators "${p}.`
|
|
@@ -320,8 +320,8 @@ export async function resolvePlugins(
|
|
|
320
320
|
if (pluginModule.decorators.async3) {
|
|
321
321
|
plugin.decorators.async3 = prefixRules(pluginModule.decorators.async3, id);
|
|
322
322
|
}
|
|
323
|
-
if (pluginModule.decorators.
|
|
324
|
-
plugin.decorators.
|
|
323
|
+
if (pluginModule.decorators.arazzo1) {
|
|
324
|
+
plugin.decorators.arazzo1 = prefixRules(pluginModule.decorators.arazzo1, id);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
|
|
@@ -370,19 +370,19 @@ export async function resolveApis({
|
|
|
370
370
|
return resolvedApis;
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
-
async function resolveAndMergeNestedStyleguideConfig(
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
parentConfigPaths
|
|
384
|
-
extendPaths
|
|
385
|
-
): Promise<ResolvedStyleguideConfig> {
|
|
373
|
+
async function resolveAndMergeNestedStyleguideConfig({
|
|
374
|
+
styleguideConfig,
|
|
375
|
+
configPath = '',
|
|
376
|
+
resolver = new BaseResolver(),
|
|
377
|
+
parentConfigPaths = [],
|
|
378
|
+
extendPaths = [],
|
|
379
|
+
}: {
|
|
380
|
+
styleguideConfig?: StyleguideRawConfig;
|
|
381
|
+
configPath?: string;
|
|
382
|
+
resolver?: BaseResolver;
|
|
383
|
+
parentConfigPaths?: string[];
|
|
384
|
+
extendPaths?: string[];
|
|
385
|
+
}): Promise<ResolvedStyleguideConfig> {
|
|
386
386
|
if (parentConfigPaths.includes(configPath)) {
|
|
387
387
|
throw new Error(`Circular dependency in config file: "${configPath}"`);
|
|
388
388
|
}
|
|
@@ -414,15 +414,13 @@ async function resolveAndMergeNestedStyleguideConfig(
|
|
|
414
414
|
? new URL(presetItem, configPath).href
|
|
415
415
|
: path.resolve(path.dirname(configPath), presetItem);
|
|
416
416
|
const extendedStyleguideConfig = await loadExtendStyleguideConfig(pathItem, resolver);
|
|
417
|
-
return await resolveAndMergeNestedStyleguideConfig(
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
extendPaths
|
|
425
|
-
);
|
|
417
|
+
return await resolveAndMergeNestedStyleguideConfig({
|
|
418
|
+
styleguideConfig: extendedStyleguideConfig,
|
|
419
|
+
configPath: pathItem,
|
|
420
|
+
resolver,
|
|
421
|
+
parentConfigPaths: [...parentConfigPaths, resolvedConfigPath],
|
|
422
|
+
extendPaths,
|
|
423
|
+
});
|
|
426
424
|
}) || []
|
|
427
425
|
);
|
|
428
426
|
|
|
@@ -446,20 +444,14 @@ async function resolveAndMergeNestedStyleguideConfig(
|
|
|
446
444
|
};
|
|
447
445
|
}
|
|
448
446
|
|
|
449
|
-
export async function resolveStyleguideConfig(
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
): Promise<ResolvedStyleguideConfig> {
|
|
458
|
-
const resolvedStyleguideConfig = await resolveAndMergeNestedStyleguideConfig(
|
|
459
|
-
opts,
|
|
460
|
-
parentConfigPaths,
|
|
461
|
-
extendPaths
|
|
462
|
-
);
|
|
447
|
+
export async function resolveStyleguideConfig(opts: {
|
|
448
|
+
styleguideConfig?: StyleguideRawConfig;
|
|
449
|
+
configPath?: string;
|
|
450
|
+
resolver?: BaseResolver;
|
|
451
|
+
parentConfigPaths?: string[];
|
|
452
|
+
extendPaths?: string[];
|
|
453
|
+
}): Promise<ResolvedStyleguideConfig> {
|
|
454
|
+
const resolvedStyleguideConfig = await resolveAndMergeNestedStyleguideConfig(opts);
|
|
463
455
|
|
|
464
456
|
return {
|
|
465
457
|
...resolvedStyleguideConfig,
|
|
@@ -520,7 +512,7 @@ function getMergedRawStyleguideConfig(
|
|
|
520
512
|
oas3_1Rules: { ...rootStyleguideConfig?.oas3_1Rules, ...apiStyleguideConfig?.oas3_1Rules },
|
|
521
513
|
async2Rules: { ...rootStyleguideConfig?.async2Rules, ...apiStyleguideConfig?.async2Rules },
|
|
522
514
|
async3Rules: { ...rootStyleguideConfig?.async3Rules, ...apiStyleguideConfig?.async3Rules },
|
|
523
|
-
|
|
515
|
+
arazzo1Rules: { ...rootStyleguideConfig?.arazzo1Rules, ...apiStyleguideConfig?.arazzo1Rules },
|
|
524
516
|
preprocessors: {
|
|
525
517
|
...rootStyleguideConfig?.preprocessors,
|
|
526
518
|
...apiStyleguideConfig?.preprocessors,
|