@redocly/openapi-core 1.25.15 → 1.26.0
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 +11 -0
- package/__tests__/utils.ts +0 -3
- package/lib/bundle.js +3 -3
- package/lib/config/all.js +130 -48
- package/lib/config/builtIn.d.ts +1 -1
- package/lib/config/builtIn.js +5 -3
- package/lib/config/config-resolvers.js +9 -9
- package/lib/config/config.d.ts +2 -2
- package/lib/config/config.js +38 -20
- package/lib/config/minimal.js +125 -49
- package/lib/config/recommended-strict.js +124 -48
- package/lib/config/recommended.js +123 -47
- package/lib/config/rules.d.ts +2 -2
- package/lib/config/spec.d.ts +3 -0
- package/lib/config/spec.js +31 -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 -4
- 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-actions-type-end.d.ts +2 -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 -12
- 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 -1
- 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 -70
- 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 +130 -48
- package/src/config/builtIn.ts +10 -8
- package/src/config/config-resolvers.ts +9 -9
- package/src/config/config.ts +46 -22
- package/src/config/minimal.ts +125 -49
- package/src/config/recommended-strict.ts +124 -48
- package/src/config/recommended.ts +123 -47
- package/src/config/rules.ts +2 -2
- package/src/config/spec.ts +32 -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-actions-type-end.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 +23 -21
- 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-actions-type-end.ts +2 -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 -16
- 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
|
@@ -2,54 +2,70 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const recommended = {
|
|
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 = {
|
|
|
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,72 @@ const recommended = {
|
|
|
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',
|
|
190
|
+
'no-actions-type-end': 'warn',
|
|
113
191
|
'parameters-not-in-body': 'warn',
|
|
192
|
+
'parameters-unique': 'error',
|
|
193
|
+
'requestBody-replacements-unique': 'warn',
|
|
114
194
|
'sourceDescription-type': 'error',
|
|
115
|
-
'
|
|
116
|
-
'
|
|
195
|
+
'step-onSuccess-unique': 'warn',
|
|
196
|
+
'step-onFailure-unique': 'warn',
|
|
117
197
|
'stepId-unique': 'error',
|
|
118
198
|
'sourceDescription-name-unique': 'error',
|
|
199
|
+
'sourceDescriptions-not-empty': 'error',
|
|
200
|
+
'version-enum': 'warn',
|
|
201
|
+
'workflowId-unique': 'error',
|
|
119
202
|
'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
203
|
},
|
|
128
204
|
};
|
|
129
205
|
exports.default = recommended;
|
package/lib/config/rules.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Arazzo1RuleSet, Async2RuleSet, Async3RuleSet, Oas2RuleSet, Oas3RuleSet, SpecVersion } from '../oas-types';
|
|
2
2
|
import type { StyleguideConfig } from './config';
|
|
3
3
|
import type { ProblemSeverity } from '../walk';
|
|
4
4
|
type InitializedRule = {
|
|
@@ -6,5 +6,5 @@ type InitializedRule = {
|
|
|
6
6
|
ruleId: string;
|
|
7
7
|
visitor: any;
|
|
8
8
|
};
|
|
9
|
-
export declare function initRules(rules: (Oas3RuleSet | Oas2RuleSet | Async2RuleSet | Async3RuleSet |
|
|
9
|
+
export declare function initRules(rules: (Oas3RuleSet | Oas2RuleSet | Async2RuleSet | Async3RuleSet | Arazzo1RuleSet)[], config: StyleguideConfig, type: 'rules' | 'preprocessors' | 'decorators', oasVersion: SpecVersion): InitializedRule[];
|
|
10
10
|
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const spec = {
|
|
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
|
+
'no-actions-type-end': 'error',
|
|
28
|
+
'criteria-unique': 'error',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
exports.default = spec;
|
package/lib/config/types.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Location } from '../ref-utils';
|
|
2
2
|
import type { ProblemSeverity, UserContext } from '../walk';
|
|
3
|
-
import type { Oas3PreprocessorsSet, SpecMajorVersion, Oas3DecoratorsSet, Oas2RuleSet, Oas2PreprocessorsSet, Oas2DecoratorsSet, Oas3RuleSet, SpecVersion, Async2PreprocessorsSet, Async2DecoratorsSet, Async2RuleSet, Async3PreprocessorsSet, Async3DecoratorsSet, Async3RuleSet,
|
|
3
|
+
import type { Oas3PreprocessorsSet, SpecMajorVersion, Oas3DecoratorsSet, Oas2RuleSet, Oas2PreprocessorsSet, Oas2DecoratorsSet, Oas3RuleSet, SpecVersion, Async2PreprocessorsSet, Async2DecoratorsSet, Async2RuleSet, Async3PreprocessorsSet, Async3DecoratorsSet, Async3RuleSet, Arazzo1RuleSet, Arazzo1PreprocessorsSet, Arazzo1DecoratorsSet, RuleMap } from '../oas-types';
|
|
4
4
|
import type { NodeType } from '../types';
|
|
5
5
|
import type { SkipFunctionContext } from '../visitors';
|
|
6
|
-
import type { BuiltInAsync2RuleId, BuiltInAsync3RuleId, BuiltInCommonOASRuleId, BuiltInOAS2RuleId, BuiltInOAS3RuleId, BuiltInArazzoRuleId } from '../types/redocly-yaml';
|
|
7
6
|
import type { JSONSchema } from 'json-schema-to-ts';
|
|
8
7
|
export type RuleSeverity = ProblemSeverity | 'off';
|
|
9
8
|
export type RuleSettings = {
|
|
@@ -22,27 +21,27 @@ export type StyleguideRawConfig<T = undefined> = {
|
|
|
22
21
|
extends?: string[];
|
|
23
22
|
doNotResolveExamples?: boolean;
|
|
24
23
|
recommendedFallback?: boolean;
|
|
25
|
-
rules?: RuleMap<
|
|
26
|
-
oas2Rules?: RuleMap<
|
|
27
|
-
oas3_0Rules?: RuleMap<
|
|
28
|
-
oas3_1Rules?: RuleMap<
|
|
29
|
-
async2Rules?: RuleMap<
|
|
30
|
-
async3Rules?: RuleMap<
|
|
31
|
-
|
|
24
|
+
rules?: RuleMap<string, RuleConfig, T>;
|
|
25
|
+
oas2Rules?: RuleMap<string, RuleConfig, T>;
|
|
26
|
+
oas3_0Rules?: RuleMap<string, RuleConfig, T>;
|
|
27
|
+
oas3_1Rules?: RuleMap<string, RuleConfig, T>;
|
|
28
|
+
async2Rules?: RuleMap<string, RuleConfig, T>;
|
|
29
|
+
async3Rules?: RuleMap<string, RuleConfig, T>;
|
|
30
|
+
arazzo1Rules?: RuleMap<string, RuleConfig, T>;
|
|
32
31
|
preprocessors?: Record<string, PreprocessorConfig>;
|
|
33
32
|
oas2Preprocessors?: Record<string, PreprocessorConfig>;
|
|
34
33
|
oas3_0Preprocessors?: Record<string, PreprocessorConfig>;
|
|
35
34
|
oas3_1Preprocessors?: Record<string, PreprocessorConfig>;
|
|
36
35
|
async2Preprocessors?: Record<string, PreprocessorConfig>;
|
|
37
36
|
async3Preprocessors?: Record<string, PreprocessorConfig>;
|
|
38
|
-
|
|
37
|
+
arazzo1Preprocessors?: Record<string, PreprocessorConfig>;
|
|
39
38
|
decorators?: Record<string, DecoratorConfig>;
|
|
40
39
|
oas2Decorators?: Record<string, DecoratorConfig>;
|
|
41
40
|
oas3_0Decorators?: Record<string, DecoratorConfig>;
|
|
42
41
|
oas3_1Decorators?: Record<string, DecoratorConfig>;
|
|
43
42
|
async2Decorators?: Record<string, DecoratorConfig>;
|
|
44
43
|
async3Decorators?: Record<string, DecoratorConfig>;
|
|
45
|
-
|
|
44
|
+
arazzo1Decorators?: Record<string, DecoratorConfig>;
|
|
46
45
|
};
|
|
47
46
|
export type ApiStyleguideRawConfig = Omit<StyleguideRawConfig, 'plugins'>;
|
|
48
47
|
export type ResolvedStyleguideConfig = PluginStyleguideConfig & {
|
|
@@ -57,24 +56,25 @@ export type PreprocessorsConfig = {
|
|
|
57
56
|
oas2?: Oas2PreprocessorsSet;
|
|
58
57
|
async2?: Async2PreprocessorsSet;
|
|
59
58
|
async3?: Async3PreprocessorsSet;
|
|
60
|
-
|
|
59
|
+
arazzo1?: Arazzo1PreprocessorsSet;
|
|
61
60
|
};
|
|
62
61
|
export type DecoratorsConfig = {
|
|
63
62
|
oas3?: Oas3DecoratorsSet;
|
|
64
63
|
oas2?: Oas2DecoratorsSet;
|
|
65
64
|
async2?: Async2DecoratorsSet;
|
|
66
65
|
async3?: Async3DecoratorsSet;
|
|
67
|
-
|
|
66
|
+
arazzo1?: Arazzo1DecoratorsSet;
|
|
68
67
|
};
|
|
69
68
|
export type TypesExtensionFn = (types: Record<string, NodeType>, oasVersion: SpecVersion) => Record<string, NodeType>;
|
|
70
69
|
export type TypeExtensionsConfig = Partial<Record<SpecMajorVersion, TypesExtensionFn>>;
|
|
71
|
-
export type
|
|
72
|
-
oas3?: Oas3RuleSet
|
|
73
|
-
oas2?: Oas2RuleSet
|
|
74
|
-
async2?: Async2RuleSet
|
|
75
|
-
async3?: Async3RuleSet
|
|
76
|
-
|
|
77
|
-
};
|
|
70
|
+
export type RulesConfig<T> = {
|
|
71
|
+
oas3?: Oas3RuleSet<T>;
|
|
72
|
+
oas2?: Oas2RuleSet<T>;
|
|
73
|
+
async2?: Async2RuleSet<T>;
|
|
74
|
+
async3?: Async3RuleSet<T>;
|
|
75
|
+
arazzo1?: Arazzo1RuleSet<T>;
|
|
76
|
+
};
|
|
77
|
+
export type CustomRulesConfig = RulesConfig<undefined>;
|
|
78
78
|
export type AssertionContext = Partial<UserContext> & SkipFunctionContext & {
|
|
79
79
|
node: any;
|
|
80
80
|
};
|
|
@@ -84,10 +84,10 @@ export type AssertResult = {
|
|
|
84
84
|
};
|
|
85
85
|
export type CustomFunction = (value: any, options: unknown, baseLocation: Location) => AssertResult[];
|
|
86
86
|
export type AssertionsConfig = Record<string, CustomFunction>;
|
|
87
|
-
export type Plugin = {
|
|
87
|
+
export type Plugin<T = undefined> = {
|
|
88
88
|
id: string;
|
|
89
89
|
configs?: Record<string, PluginStyleguideConfig>;
|
|
90
|
-
rules?:
|
|
90
|
+
rules?: RulesConfig<T>;
|
|
91
91
|
preprocessors?: PreprocessorsConfig;
|
|
92
92
|
decorators?: DecoratorsConfig;
|
|
93
93
|
typeExtension?: TypeExtensionsConfig;
|
|
@@ -186,5 +186,5 @@ export type ThemeRawConfig = {
|
|
|
186
186
|
openapi?: Record<string, any>;
|
|
187
187
|
mockServer?: Record<string, any>;
|
|
188
188
|
};
|
|
189
|
-
export type RulesFields = 'rules' | 'oas2Rules' | 'oas3_0Rules' | 'oas3_1Rules' | 'async2Rules' | 'async3Rules' | '
|
|
189
|
+
export type RulesFields = 'rules' | 'oas2Rules' | 'oas3_0Rules' | 'oas3_1Rules' | 'async2Rules' | 'async3Rules' | 'arazzo1Rules' | 'preprocessors' | 'oas2Preprocessors' | 'oas3_0Preprocessors' | 'oas3_1Preprocessors' | 'async2Preprocessors' | 'async3Preprocessors' | 'arazzo1Preprocessors' | 'decorators' | 'oas2Decorators' | 'oas3_0Decorators' | 'oas3_1Decorators' | 'async2Decorators' | 'async3Decorators' | 'arazzo1Decorators';
|
|
190
190
|
export {};
|
package/lib/config/utils.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare function transformApiDefinitionsToApis(apiDefinitions?: Deprecate
|
|
|
8
8
|
export declare function prefixRules<T extends Record<string, any>>(rules: T, prefix: string): any;
|
|
9
9
|
export declare function mergeExtends(rulesConfList: ResolvedStyleguideConfig[]): Omit<ResolvedStyleguideConfig, RulesFields> & Required<Pick<ResolvedStyleguideConfig, RulesFields>>;
|
|
10
10
|
export declare function getMergedConfig(config: Config, apiName?: string): Config;
|
|
11
|
-
export declare function checkForDeprecatedFields(deprecatedField: keyof (DeprecatedInRawConfig & RawConfig), updatedField: keyof FlatRawConfig | undefined, rawConfig: DeprecatedInRawConfig & RawConfig & FlatRawConfig, updatedObject: keyof FlatRawConfig | undefined): void;
|
|
11
|
+
export declare function checkForDeprecatedFields(deprecatedField: keyof (DeprecatedInRawConfig & RawConfig), updatedField: keyof FlatRawConfig | undefined, rawConfig: DeprecatedInRawConfig & RawConfig & FlatRawConfig, updatedObject: keyof FlatRawConfig | undefined, link?: string | undefined): void;
|
|
12
12
|
export declare function transformConfig(rawConfig: DeprecatedInRawConfig & RawConfig & FlatRawConfig): RawConfig;
|
|
13
13
|
export declare function getResolveConfig(resolve?: RawResolveConfig): ResolveConfig;
|
|
14
14
|
export declare function getUniquePlugins(plugins: Plugin[]): Plugin[];
|
package/lib/config/utils.js
CHANGED
|
@@ -34,7 +34,7 @@ function transformApiDefinitionsToApis(apiDefinitions) {
|
|
|
34
34
|
}
|
|
35
35
|
return apis;
|
|
36
36
|
}
|
|
37
|
-
function extractFlatConfig({ plugins, extends: _extends, rules, oas2Rules, oas3_0Rules, oas3_1Rules, async2Rules, async3Rules,
|
|
37
|
+
function extractFlatConfig({ plugins, extends: _extends, rules, oas2Rules, oas3_0Rules, oas3_1Rules, async2Rules, async3Rules, arazzo1Rules, preprocessors, oas2Preprocessors, oas3_0Preprocessors, oas3_1Preprocessors, async2Preprocessors, async3Preprocessors, arazzo1Preprocessors, decorators, oas2Decorators, oas3_0Decorators, oas3_1Decorators, async2Decorators, async3Decorators, arazzo1Decorators, ...rawConfigRest }) {
|
|
38
38
|
const styleguideConfig = {
|
|
39
39
|
plugins,
|
|
40
40
|
extends: _extends,
|
|
@@ -44,21 +44,21 @@ function extractFlatConfig({ plugins, extends: _extends, rules, oas2Rules, oas3_
|
|
|
44
44
|
oas3_1Rules,
|
|
45
45
|
async2Rules,
|
|
46
46
|
async3Rules,
|
|
47
|
-
|
|
47
|
+
arazzo1Rules,
|
|
48
48
|
preprocessors,
|
|
49
49
|
oas2Preprocessors,
|
|
50
50
|
oas3_0Preprocessors,
|
|
51
51
|
oas3_1Preprocessors,
|
|
52
52
|
async2Preprocessors,
|
|
53
53
|
async3Preprocessors,
|
|
54
|
-
|
|
54
|
+
arazzo1Preprocessors,
|
|
55
55
|
decorators,
|
|
56
56
|
oas2Decorators,
|
|
57
57
|
oas3_0Decorators,
|
|
58
58
|
oas3_1Decorators,
|
|
59
59
|
async2Decorators,
|
|
60
60
|
async3Decorators,
|
|
61
|
-
|
|
61
|
+
arazzo1Decorators,
|
|
62
62
|
doNotResolveExamples: rawConfigRest.resolve?.doNotResolveExamples,
|
|
63
63
|
};
|
|
64
64
|
if ((rawConfigRest.lint && rawConfigRest.styleguide) ||
|
|
@@ -103,21 +103,21 @@ function mergeExtends(rulesConfList) {
|
|
|
103
103
|
oas3_1Rules: {},
|
|
104
104
|
async2Rules: {},
|
|
105
105
|
async3Rules: {},
|
|
106
|
-
|
|
106
|
+
arazzo1Rules: {},
|
|
107
107
|
preprocessors: {},
|
|
108
108
|
oas2Preprocessors: {},
|
|
109
109
|
oas3_0Preprocessors: {},
|
|
110
110
|
oas3_1Preprocessors: {},
|
|
111
111
|
async2Preprocessors: {},
|
|
112
112
|
async3Preprocessors: {},
|
|
113
|
-
|
|
113
|
+
arazzo1Preprocessors: {},
|
|
114
114
|
decorators: {},
|
|
115
115
|
oas2Decorators: {},
|
|
116
116
|
oas3_0Decorators: {},
|
|
117
117
|
oas3_1Decorators: {},
|
|
118
118
|
async2Decorators: {},
|
|
119
119
|
async3Decorators: {},
|
|
120
|
-
|
|
120
|
+
arazzo1Decorators: {},
|
|
121
121
|
plugins: [],
|
|
122
122
|
pluginPaths: [],
|
|
123
123
|
extendPaths: [],
|
|
@@ -137,8 +137,8 @@ function mergeExtends(rulesConfList) {
|
|
|
137
137
|
(0, utils_1.assignOnlyExistingConfig)(result.async2Rules, rulesConf.rules);
|
|
138
138
|
(0, utils_1.assignConfig)(result.async3Rules, rulesConf.async3Rules);
|
|
139
139
|
(0, utils_1.assignOnlyExistingConfig)(result.async3Rules, rulesConf.rules);
|
|
140
|
-
(0, utils_1.assignConfig)(result.
|
|
141
|
-
(0, utils_1.assignOnlyExistingConfig)(result.
|
|
140
|
+
(0, utils_1.assignConfig)(result.arazzo1Rules, rulesConf.arazzo1Rules);
|
|
141
|
+
(0, utils_1.assignOnlyExistingConfig)(result.arazzo1Rules, rulesConf.rules);
|
|
142
142
|
(0, utils_1.assignConfig)(result.preprocessors, rulesConf.preprocessors);
|
|
143
143
|
(0, utils_1.assignConfig)(result.oas2Preprocessors, rulesConf.oas2Preprocessors);
|
|
144
144
|
(0, utils_1.assignOnlyExistingConfig)(result.oas2Preprocessors, rulesConf.preprocessors);
|
|
@@ -150,8 +150,8 @@ function mergeExtends(rulesConfList) {
|
|
|
150
150
|
(0, utils_1.assignOnlyExistingConfig)(result.async2Preprocessors, rulesConf.preprocessors);
|
|
151
151
|
(0, utils_1.assignConfig)(result.async3Preprocessors, rulesConf.async3Preprocessors);
|
|
152
152
|
(0, utils_1.assignOnlyExistingConfig)(result.async3Preprocessors, rulesConf.preprocessors);
|
|
153
|
-
(0, utils_1.assignConfig)(result.
|
|
154
|
-
(0, utils_1.assignOnlyExistingConfig)(result.
|
|
153
|
+
(0, utils_1.assignConfig)(result.arazzo1Preprocessors, rulesConf.arazzo1Preprocessors);
|
|
154
|
+
(0, utils_1.assignOnlyExistingConfig)(result.arazzo1Preprocessors, rulesConf.preprocessors);
|
|
155
155
|
(0, utils_1.assignConfig)(result.decorators, rulesConf.decorators);
|
|
156
156
|
(0, utils_1.assignConfig)(result.oas2Decorators, rulesConf.oas2Decorators);
|
|
157
157
|
(0, utils_1.assignOnlyExistingConfig)(result.oas2Decorators, rulesConf.decorators);
|
|
@@ -163,8 +163,8 @@ function mergeExtends(rulesConfList) {
|
|
|
163
163
|
(0, utils_1.assignOnlyExistingConfig)(result.async2Decorators, rulesConf.decorators);
|
|
164
164
|
(0, utils_1.assignConfig)(result.async3Decorators, rulesConf.async3Decorators);
|
|
165
165
|
(0, utils_1.assignOnlyExistingConfig)(result.async3Decorators, rulesConf.decorators);
|
|
166
|
-
(0, utils_1.assignConfig)(result.
|
|
167
|
-
(0, utils_1.assignOnlyExistingConfig)(result.
|
|
166
|
+
(0, utils_1.assignConfig)(result.arazzo1Decorators, rulesConf.arazzo1Decorators);
|
|
167
|
+
(0, utils_1.assignOnlyExistingConfig)(result.arazzo1Decorators, rulesConf.decorators);
|
|
168
168
|
result.plugins.push(...(rulesConf.plugins || []));
|
|
169
169
|
result.pluginPaths.push(...(rulesConf.pluginPaths || []));
|
|
170
170
|
result.extendPaths.push(...new Set(rulesConf.extendPaths));
|
|
@@ -203,11 +203,11 @@ function getMergedConfig(config, apiName) {
|
|
|
203
203
|
}, config.configFile)
|
|
204
204
|
: config;
|
|
205
205
|
}
|
|
206
|
-
function checkForDeprecatedFields(deprecatedField, updatedField, rawConfig, updatedObject) {
|
|
206
|
+
function checkForDeprecatedFields(deprecatedField, updatedField, rawConfig, updatedObject, link) {
|
|
207
207
|
const isDeprecatedFieldInApis = rawConfig.apis &&
|
|
208
208
|
Object.values(rawConfig.apis).some((api) => api[deprecatedField]);
|
|
209
209
|
if (rawConfig[deprecatedField] && updatedField === null) {
|
|
210
|
-
(0, utils_1.showWarningForDeprecatedField)(deprecatedField);
|
|
210
|
+
(0, utils_1.showWarningForDeprecatedField)(deprecatedField, undefined, updatedObject, link);
|
|
211
211
|
}
|
|
212
212
|
if (rawConfig[deprecatedField] && updatedField && rawConfig[updatedField]) {
|
|
213
213
|
(0, utils_1.showErrorForDeprecatedField)(deprecatedField, updatedField);
|
|
@@ -216,19 +216,29 @@ function checkForDeprecatedFields(deprecatedField, updatedField, rawConfig, upda
|
|
|
216
216
|
(0, utils_1.showErrorForDeprecatedField)(deprecatedField, updatedField, updatedObject);
|
|
217
217
|
}
|
|
218
218
|
if (rawConfig[deprecatedField] || isDeprecatedFieldInApis) {
|
|
219
|
-
(0, utils_1.showWarningForDeprecatedField)(deprecatedField, updatedField, updatedObject);
|
|
219
|
+
(0, utils_1.showWarningForDeprecatedField)(deprecatedField, updatedField, updatedObject, link);
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
function transformConfig(rawConfig) {
|
|
223
223
|
const migratedFields = [
|
|
224
|
-
['apiDefinitions', 'apis', undefined],
|
|
225
|
-
['referenceDocs', 'openapi', 'theme'],
|
|
226
|
-
[
|
|
227
|
-
|
|
228
|
-
|
|
224
|
+
['apiDefinitions', 'apis', undefined, undefined],
|
|
225
|
+
['referenceDocs', 'openapi', 'theme', undefined],
|
|
226
|
+
[
|
|
227
|
+
'lint',
|
|
228
|
+
undefined,
|
|
229
|
+
undefined,
|
|
230
|
+
'https://redocly.com/docs/api-registry/guides/migration-guide-config-file/#changed-properties',
|
|
231
|
+
],
|
|
232
|
+
[
|
|
233
|
+
'styleguide',
|
|
234
|
+
undefined,
|
|
235
|
+
undefined,
|
|
236
|
+
'https://redocly.com/docs/api-registry/guides/migration-guide-config-file/#changed-properties',
|
|
237
|
+
],
|
|
238
|
+
['features.openapi', 'openapi', 'theme', undefined],
|
|
229
239
|
];
|
|
230
|
-
for (const [deprecatedField, updatedField, updatedObject] of migratedFields) {
|
|
231
|
-
checkForDeprecatedFields(deprecatedField, updatedField, rawConfig, updatedObject);
|
|
240
|
+
for (const [deprecatedField, updatedField, updatedObject, link] of migratedFields) {
|
|
241
|
+
checkForDeprecatedFields(deprecatedField, updatedField, rawConfig, updatedObject, link);
|
|
232
242
|
}
|
|
233
243
|
const { apis, apiDefinitions, referenceDocs, lint, ...rest } = rawConfig;
|
|
234
244
|
const { styleguideConfig, rawConfigRest } = extractFlatConfig(rest);
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { BundleOutputFormat, readFileFromUrl, slash, doesYamlFileExist, isTruthy, getProxyAgent, pause, } from './utils';
|
|
2
2
|
export { Oas3_1Types } from './types/oas3_1';
|
|
3
|
-
export {
|
|
3
|
+
export { Arazzo1Types } from './types/arazzo';
|
|
4
4
|
export { Oas3Types } from './types/oas3';
|
|
5
5
|
export { Oas2Types } from './types/oas2';
|
|
6
6
|
export { AsyncApi2Types } from './types/asyncapi2';
|
package/lib/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.validate = exports.lint = exports.getTotals = exports.formatProblems = exports.getLineColLocation = exports.getAstNodeByPointer = exports.walkDocument = exports.normalizeVisitors = exports.getTypes = exports.detectSpec = exports.SpecVersion = exports.getMajorSpecVersion = exports.SpecMajorVersion = exports.isAbsoluteUrl = exports.isRef = exports.unescapePointer = exports.stringifyYaml = exports.parseYaml = exports.makeDocumentFromString = exports.YamlParseError = exports.ResolveError = exports.resolveDocument = exports.BaseResolver = exports.Source = exports.RedoclyClient = exports.createConfig = exports.CONFIG_FILE_NAMES = exports.findConfig = exports.getConfig = exports.loadConfig = exports.transformConfig = exports.getMergedConfig = exports.IGNORE_FILE = exports.StyleguideConfig = exports.Config = exports.Stats = exports.normalizeTypes = exports.ConfigTypes = exports.AsyncApi3Types = exports.AsyncApi2Types = exports.Oas2Types = exports.Oas3Types = exports.
|
|
17
|
+
exports.validate = exports.lint = exports.getTotals = exports.formatProblems = exports.getLineColLocation = exports.getAstNodeByPointer = exports.walkDocument = exports.normalizeVisitors = exports.getTypes = exports.detectSpec = exports.SpecVersion = exports.getMajorSpecVersion = exports.SpecMajorVersion = exports.isAbsoluteUrl = exports.isRef = exports.unescapePointer = exports.stringifyYaml = exports.parseYaml = exports.makeDocumentFromString = exports.YamlParseError = exports.ResolveError = exports.resolveDocument = exports.BaseResolver = exports.Source = exports.RedoclyClient = exports.createConfig = exports.CONFIG_FILE_NAMES = exports.findConfig = exports.getConfig = exports.loadConfig = exports.transformConfig = exports.getMergedConfig = exports.IGNORE_FILE = exports.StyleguideConfig = exports.Config = exports.Stats = exports.normalizeTypes = exports.ConfigTypes = exports.AsyncApi3Types = exports.AsyncApi2Types = exports.Oas2Types = exports.Oas3Types = exports.Arazzo1Types = exports.Oas3_1Types = exports.pause = exports.getProxyAgent = exports.isTruthy = exports.doesYamlFileExist = exports.slash = exports.readFileFromUrl = void 0;
|
|
18
18
|
exports.bundleFromString = exports.mapTypeToComponent = exports.bundleDocument = exports.bundle = exports.lintConfig = exports.lintFromString = exports.lintDocument = void 0;
|
|
19
19
|
var utils_1 = require("./utils");
|
|
20
20
|
Object.defineProperty(exports, "readFileFromUrl", { enumerable: true, get: function () { return utils_1.readFileFromUrl; } });
|
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "pause", { enumerable: true, get: function () { r
|
|
|
26
26
|
var oas3_1_1 = require("./types/oas3_1");
|
|
27
27
|
Object.defineProperty(exports, "Oas3_1Types", { enumerable: true, get: function () { return oas3_1_1.Oas3_1Types; } });
|
|
28
28
|
var arazzo_1 = require("./types/arazzo");
|
|
29
|
-
Object.defineProperty(exports, "
|
|
29
|
+
Object.defineProperty(exports, "Arazzo1Types", { enumerable: true, get: function () { return arazzo_1.Arazzo1Types; } });
|
|
30
30
|
var oas3_1 = require("./types/oas3");
|
|
31
31
|
Object.defineProperty(exports, "Oas3Types", { enumerable: true, get: function () { return oas3_1.Oas3Types; } });
|
|
32
32
|
var oas2_1 = require("./types/oas2");
|
package/lib/lint.js
CHANGED
|
@@ -13,7 +13,7 @@ const types_1 = require("./types");
|
|
|
13
13
|
const ajv_1 = require("./rules/ajv");
|
|
14
14
|
const oas_types_1 = require("./oas-types");
|
|
15
15
|
const redocly_yaml_1 = require("./types/redocly-yaml");
|
|
16
|
-
const
|
|
16
|
+
const struct_1 = require("./rules/common/struct");
|
|
17
17
|
const no_unresolved_refs_1 = require("./rules/no-unresolved-refs");
|
|
18
18
|
async function lint(opts) {
|
|
19
19
|
const { ref, externalRefResolver = new resolve_1.BaseResolver(opts.config.resolve) } = opts;
|
|
@@ -41,7 +41,7 @@ async function lintDocument(opts) {
|
|
|
41
41
|
const { document, customTypes, externalRefResolver, config } = opts;
|
|
42
42
|
const specVersion = (0, oas_types_1.detectSpec)(document.parsed);
|
|
43
43
|
const specMajorVersion = (0, oas_types_1.getMajorSpecVersion)(specVersion);
|
|
44
|
-
const rules = config.
|
|
44
|
+
const rules = config.getRulesForSpecVersion(specMajorVersion);
|
|
45
45
|
const types = (0, types_1.normalizeTypes)(config.extendTypes(customTypes ?? (0, oas_types_1.getTypes)(specVersion), specVersion), config);
|
|
46
46
|
const ctx = {
|
|
47
47
|
problems: [],
|
|
@@ -92,7 +92,7 @@ async function lintConfig(opts) {
|
|
|
92
92
|
{
|
|
93
93
|
severity: severity || 'error',
|
|
94
94
|
ruleId: 'configuration spec',
|
|
95
|
-
visitor: (0,
|
|
95
|
+
visitor: (0, struct_1.Struct)({ severity: 'error' }),
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
severity: severity || 'error',
|