@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
|
@@ -2,54 +2,70 @@ import type { PluginStyleguideConfig } from './types';
|
|
|
2
2
|
|
|
3
3
|
const recommended: PluginStyleguideConfig<'built-in'> = {
|
|
4
4
|
rules: {
|
|
5
|
+
struct: 'error',
|
|
6
|
+
},
|
|
7
|
+
oas2Rules: {
|
|
8
|
+
'boolean-parameter-prefixes': 'off',
|
|
5
9
|
'info-contact': 'off',
|
|
6
10
|
'info-license': 'warn',
|
|
7
11
|
'info-license-url': 'off',
|
|
8
12
|
'info-license-strict': 'warn',
|
|
9
|
-
'tag-description': 'warn',
|
|
10
|
-
'tags-alphabetical': 'off',
|
|
11
|
-
'parameter-description': 'off',
|
|
12
13
|
'no-path-trailing-slash': 'error',
|
|
13
14
|
'no-identical-paths': 'error',
|
|
14
15
|
'no-ambiguous-paths': 'warn',
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
16
|
+
'no-invalid-schema-examples': 'off',
|
|
17
|
+
'no-invalid-parameter-examples': 'off',
|
|
18
|
+
'no-http-verbs-in-paths': 'off',
|
|
19
|
+
'no-enum-type-mismatch': 'error',
|
|
20
|
+
'no-unresolved-refs': 'error',
|
|
21
|
+
'no-required-schema-properties-undefined': 'off',
|
|
22
|
+
'operation-summary': 'error',
|
|
18
23
|
'operation-description': 'off',
|
|
19
|
-
'operation-2xx-response': 'warn',
|
|
20
|
-
'operation-4xx-response': 'warn',
|
|
21
24
|
'operation-operationId': 'warn',
|
|
22
|
-
'operation-summary': 'error',
|
|
23
25
|
'operation-operationId-unique': 'error',
|
|
24
26
|
'operation-operationId-url-safe': 'error',
|
|
27
|
+
'operation-2xx-response': 'warn',
|
|
28
|
+
'operation-4xx-response': 'warn',
|
|
25
29
|
'operation-parameters-unique': 'error',
|
|
26
30
|
'operation-tag-defined': 'off',
|
|
27
|
-
'security-defined': 'error',
|
|
28
31
|
'operation-singular-tag': 'off',
|
|
29
|
-
'
|
|
30
|
-
'
|
|
32
|
+
'parameter-description': 'off',
|
|
33
|
+
'path-declaration-must-exist': 'error',
|
|
34
|
+
'path-not-include-query': 'error',
|
|
35
|
+
'path-parameters-defined': 'error',
|
|
31
36
|
'paths-kebab-case': 'off',
|
|
32
|
-
spec: 'error',
|
|
33
|
-
'spec-strict-refs': 'off',
|
|
34
|
-
'no-http-verbs-in-paths': 'off',
|
|
35
|
-
'no-invalid-parameter-examples': 'off',
|
|
36
|
-
'no-invalid-schema-examples': 'off',
|
|
37
37
|
'path-excludes-patterns': 'off',
|
|
38
38
|
'path-http-verbs-order': 'off',
|
|
39
39
|
'path-params-defined': 'off',
|
|
40
40
|
'path-segment-plural': 'off',
|
|
41
41
|
'required-string-property-missing-min-length': 'off',
|
|
42
42
|
'response-contains-header': 'off',
|
|
43
|
-
'scalar-property-missing-example': 'off',
|
|
44
|
-
'no-required-schema-properties-undefined': 'off',
|
|
45
|
-
},
|
|
46
|
-
oas2Rules: {
|
|
47
|
-
'boolean-parameter-prefixes': 'off',
|
|
48
43
|
'request-mime-type': 'off',
|
|
49
44
|
'response-contains-property': 'off',
|
|
50
45
|
'response-mime-type': 'off',
|
|
46
|
+
'security-defined': 'error',
|
|
47
|
+
'spec-strict-refs': 'off',
|
|
48
|
+
'scalar-property-missing-example': 'off',
|
|
49
|
+
'tag-description': 'warn',
|
|
50
|
+
'tags-alphabetical': 'off',
|
|
51
51
|
},
|
|
52
52
|
oas3_0Rules: {
|
|
53
|
+
'array-parameter-serialization': 'off',
|
|
54
|
+
'boolean-parameter-prefixes': 'off',
|
|
55
|
+
'component-name-unique': 'off',
|
|
56
|
+
'info-contact': 'off',
|
|
57
|
+
'info-license': 'warn',
|
|
58
|
+
'info-license-url': 'off',
|
|
59
|
+
'info-license-strict': 'warn',
|
|
60
|
+
'no-path-trailing-slash': 'error',
|
|
61
|
+
'no-identical-paths': 'error',
|
|
62
|
+
'no-ambiguous-paths': 'warn',
|
|
63
|
+
'no-invalid-schema-examples': 'off',
|
|
64
|
+
'no-invalid-parameter-examples': 'off',
|
|
65
|
+
'no-http-verbs-in-paths': 'off',
|
|
66
|
+
'no-enum-type-mismatch': 'error',
|
|
67
|
+
'no-unresolved-refs': 'error',
|
|
68
|
+
'no-required-schema-properties-undefined': 'off',
|
|
53
69
|
'no-invalid-media-type-examples': {
|
|
54
70
|
severity: 'warn',
|
|
55
71
|
allowAdditionalProperties: false,
|
|
@@ -61,16 +77,55 @@ const recommended: PluginStyleguideConfig<'built-in'> = {
|
|
|
61
77
|
'no-unused-components': 'warn',
|
|
62
78
|
'no-undefined-server-variable': 'error',
|
|
63
79
|
'no-server-variables-empty-enum': 'error',
|
|
64
|
-
'
|
|
65
|
-
'
|
|
66
|
-
'
|
|
80
|
+
'operation-summary': 'error',
|
|
81
|
+
'operation-operationId': 'warn',
|
|
82
|
+
'operation-operationId-unique': 'error',
|
|
83
|
+
'operation-operationId-url-safe': 'error',
|
|
84
|
+
'operation-description': 'off',
|
|
85
|
+
'operation-2xx-response': 'warn',
|
|
86
|
+
'operation-4xx-response': 'warn',
|
|
67
87
|
'operation-4xx-problem-details-rfc7807': 'off',
|
|
88
|
+
'operation-parameters-unique': 'error',
|
|
89
|
+
'operation-tag-defined': 'off',
|
|
90
|
+
'operation-singular-tag': 'off',
|
|
91
|
+
'parameter-description': 'off',
|
|
92
|
+
'path-declaration-must-exist': 'error',
|
|
93
|
+
'path-not-include-query': 'error',
|
|
94
|
+
'path-parameters-defined': 'error',
|
|
95
|
+
'paths-kebab-case': 'off',
|
|
96
|
+
'path-excludes-patterns': 'off',
|
|
97
|
+
'path-http-verbs-order': 'off',
|
|
98
|
+
'path-params-defined': 'off',
|
|
99
|
+
'path-segment-plural': 'off',
|
|
100
|
+
'required-string-property-missing-min-length': 'off',
|
|
101
|
+
'response-contains-header': 'off',
|
|
68
102
|
'request-mime-type': 'off',
|
|
69
103
|
'response-contains-property': 'off',
|
|
70
104
|
'response-mime-type': 'off',
|
|
71
|
-
'
|
|
105
|
+
'security-defined': 'error',
|
|
106
|
+
'spec-strict-refs': 'off',
|
|
107
|
+
'scalar-property-missing-example': 'off',
|
|
108
|
+
'spec-components-invalid-map-name': 'error',
|
|
109
|
+
'tag-description': 'warn',
|
|
110
|
+
'tags-alphabetical': 'off',
|
|
72
111
|
},
|
|
73
112
|
oas3_1Rules: {
|
|
113
|
+
'array-parameter-serialization': 'off',
|
|
114
|
+
'boolean-parameter-prefixes': 'off',
|
|
115
|
+
'component-name-unique': 'off',
|
|
116
|
+
'info-contact': 'off',
|
|
117
|
+
'info-license': 'warn',
|
|
118
|
+
'info-license-url': 'off',
|
|
119
|
+
'info-license-strict': 'warn',
|
|
120
|
+
'no-path-trailing-slash': 'error',
|
|
121
|
+
'no-identical-paths': 'error',
|
|
122
|
+
'no-ambiguous-paths': 'warn',
|
|
123
|
+
'no-invalid-schema-examples': 'off',
|
|
124
|
+
'no-invalid-parameter-examples': 'off',
|
|
125
|
+
'no-http-verbs-in-paths': 'off',
|
|
126
|
+
'no-enum-type-mismatch': 'error',
|
|
127
|
+
'no-unresolved-refs': 'error',
|
|
128
|
+
'no-required-schema-properties-undefined': 'off',
|
|
74
129
|
'no-invalid-media-type-examples': 'warn',
|
|
75
130
|
'no-server-example.com': 'warn',
|
|
76
131
|
'no-server-trailing-slash': 'error',
|
|
@@ -79,51 +134,71 @@ const recommended: PluginStyleguideConfig<'built-in'> = {
|
|
|
79
134
|
'no-unused-components': 'warn',
|
|
80
135
|
'no-undefined-server-variable': 'error',
|
|
81
136
|
'no-server-variables-empty-enum': 'error',
|
|
82
|
-
'
|
|
83
|
-
'
|
|
84
|
-
'
|
|
137
|
+
'operation-summary': 'error',
|
|
138
|
+
'operation-operationId': 'warn',
|
|
139
|
+
'operation-operationId-unique': 'error',
|
|
140
|
+
'operation-operationId-url-safe': 'error',
|
|
141
|
+
'operation-description': 'off',
|
|
142
|
+
'operation-2xx-response': 'warn',
|
|
143
|
+
'operation-4xx-response': 'warn',
|
|
85
144
|
'operation-4xx-problem-details-rfc7807': 'off',
|
|
145
|
+
'operation-parameters-unique': 'error',
|
|
146
|
+
'operation-tag-defined': 'off',
|
|
147
|
+
'operation-singular-tag': 'off',
|
|
148
|
+
'parameter-description': 'off',
|
|
149
|
+
'path-declaration-must-exist': 'error',
|
|
150
|
+
'path-not-include-query': 'error',
|
|
151
|
+
'path-parameters-defined': 'error',
|
|
152
|
+
'paths-kebab-case': 'off',
|
|
153
|
+
'path-excludes-patterns': 'off',
|
|
154
|
+
'path-http-verbs-order': 'off',
|
|
155
|
+
'path-params-defined': 'off',
|
|
156
|
+
'path-segment-plural': 'off',
|
|
157
|
+
'required-string-property-missing-min-length': 'off',
|
|
158
|
+
'response-contains-header': 'off',
|
|
86
159
|
'request-mime-type': 'off',
|
|
87
160
|
'response-contains-property': 'off',
|
|
88
161
|
'response-mime-type': 'off',
|
|
89
|
-
'
|
|
162
|
+
'security-defined': 'error',
|
|
163
|
+
'spec-strict-refs': 'off',
|
|
164
|
+
'scalar-property-missing-example': 'off',
|
|
165
|
+
'spec-components-invalid-map-name': 'error',
|
|
166
|
+
'tag-description': 'warn',
|
|
167
|
+
'tags-alphabetical': 'off',
|
|
90
168
|
},
|
|
91
169
|
async2Rules: {
|
|
92
|
-
|
|
170
|
+
'channels-kebab-case': 'off',
|
|
93
171
|
'info-contact': 'off',
|
|
94
172
|
'info-license-strict': 'warn',
|
|
173
|
+
'no-channel-trailing-slash': 'off',
|
|
95
174
|
'operation-operationId': 'warn',
|
|
96
175
|
'tag-description': 'warn',
|
|
97
176
|
'tags-alphabetical': 'off',
|
|
98
|
-
'channels-kebab-case': 'off',
|
|
99
|
-
'no-channel-trailing-slash': 'off',
|
|
100
177
|
},
|
|
101
178
|
async3Rules: {
|
|
102
|
-
|
|
179
|
+
'channels-kebab-case': 'off',
|
|
103
180
|
'info-contact': 'off',
|
|
104
181
|
'info-license-strict': 'warn',
|
|
182
|
+
'no-channel-trailing-slash': 'off',
|
|
105
183
|
'operation-operationId': 'warn',
|
|
106
184
|
'tag-description': 'warn',
|
|
107
185
|
'tags-alphabetical': 'off',
|
|
108
|
-
'channels-kebab-case': 'off',
|
|
109
|
-
'no-channel-trailing-slash': 'off',
|
|
110
186
|
},
|
|
111
|
-
|
|
112
|
-
|
|
187
|
+
arazzo1Rules: {
|
|
188
|
+
'criteria-unique': 'warn',
|
|
189
|
+
'no-criteria-xpath': 'warn',
|
|
113
190
|
'parameters-not-in-body': 'warn',
|
|
191
|
+
'parameters-unique': 'error',
|
|
192
|
+
'requestBody-replacements-unique': 'warn',
|
|
114
193
|
'sourceDescription-type': 'error',
|
|
115
|
-
'
|
|
116
|
-
'
|
|
194
|
+
'step-onSuccess-unique': 'warn',
|
|
195
|
+
'step-onFailure-unique': 'warn',
|
|
117
196
|
'stepId-unique': 'error',
|
|
118
197
|
'sourceDescription-name-unique': 'error',
|
|
198
|
+
'sourceDescriptions-not-empty': 'error',
|
|
199
|
+
'version-enum': 'warn',
|
|
200
|
+
'workflowId-unique': 'error',
|
|
119
201
|
'workflow-dependsOn': 'error',
|
|
120
|
-
'parameters-unique': 'error',
|
|
121
|
-
'step-onSuccess-unique': 'warn',
|
|
122
|
-
'step-onFailure-unique': 'warn',
|
|
123
|
-
'requestBody-replacements-unique': 'warn',
|
|
124
|
-
'no-criteria-xpath': 'warn',
|
|
125
|
-
'no-actions-type-end': 'warn',
|
|
126
|
-
'criteria-unique': 'warn',
|
|
127
202
|
},
|
|
128
203
|
};
|
|
129
204
|
|
package/src/config/rules.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isDefined } from '../utils';
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
|
-
|
|
4
|
+
Arazzo1RuleSet,
|
|
5
5
|
Async2RuleSet,
|
|
6
6
|
Async3RuleSet,
|
|
7
7
|
Oas2RuleSet,
|
|
@@ -18,7 +18,7 @@ type InitializedRule = {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export function initRules(
|
|
21
|
-
rules: (Oas3RuleSet | Oas2RuleSet | Async2RuleSet | Async3RuleSet |
|
|
21
|
+
rules: (Oas3RuleSet | Oas2RuleSet | Async2RuleSet | Async3RuleSet | Arazzo1RuleSet)[],
|
|
22
22
|
config: StyleguideConfig,
|
|
23
23
|
type: 'rules' | 'preprocessors' | 'decorators',
|
|
24
24
|
oasVersion: SpecVersion
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { PluginStyleguideConfig } from './types';
|
|
2
|
+
|
|
3
|
+
const spec: PluginStyleguideConfig<'built-in'> = {
|
|
4
|
+
rules: {
|
|
5
|
+
struct: 'error',
|
|
6
|
+
},
|
|
7
|
+
// TODO: populate with spec-related rules similar to `arazzo1Rules`
|
|
8
|
+
oas2Rules: {},
|
|
9
|
+
oas3_0Rules: {},
|
|
10
|
+
oas3_1Rules: {},
|
|
11
|
+
async2Rules: {},
|
|
12
|
+
async3Rules: {},
|
|
13
|
+
arazzo1Rules: {
|
|
14
|
+
'parameters-not-in-body': 'error',
|
|
15
|
+
'sourceDescription-type': 'error',
|
|
16
|
+
'version-enum': 'error',
|
|
17
|
+
'workflowId-unique': 'error',
|
|
18
|
+
'stepId-unique': 'error',
|
|
19
|
+
'sourceDescription-name-unique': 'error',
|
|
20
|
+
'sourceDescriptions-not-empty': 'error',
|
|
21
|
+
'workflow-dependsOn': 'error',
|
|
22
|
+
'parameters-unique': 'error',
|
|
23
|
+
'step-onSuccess-unique': 'error',
|
|
24
|
+
'step-onFailure-unique': 'error',
|
|
25
|
+
'requestBody-replacements-unique': 'error',
|
|
26
|
+
'no-criteria-xpath': 'error',
|
|
27
|
+
'criteria-unique': 'error',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default spec;
|
package/src/config/types.ts
CHANGED
|
@@ -15,21 +15,13 @@ import type {
|
|
|
15
15
|
Async3PreprocessorsSet,
|
|
16
16
|
Async3DecoratorsSet,
|
|
17
17
|
Async3RuleSet,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
Arazzo1RuleSet,
|
|
19
|
+
Arazzo1PreprocessorsSet,
|
|
20
|
+
Arazzo1DecoratorsSet,
|
|
21
21
|
RuleMap,
|
|
22
22
|
} from '../oas-types';
|
|
23
23
|
import type { NodeType } from '../types';
|
|
24
24
|
import type { SkipFunctionContext } from '../visitors';
|
|
25
|
-
import type {
|
|
26
|
-
BuiltInAsync2RuleId,
|
|
27
|
-
BuiltInAsync3RuleId,
|
|
28
|
-
BuiltInCommonOASRuleId,
|
|
29
|
-
BuiltInOAS2RuleId,
|
|
30
|
-
BuiltInOAS3RuleId,
|
|
31
|
-
BuiltInArazzoRuleId,
|
|
32
|
-
} from '../types/redocly-yaml';
|
|
33
25
|
import type { JSONSchema } from 'json-schema-to-ts';
|
|
34
26
|
|
|
35
27
|
export type RuleSeverity = ProblemSeverity | 'off';
|
|
@@ -58,13 +50,13 @@ export type StyleguideRawConfig<T = undefined> = {
|
|
|
58
50
|
doNotResolveExamples?: boolean;
|
|
59
51
|
recommendedFallback?: boolean;
|
|
60
52
|
|
|
61
|
-
rules?: RuleMap<
|
|
62
|
-
oas2Rules?: RuleMap<
|
|
63
|
-
oas3_0Rules?: RuleMap<
|
|
64
|
-
oas3_1Rules?: RuleMap<
|
|
65
|
-
async2Rules?: RuleMap<
|
|
66
|
-
async3Rules?: RuleMap<
|
|
67
|
-
|
|
53
|
+
rules?: RuleMap<string, RuleConfig, T>;
|
|
54
|
+
oas2Rules?: RuleMap<string, RuleConfig, T>;
|
|
55
|
+
oas3_0Rules?: RuleMap<string, RuleConfig, T>;
|
|
56
|
+
oas3_1Rules?: RuleMap<string, RuleConfig, T>;
|
|
57
|
+
async2Rules?: RuleMap<string, RuleConfig, T>;
|
|
58
|
+
async3Rules?: RuleMap<string, RuleConfig, T>;
|
|
59
|
+
arazzo1Rules?: RuleMap<string, RuleConfig, T>;
|
|
68
60
|
|
|
69
61
|
preprocessors?: Record<string, PreprocessorConfig>;
|
|
70
62
|
oas2Preprocessors?: Record<string, PreprocessorConfig>;
|
|
@@ -72,7 +64,7 @@ export type StyleguideRawConfig<T = undefined> = {
|
|
|
72
64
|
oas3_1Preprocessors?: Record<string, PreprocessorConfig>;
|
|
73
65
|
async2Preprocessors?: Record<string, PreprocessorConfig>;
|
|
74
66
|
async3Preprocessors?: Record<string, PreprocessorConfig>;
|
|
75
|
-
|
|
67
|
+
arazzo1Preprocessors?: Record<string, PreprocessorConfig>;
|
|
76
68
|
|
|
77
69
|
decorators?: Record<string, DecoratorConfig>;
|
|
78
70
|
oas2Decorators?: Record<string, DecoratorConfig>;
|
|
@@ -80,7 +72,7 @@ export type StyleguideRawConfig<T = undefined> = {
|
|
|
80
72
|
oas3_1Decorators?: Record<string, DecoratorConfig>;
|
|
81
73
|
async2Decorators?: Record<string, DecoratorConfig>;
|
|
82
74
|
async3Decorators?: Record<string, DecoratorConfig>;
|
|
83
|
-
|
|
75
|
+
arazzo1Decorators?: Record<string, DecoratorConfig>;
|
|
84
76
|
};
|
|
85
77
|
|
|
86
78
|
export type ApiStyleguideRawConfig = Omit<StyleguideRawConfig, 'plugins'>;
|
|
@@ -98,7 +90,7 @@ export type PreprocessorsConfig = {
|
|
|
98
90
|
oas2?: Oas2PreprocessorsSet;
|
|
99
91
|
async2?: Async2PreprocessorsSet;
|
|
100
92
|
async3?: Async3PreprocessorsSet;
|
|
101
|
-
|
|
93
|
+
arazzo1?: Arazzo1PreprocessorsSet;
|
|
102
94
|
};
|
|
103
95
|
|
|
104
96
|
export type DecoratorsConfig = {
|
|
@@ -106,7 +98,7 @@ export type DecoratorsConfig = {
|
|
|
106
98
|
oas2?: Oas2DecoratorsSet;
|
|
107
99
|
async2?: Async2DecoratorsSet;
|
|
108
100
|
async3?: Async3DecoratorsSet;
|
|
109
|
-
|
|
101
|
+
arazzo1?: Arazzo1DecoratorsSet;
|
|
110
102
|
};
|
|
111
103
|
|
|
112
104
|
export type TypesExtensionFn = (
|
|
@@ -116,14 +108,16 @@ export type TypesExtensionFn = (
|
|
|
116
108
|
|
|
117
109
|
export type TypeExtensionsConfig = Partial<Record<SpecMajorVersion, TypesExtensionFn>>;
|
|
118
110
|
|
|
119
|
-
export type
|
|
120
|
-
oas3?: Oas3RuleSet
|
|
121
|
-
oas2?: Oas2RuleSet
|
|
122
|
-
async2?: Async2RuleSet
|
|
123
|
-
async3?: Async3RuleSet
|
|
124
|
-
|
|
111
|
+
export type RulesConfig<T> = {
|
|
112
|
+
oas3?: Oas3RuleSet<T>;
|
|
113
|
+
oas2?: Oas2RuleSet<T>;
|
|
114
|
+
async2?: Async2RuleSet<T>;
|
|
115
|
+
async3?: Async3RuleSet<T>;
|
|
116
|
+
arazzo1?: Arazzo1RuleSet<T>;
|
|
125
117
|
};
|
|
126
118
|
|
|
119
|
+
export type CustomRulesConfig = RulesConfig<undefined>;
|
|
120
|
+
|
|
127
121
|
export type AssertionContext = Partial<UserContext> & SkipFunctionContext & { node: any };
|
|
128
122
|
|
|
129
123
|
export type AssertResult = { message?: string; location?: Location };
|
|
@@ -135,11 +129,11 @@ export type CustomFunction = (
|
|
|
135
129
|
|
|
136
130
|
export type AssertionsConfig = Record<string, CustomFunction>;
|
|
137
131
|
|
|
138
|
-
export type Plugin = {
|
|
132
|
+
export type Plugin<T = undefined> = {
|
|
139
133
|
id: string;
|
|
140
134
|
|
|
141
135
|
configs?: Record<string, PluginStyleguideConfig>;
|
|
142
|
-
rules?:
|
|
136
|
+
rules?: RulesConfig<T>;
|
|
143
137
|
preprocessors?: PreprocessorsConfig;
|
|
144
138
|
decorators?: DecoratorsConfig;
|
|
145
139
|
typeExtension?: TypeExtensionsConfig;
|
|
@@ -287,18 +281,18 @@ export type RulesFields =
|
|
|
287
281
|
| 'oas3_1Rules'
|
|
288
282
|
| 'async2Rules'
|
|
289
283
|
| 'async3Rules'
|
|
290
|
-
| '
|
|
284
|
+
| 'arazzo1Rules'
|
|
291
285
|
| 'preprocessors'
|
|
292
286
|
| 'oas2Preprocessors'
|
|
293
287
|
| 'oas3_0Preprocessors'
|
|
294
288
|
| 'oas3_1Preprocessors'
|
|
295
289
|
| 'async2Preprocessors'
|
|
296
290
|
| 'async3Preprocessors'
|
|
297
|
-
| '
|
|
291
|
+
| 'arazzo1Preprocessors'
|
|
298
292
|
| 'decorators'
|
|
299
293
|
| 'oas2Decorators'
|
|
300
294
|
| 'oas3_0Decorators'
|
|
301
295
|
| 'oas3_1Decorators'
|
|
302
296
|
| 'async2Decorators'
|
|
303
297
|
| 'async3Decorators'
|
|
304
|
-
| '
|
|
298
|
+
| 'arazzo1Decorators';
|
package/src/config/utils.ts
CHANGED
|
@@ -61,7 +61,7 @@ function extractFlatConfig<
|
|
|
61
61
|
oas3_1Rules,
|
|
62
62
|
async2Rules,
|
|
63
63
|
async3Rules,
|
|
64
|
-
|
|
64
|
+
arazzo1Rules,
|
|
65
65
|
|
|
66
66
|
preprocessors,
|
|
67
67
|
oas2Preprocessors,
|
|
@@ -69,7 +69,7 @@ function extractFlatConfig<
|
|
|
69
69
|
oas3_1Preprocessors,
|
|
70
70
|
async2Preprocessors,
|
|
71
71
|
async3Preprocessors,
|
|
72
|
-
|
|
72
|
+
arazzo1Preprocessors,
|
|
73
73
|
|
|
74
74
|
decorators,
|
|
75
75
|
oas2Decorators,
|
|
@@ -77,7 +77,7 @@ function extractFlatConfig<
|
|
|
77
77
|
oas3_1Decorators,
|
|
78
78
|
async2Decorators,
|
|
79
79
|
async3Decorators,
|
|
80
|
-
|
|
80
|
+
arazzo1Decorators,
|
|
81
81
|
|
|
82
82
|
...rawConfigRest
|
|
83
83
|
}: T): {
|
|
@@ -94,7 +94,7 @@ function extractFlatConfig<
|
|
|
94
94
|
oas3_1Rules,
|
|
95
95
|
async2Rules,
|
|
96
96
|
async3Rules,
|
|
97
|
-
|
|
97
|
+
arazzo1Rules,
|
|
98
98
|
|
|
99
99
|
preprocessors,
|
|
100
100
|
oas2Preprocessors,
|
|
@@ -102,7 +102,7 @@ function extractFlatConfig<
|
|
|
102
102
|
oas3_1Preprocessors,
|
|
103
103
|
async2Preprocessors,
|
|
104
104
|
async3Preprocessors,
|
|
105
|
-
|
|
105
|
+
arazzo1Preprocessors,
|
|
106
106
|
|
|
107
107
|
decorators,
|
|
108
108
|
oas2Decorators,
|
|
@@ -110,7 +110,7 @@ function extractFlatConfig<
|
|
|
110
110
|
oas3_1Decorators,
|
|
111
111
|
async2Decorators,
|
|
112
112
|
async3Decorators,
|
|
113
|
-
|
|
113
|
+
arazzo1Decorators,
|
|
114
114
|
|
|
115
115
|
doNotResolveExamples: rawConfigRest.resolve?.doNotResolveExamples,
|
|
116
116
|
};
|
|
@@ -169,7 +169,7 @@ export function mergeExtends(rulesConfList: ResolvedStyleguideConfig[]) {
|
|
|
169
169
|
oas3_1Rules: {},
|
|
170
170
|
async2Rules: {},
|
|
171
171
|
async3Rules: {},
|
|
172
|
-
|
|
172
|
+
arazzo1Rules: {},
|
|
173
173
|
|
|
174
174
|
preprocessors: {},
|
|
175
175
|
oas2Preprocessors: {},
|
|
@@ -177,7 +177,7 @@ export function mergeExtends(rulesConfList: ResolvedStyleguideConfig[]) {
|
|
|
177
177
|
oas3_1Preprocessors: {},
|
|
178
178
|
async2Preprocessors: {},
|
|
179
179
|
async3Preprocessors: {},
|
|
180
|
-
|
|
180
|
+
arazzo1Preprocessors: {},
|
|
181
181
|
|
|
182
182
|
decorators: {},
|
|
183
183
|
oas2Decorators: {},
|
|
@@ -185,7 +185,7 @@ export function mergeExtends(rulesConfList: ResolvedStyleguideConfig[]) {
|
|
|
185
185
|
oas3_1Decorators: {},
|
|
186
186
|
async2Decorators: {},
|
|
187
187
|
async3Decorators: {},
|
|
188
|
-
|
|
188
|
+
arazzo1Decorators: {},
|
|
189
189
|
|
|
190
190
|
plugins: [],
|
|
191
191
|
pluginPaths: [],
|
|
@@ -210,8 +210,8 @@ export function mergeExtends(rulesConfList: ResolvedStyleguideConfig[]) {
|
|
|
210
210
|
assignOnlyExistingConfig(result.async2Rules, rulesConf.rules);
|
|
211
211
|
assignConfig(result.async3Rules, rulesConf.async3Rules);
|
|
212
212
|
assignOnlyExistingConfig(result.async3Rules, rulesConf.rules);
|
|
213
|
-
assignConfig(result.
|
|
214
|
-
assignOnlyExistingConfig(result.
|
|
213
|
+
assignConfig(result.arazzo1Rules, rulesConf.arazzo1Rules);
|
|
214
|
+
assignOnlyExistingConfig(result.arazzo1Rules, rulesConf.rules);
|
|
215
215
|
|
|
216
216
|
assignConfig(result.preprocessors, rulesConf.preprocessors);
|
|
217
217
|
assignConfig(result.oas2Preprocessors, rulesConf.oas2Preprocessors);
|
|
@@ -224,8 +224,8 @@ export function mergeExtends(rulesConfList: ResolvedStyleguideConfig[]) {
|
|
|
224
224
|
assignOnlyExistingConfig(result.async2Preprocessors, rulesConf.preprocessors);
|
|
225
225
|
assignConfig(result.async3Preprocessors, rulesConf.async3Preprocessors);
|
|
226
226
|
assignOnlyExistingConfig(result.async3Preprocessors, rulesConf.preprocessors);
|
|
227
|
-
assignConfig(result.
|
|
228
|
-
assignOnlyExistingConfig(result.
|
|
227
|
+
assignConfig(result.arazzo1Preprocessors, rulesConf.arazzo1Preprocessors);
|
|
228
|
+
assignOnlyExistingConfig(result.arazzo1Preprocessors, rulesConf.preprocessors);
|
|
229
229
|
|
|
230
230
|
assignConfig(result.decorators, rulesConf.decorators);
|
|
231
231
|
assignConfig(result.oas2Decorators, rulesConf.oas2Decorators);
|
|
@@ -238,8 +238,8 @@ export function mergeExtends(rulesConfList: ResolvedStyleguideConfig[]) {
|
|
|
238
238
|
assignOnlyExistingConfig(result.async2Decorators, rulesConf.decorators);
|
|
239
239
|
assignConfig(result.async3Decorators, rulesConf.async3Decorators);
|
|
240
240
|
assignOnlyExistingConfig(result.async3Decorators, rulesConf.decorators);
|
|
241
|
-
assignConfig(result.
|
|
242
|
-
assignOnlyExistingConfig(result.
|
|
241
|
+
assignConfig(result.arazzo1Decorators, rulesConf.arazzo1Decorators);
|
|
242
|
+
assignOnlyExistingConfig(result.arazzo1Decorators, rulesConf.decorators);
|
|
243
243
|
|
|
244
244
|
result.plugins!.push(...(rulesConf.plugins || []));
|
|
245
245
|
result.pluginPaths!.push(...(rulesConf.pluginPaths || []));
|
|
@@ -291,7 +291,8 @@ export function checkForDeprecatedFields(
|
|
|
291
291
|
deprecatedField: keyof (DeprecatedInRawConfig & RawConfig),
|
|
292
292
|
updatedField: keyof FlatRawConfig | undefined,
|
|
293
293
|
rawConfig: DeprecatedInRawConfig & RawConfig & FlatRawConfig,
|
|
294
|
-
updatedObject: keyof FlatRawConfig | undefined
|
|
294
|
+
updatedObject: keyof FlatRawConfig | undefined,
|
|
295
|
+
link?: string | undefined
|
|
295
296
|
): void {
|
|
296
297
|
const isDeprecatedFieldInApis =
|
|
297
298
|
rawConfig.apis &&
|
|
@@ -301,7 +302,7 @@ export function checkForDeprecatedFields(
|
|
|
301
302
|
);
|
|
302
303
|
|
|
303
304
|
if (rawConfig[deprecatedField] && updatedField === null) {
|
|
304
|
-
showWarningForDeprecatedField(deprecatedField);
|
|
305
|
+
showWarningForDeprecatedField(deprecatedField, undefined, updatedObject, link);
|
|
305
306
|
}
|
|
306
307
|
|
|
307
308
|
if (rawConfig[deprecatedField] && updatedField && rawConfig[updatedField]) {
|
|
@@ -313,7 +314,7 @@ export function checkForDeprecatedFields(
|
|
|
313
314
|
}
|
|
314
315
|
|
|
315
316
|
if (rawConfig[deprecatedField] || isDeprecatedFieldInApis) {
|
|
316
|
-
showWarningForDeprecatedField(deprecatedField, updatedField, updatedObject);
|
|
317
|
+
showWarningForDeprecatedField(deprecatedField, updatedField, updatedObject, link);
|
|
317
318
|
}
|
|
318
319
|
}
|
|
319
320
|
|
|
@@ -323,17 +324,28 @@ export function transformConfig(
|
|
|
323
324
|
const migratedFields: [
|
|
324
325
|
keyof (DeprecatedInRawConfig & RawConfig),
|
|
325
326
|
keyof FlatRawConfig | undefined,
|
|
326
|
-
keyof ThemeConfig | undefined
|
|
327
|
+
keyof ThemeConfig | undefined,
|
|
328
|
+
string | undefined
|
|
327
329
|
][] = [
|
|
328
|
-
['apiDefinitions', 'apis', undefined],
|
|
329
|
-
['referenceDocs', 'openapi', 'theme'],
|
|
330
|
-
[
|
|
331
|
-
|
|
332
|
-
|
|
330
|
+
['apiDefinitions', 'apis', undefined, undefined],
|
|
331
|
+
['referenceDocs', 'openapi', 'theme', undefined],
|
|
332
|
+
[
|
|
333
|
+
'lint',
|
|
334
|
+
undefined,
|
|
335
|
+
undefined,
|
|
336
|
+
'https://redocly.com/docs/api-registry/guides/migration-guide-config-file/#changed-properties',
|
|
337
|
+
],
|
|
338
|
+
[
|
|
339
|
+
'styleguide',
|
|
340
|
+
undefined,
|
|
341
|
+
undefined,
|
|
342
|
+
'https://redocly.com/docs/api-registry/guides/migration-guide-config-file/#changed-properties',
|
|
343
|
+
],
|
|
344
|
+
['features.openapi', 'openapi', 'theme', undefined],
|
|
333
345
|
];
|
|
334
346
|
|
|
335
|
-
for (const [deprecatedField, updatedField, updatedObject] of migratedFields) {
|
|
336
|
-
checkForDeprecatedFields(deprecatedField, updatedField, rawConfig, updatedObject);
|
|
347
|
+
for (const [deprecatedField, updatedField, updatedObject, link] of migratedFields) {
|
|
348
|
+
checkForDeprecatedFields(deprecatedField, updatedField, rawConfig, updatedObject, link);
|
|
337
349
|
}
|
|
338
350
|
|
|
339
351
|
const { apis, apiDefinitions, referenceDocs, lint, ...rest } = rawConfig;
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ export {
|
|
|
8
8
|
pause,
|
|
9
9
|
} from './utils';
|
|
10
10
|
export { Oas3_1Types } from './types/oas3_1';
|
|
11
|
-
export {
|
|
11
|
+
export { Arazzo1Types } from './types/arazzo';
|
|
12
12
|
export { Oas3Types } from './types/oas3';
|
|
13
13
|
export { Oas2Types } from './types/oas2';
|
|
14
14
|
export { AsyncApi2Types } from './types/asyncapi2';
|
package/src/lint.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { normalizeTypes } from './types';
|
|
|
7
7
|
import { releaseAjvInstance } from './rules/ajv';
|
|
8
8
|
import { SpecVersion, getMajorSpecVersion, detectSpec, getTypes } from './oas-types';
|
|
9
9
|
import { createConfigTypes } from './types/redocly-yaml';
|
|
10
|
-
import {
|
|
10
|
+
import { Struct } from './rules/common/struct';
|
|
11
11
|
import { NoUnresolvedRefs } from './rules/no-unresolved-refs';
|
|
12
12
|
|
|
13
13
|
import type { StyleguideConfig, Config } from './config';
|
|
@@ -15,7 +15,7 @@ import type { Document, ResolvedRefMap } from './resolve';
|
|
|
15
15
|
import type { ProblemSeverity, WalkContext } from './walk';
|
|
16
16
|
import type { NodeType } from './types';
|
|
17
17
|
import type {
|
|
18
|
-
|
|
18
|
+
Arazzo1Visitor,
|
|
19
19
|
Async2Visitor,
|
|
20
20
|
Async3Visitor,
|
|
21
21
|
NestedVisitObject,
|
|
@@ -71,7 +71,7 @@ export async function lintDocument(opts: {
|
|
|
71
71
|
const { document, customTypes, externalRefResolver, config } = opts;
|
|
72
72
|
const specVersion = detectSpec(document.parsed);
|
|
73
73
|
const specMajorVersion = getMajorSpecVersion(specVersion);
|
|
74
|
-
const rules = config.
|
|
74
|
+
const rules = config.getRulesForSpecVersion(specMajorVersion);
|
|
75
75
|
const types = normalizeTypes(
|
|
76
76
|
config.extendTypes(customTypes ?? getTypes(specVersion), specVersion),
|
|
77
77
|
config
|
|
@@ -152,14 +152,14 @@ export async function lintConfig(opts: {
|
|
|
152
152
|
| Async2Visitor[]
|
|
153
153
|
| Async3Visitor
|
|
154
154
|
| Async3Visitor[]
|
|
155
|
-
|
|
|
156
|
-
|
|
|
155
|
+
| Arazzo1Visitor
|
|
156
|
+
| Arazzo1Visitor[]
|
|
157
157
|
>;
|
|
158
158
|
})[] = [
|
|
159
159
|
{
|
|
160
160
|
severity: severity || 'error',
|
|
161
161
|
ruleId: 'configuration spec',
|
|
162
|
-
visitor:
|
|
162
|
+
visitor: Struct({ severity: 'error' }),
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
severity: severity || 'error',
|