@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @redocly/openapi-core
|
|
2
2
|
|
|
3
|
+
## 1.26.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Introduced the `struct` rule and deprecated the `spec` rule.
|
|
8
|
+
Added the `spec` ruleset, which enforces compliance with the specifications.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated `sourceDescriptions` to enforce a valid type field, ensuring compliance with the Arazzo specification.
|
|
13
|
+
|
|
3
14
|
## 1.25.15
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/__tests__/utils.ts
CHANGED
|
@@ -73,12 +73,10 @@ export async function makeConfig({
|
|
|
73
73
|
rules,
|
|
74
74
|
decorators,
|
|
75
75
|
configPath,
|
|
76
|
-
arazzoRules,
|
|
77
76
|
}: {
|
|
78
77
|
rules: Record<string, RuleConfig>;
|
|
79
78
|
decorators?: Record<string, DecoratorConfig>;
|
|
80
79
|
configPath?: string;
|
|
81
|
-
arazzoRules?: Record<string, RuleConfig>;
|
|
82
80
|
}) {
|
|
83
81
|
return new StyleguideConfig(
|
|
84
82
|
await resolveStyleguideConfig({
|
|
@@ -86,7 +84,6 @@ export async function makeConfig({
|
|
|
86
84
|
plugins: [],
|
|
87
85
|
extends: [],
|
|
88
86
|
rules,
|
|
89
|
-
arazzoRules,
|
|
90
87
|
decorators,
|
|
91
88
|
},
|
|
92
89
|
}),
|
package/lib/bundle.js
CHANGED
|
@@ -86,7 +86,7 @@ async function bundleDocument(opts) {
|
|
|
86
86
|
const { document, config, customTypes, externalRefResolver, dereference = false, skipRedoclyRegistryRefs = false, removeUnusedComponents = false, keepUrlRefs = false, } = opts;
|
|
87
87
|
const specVersion = (0, oas_types_1.detectSpec)(document.parsed);
|
|
88
88
|
const specMajorVersion = (0, oas_types_1.getMajorSpecVersion)(specVersion);
|
|
89
|
-
const rules = config.
|
|
89
|
+
const rules = config.getRulesForSpecVersion(specMajorVersion);
|
|
90
90
|
const types = (0, types_1.normalizeTypes)(config.extendTypes(customTypes ?? (0, oas_types_1.getTypes)(specVersion), specVersion), config);
|
|
91
91
|
const preprocessors = (0, rules_1.initRules)(rules, config, 'preprocessors', specVersion);
|
|
92
92
|
const decorators = (0, rules_1.initRules)(rules, config, 'decorators', specVersion);
|
|
@@ -203,7 +203,7 @@ function mapTypeToComponent(typeName, version) {
|
|
|
203
203
|
default:
|
|
204
204
|
return null;
|
|
205
205
|
}
|
|
206
|
-
case oas_types_1.SpecMajorVersion.
|
|
206
|
+
case oas_types_1.SpecMajorVersion.Arazzo1:
|
|
207
207
|
switch (typeName) {
|
|
208
208
|
case 'Root.workflows_items.parameters_items':
|
|
209
209
|
case 'Root.workflows_items.steps_items.parameters_items':
|
|
@@ -296,7 +296,7 @@ function makeBundleVisitor(version, dereference, skipRedoclyRegistryRefs, rootDo
|
|
|
296
296
|
else if (version === oas_types_1.SpecMajorVersion.Async3) {
|
|
297
297
|
components = root.components = root.components || {};
|
|
298
298
|
}
|
|
299
|
-
else if (version === oas_types_1.SpecMajorVersion.
|
|
299
|
+
else if (version === oas_types_1.SpecMajorVersion.Arazzo1) {
|
|
300
300
|
components = root.components = root.components || {};
|
|
301
301
|
}
|
|
302
302
|
},
|
package/lib/config/all.js
CHANGED
|
@@ -2,52 +2,47 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const all = {
|
|
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 = {
|
|
|
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 = {
|
|
|
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 = {
|
|
|
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 = {
|
|
|
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,48 @@ const all = {
|
|
|
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',
|
|
214
|
+
'no-actions-type-end': 'error',
|
|
131
215
|
'parameters-not-in-body': 'error',
|
|
216
|
+
'parameters-unique': 'error',
|
|
217
|
+
'requestBody-replacements-unique': 'error',
|
|
132
218
|
'sourceDescription-type': 'error',
|
|
133
|
-
'
|
|
134
|
-
'
|
|
219
|
+
'step-onSuccess-unique': 'error',
|
|
220
|
+
'step-onFailure-unique': 'error',
|
|
135
221
|
'stepId-unique': 'error',
|
|
136
222
|
'sourceDescription-name-unique': 'error',
|
|
223
|
+
'sourceDescriptions-not-empty': 'error',
|
|
224
|
+
'version-enum': 'error',
|
|
225
|
+
'workflowId-unique': 'error',
|
|
137
226
|
'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
227
|
},
|
|
146
228
|
};
|
|
147
229
|
exports.default = all;
|
package/lib/config/builtIn.d.ts
CHANGED
package/lib/config/builtIn.js
CHANGED
|
@@ -5,6 +5,7 @@ const recommended_1 = require("./recommended");
|
|
|
5
5
|
const recommended_strict_1 = require("./recommended-strict");
|
|
6
6
|
const all_1 = require("./all");
|
|
7
7
|
const minimal_1 = require("./minimal");
|
|
8
|
+
const spec_1 = require("./spec");
|
|
8
9
|
const oas3_1 = require("../rules/oas3");
|
|
9
10
|
const oas2_1 = require("../rules/oas2");
|
|
10
11
|
const async2_1 = require("../rules/async2");
|
|
@@ -20,6 +21,7 @@ exports.builtInConfigs = {
|
|
|
20
21
|
'recommended-strict': recommended_strict_1.default,
|
|
21
22
|
minimal: minimal_1.default,
|
|
22
23
|
all: all_1.default,
|
|
24
|
+
spec: spec_1.default,
|
|
23
25
|
'redocly-registry': {
|
|
24
26
|
decorators: { 'registry-dependencies': 'on' },
|
|
25
27
|
},
|
|
@@ -31,21 +33,21 @@ exports.defaultPlugin = {
|
|
|
31
33
|
oas2: oas2_1.rules,
|
|
32
34
|
async2: async2_1.rules,
|
|
33
35
|
async3: async3_1.rules,
|
|
34
|
-
|
|
36
|
+
arazzo1: arazzo_1.rules,
|
|
35
37
|
},
|
|
36
38
|
preprocessors: {
|
|
37
39
|
oas3: oas3_1.preprocessors,
|
|
38
40
|
oas2: oas2_1.preprocessors,
|
|
39
41
|
async2: async2_1.preprocessors,
|
|
40
42
|
async3: async3_1.preprocessors,
|
|
41
|
-
|
|
43
|
+
arazzo1: arazzo_1.preprocessors,
|
|
42
44
|
},
|
|
43
45
|
decorators: {
|
|
44
46
|
oas3: oas3_2.decorators,
|
|
45
47
|
oas2: oas2_2.decorators,
|
|
46
48
|
async2: async2_2.decorators,
|
|
47
49
|
async3: async3_2.decorators,
|
|
48
|
-
|
|
50
|
+
arazzo1: arazzo_2.decorators,
|
|
49
51
|
},
|
|
50
52
|
configs: exports.builtInConfigs,
|
|
51
53
|
};
|
|
@@ -176,8 +176,8 @@ async function resolvePlugins(plugins, configDir = '') {
|
|
|
176
176
|
if (pluginModule.rules.async3) {
|
|
177
177
|
plugin.rules.async3 = (0, utils_2.prefixRules)(pluginModule.rules.async3, id);
|
|
178
178
|
}
|
|
179
|
-
if (pluginModule.rules.
|
|
180
|
-
plugin.rules.
|
|
179
|
+
if (pluginModule.rules.arazzo1) {
|
|
180
|
+
plugin.rules.arazzo1 = (0, utils_2.prefixRules)(pluginModule.rules.arazzo1, id);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
if (pluginModule.preprocessors) {
|
|
@@ -185,7 +185,7 @@ async function resolvePlugins(plugins, configDir = '') {
|
|
|
185
185
|
!pluginModule.preprocessors.oas2 &&
|
|
186
186
|
!pluginModule.preprocessors.async2 &&
|
|
187
187
|
!pluginModule.preprocessors.async3 &&
|
|
188
|
-
!pluginModule.preprocessors.
|
|
188
|
+
!pluginModule.preprocessors.arazzo1) {
|
|
189
189
|
throw new Error(`Plugin \`preprocessors\` must have \`oas3\`, \`oas2\` or \`async2\` preprocessors "${p}.`);
|
|
190
190
|
}
|
|
191
191
|
plugin.preprocessors = {};
|
|
@@ -201,8 +201,8 @@ async function resolvePlugins(plugins, configDir = '') {
|
|
|
201
201
|
if (pluginModule.preprocessors.async3) {
|
|
202
202
|
plugin.preprocessors.async3 = (0, utils_2.prefixRules)(pluginModule.preprocessors.async3, id);
|
|
203
203
|
}
|
|
204
|
-
if (pluginModule.preprocessors.
|
|
205
|
-
plugin.preprocessors.
|
|
204
|
+
if (pluginModule.preprocessors.arazzo1) {
|
|
205
|
+
plugin.preprocessors.arazzo1 = (0, utils_2.prefixRules)(pluginModule.preprocessors.arazzo1, id);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
if (pluginModule.decorators) {
|
|
@@ -210,7 +210,7 @@ async function resolvePlugins(plugins, configDir = '') {
|
|
|
210
210
|
!pluginModule.decorators.oas2 &&
|
|
211
211
|
!pluginModule.decorators.async2 &&
|
|
212
212
|
!pluginModule.decorators.async3 &&
|
|
213
|
-
!pluginModule.decorators.
|
|
213
|
+
!pluginModule.decorators.arazzo1) {
|
|
214
214
|
throw new Error(`Plugin \`decorators\` must have \`oas3\`, \`oas2\`, \`async2\` or \`async3\` decorators "${p}.`);
|
|
215
215
|
}
|
|
216
216
|
plugin.decorators = {};
|
|
@@ -226,8 +226,8 @@ async function resolvePlugins(plugins, configDir = '') {
|
|
|
226
226
|
if (pluginModule.decorators.async3) {
|
|
227
227
|
plugin.decorators.async3 = (0, utils_2.prefixRules)(pluginModule.decorators.async3, id);
|
|
228
228
|
}
|
|
229
|
-
if (pluginModule.decorators.
|
|
230
|
-
plugin.decorators.
|
|
229
|
+
if (pluginModule.decorators.arazzo1) {
|
|
230
|
+
plugin.decorators.arazzo1 = (0, utils_2.prefixRules)(pluginModule.decorators.arazzo1, id);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
if (pluginModule.assertions) {
|
|
@@ -349,7 +349,7 @@ function getMergedRawStyleguideConfig(rootStyleguideConfig, apiStyleguideConfig)
|
|
|
349
349
|
oas3_1Rules: { ...rootStyleguideConfig?.oas3_1Rules, ...apiStyleguideConfig?.oas3_1Rules },
|
|
350
350
|
async2Rules: { ...rootStyleguideConfig?.async2Rules, ...apiStyleguideConfig?.async2Rules },
|
|
351
351
|
async3Rules: { ...rootStyleguideConfig?.async3Rules, ...apiStyleguideConfig?.async3Rules },
|
|
352
|
-
|
|
352
|
+
arazzo1Rules: { ...rootStyleguideConfig?.arazzo1Rules, ...apiStyleguideConfig?.arazzo1Rules },
|
|
353
353
|
preprocessors: {
|
|
354
354
|
...rootStyleguideConfig?.preprocessors,
|
|
355
355
|
...apiStyleguideConfig?.preprocessors,
|
package/lib/config/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SpecVersion, SpecMajorVersion } from '../oas-types';
|
|
2
2
|
import type { NormalizedProblem } from '../walk';
|
|
3
|
-
import type { Oas2RuleSet, Oas3RuleSet, Async3RuleSet,
|
|
3
|
+
import type { Oas2RuleSet, Oas3RuleSet, Async3RuleSet, Arazzo1RuleSet } from '../oas-types';
|
|
4
4
|
import type { NodeType } from '../types';
|
|
5
5
|
import type { DecoratorConfig, Plugin, PreprocessorConfig, Region, ResolveConfig, ResolvedApi, ResolvedConfig, ResolvedStyleguideConfig, RuleConfig, RuleSettings, Telemetry, ThemeRawConfig } from './types';
|
|
6
6
|
export declare const IGNORE_FILE = ".redocly.lint-ignore.yaml";
|
|
@@ -32,7 +32,7 @@ export declare class StyleguideConfig {
|
|
|
32
32
|
preprocessors: string[];
|
|
33
33
|
decorators: string[];
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
getRulesForSpecVersion(version: SpecMajorVersion): Oas3RuleSet[] | Oas2RuleSet[] | Async3RuleSet[] | Arazzo1RuleSet[];
|
|
36
36
|
skipRules(rules?: string[]): void;
|
|
37
37
|
skipPreprocessors(preprocessors?: string[]): void;
|
|
38
38
|
skipDecorators(decorators?: string[]): void;
|
package/lib/config/config.js
CHANGED
|
@@ -32,16 +32,23 @@ class StyleguideConfig {
|
|
|
32
32
|
this.plugins = rawConfig.plugins || [];
|
|
33
33
|
this.doNotResolveExamples = !!rawConfig.doNotResolveExamples;
|
|
34
34
|
this.recommendedFallback = rawConfig.recommendedFallback || false;
|
|
35
|
+
const ruleGroups = [
|
|
36
|
+
'rules',
|
|
37
|
+
'oas2Rules',
|
|
38
|
+
'oas3_0Rules',
|
|
39
|
+
'oas3_1Rules',
|
|
40
|
+
'async2Rules',
|
|
41
|
+
'async3Rules',
|
|
42
|
+
'arazzo1Rules',
|
|
43
|
+
];
|
|
44
|
+
replaceSpecWithStruct(ruleGroups, rawConfig);
|
|
35
45
|
this.rules = {
|
|
36
46
|
[oas_types_1.SpecVersion.OAS2]: { ...rawConfig.rules, ...rawConfig.oas2Rules },
|
|
37
47
|
[oas_types_1.SpecVersion.OAS3_0]: { ...rawConfig.rules, ...rawConfig.oas3_0Rules },
|
|
38
48
|
[oas_types_1.SpecVersion.OAS3_1]: { ...rawConfig.rules, ...rawConfig.oas3_1Rules },
|
|
39
49
|
[oas_types_1.SpecVersion.Async2]: { ...rawConfig.rules, ...rawConfig.async2Rules },
|
|
40
50
|
[oas_types_1.SpecVersion.Async3]: { ...rawConfig.rules, ...rawConfig.async3Rules },
|
|
41
|
-
[oas_types_1.SpecVersion.
|
|
42
|
-
...(rawConfig.arazzoRules || {}),
|
|
43
|
-
...(rawConfig.rules?.assertions ? { assertions: rawConfig.rules.assertions } : {}),
|
|
44
|
-
},
|
|
51
|
+
[oas_types_1.SpecVersion.Arazzo1]: { ...rawConfig.rules, ...rawConfig.arazzo1Rules },
|
|
45
52
|
};
|
|
46
53
|
this.preprocessors = {
|
|
47
54
|
[oas_types_1.SpecVersion.OAS2]: { ...rawConfig.preprocessors, ...rawConfig.oas2Preprocessors },
|
|
@@ -49,7 +56,7 @@ class StyleguideConfig {
|
|
|
49
56
|
[oas_types_1.SpecVersion.OAS3_1]: { ...rawConfig.preprocessors, ...rawConfig.oas3_1Preprocessors },
|
|
50
57
|
[oas_types_1.SpecVersion.Async2]: { ...rawConfig.preprocessors, ...rawConfig.async2Preprocessors },
|
|
51
58
|
[oas_types_1.SpecVersion.Async3]: { ...rawConfig.preprocessors, ...rawConfig.async3Preprocessors },
|
|
52
|
-
[oas_types_1.SpecVersion.
|
|
59
|
+
[oas_types_1.SpecVersion.Arazzo1]: { ...rawConfig.arazzo1Preprocessors },
|
|
53
60
|
};
|
|
54
61
|
this.decorators = {
|
|
55
62
|
[oas_types_1.SpecVersion.OAS2]: { ...rawConfig.decorators, ...rawConfig.oas2Decorators },
|
|
@@ -57,7 +64,7 @@ class StyleguideConfig {
|
|
|
57
64
|
[oas_types_1.SpecVersion.OAS3_1]: { ...rawConfig.decorators, ...rawConfig.oas3_1Decorators },
|
|
58
65
|
[oas_types_1.SpecVersion.Async2]: { ...rawConfig.decorators, ...rawConfig.async2Decorators },
|
|
59
66
|
[oas_types_1.SpecVersion.Async3]: { ...rawConfig.decorators, ...rawConfig.async3Decorators },
|
|
60
|
-
[oas_types_1.SpecVersion.
|
|
67
|
+
[oas_types_1.SpecVersion.Arazzo1]: { ...rawConfig.arazzo1Decorators },
|
|
61
68
|
};
|
|
62
69
|
this.extendPaths = rawConfig.extendPaths || [];
|
|
63
70
|
this.pluginPaths = rawConfig.pluginPaths || [];
|
|
@@ -68,6 +75,7 @@ class StyleguideConfig {
|
|
|
68
75
|
return;
|
|
69
76
|
this.ignore =
|
|
70
77
|
(0, js_yaml_1.parseYaml)(fs.readFileSync(ignoreFile, 'utf-8')) || {};
|
|
78
|
+
replaceSpecWithStruct(Object.keys(this.ignore), this.ignore);
|
|
71
79
|
// resolve ignore paths
|
|
72
80
|
for (const fileName of Object.keys(this.ignore)) {
|
|
73
81
|
this.ignore[(0, ref_utils_1.isAbsoluteUrl)(fileName) ? fileName : path.resolve(path.dirname(ignoreFile), fileName)] = this.ignore[fileName];
|
|
@@ -143,10 +151,10 @@ class StyleguideConfig {
|
|
|
143
151
|
continue;
|
|
144
152
|
extendedTypes = plugin.typeExtension.async3(extendedTypes, version);
|
|
145
153
|
break;
|
|
146
|
-
case oas_types_1.SpecVersion.
|
|
147
|
-
if (!plugin.typeExtension.
|
|
154
|
+
case oas_types_1.SpecVersion.Arazzo1:
|
|
155
|
+
if (!plugin.typeExtension.arazzo1)
|
|
148
156
|
continue;
|
|
149
|
-
extendedTypes = plugin.typeExtension.
|
|
157
|
+
extendedTypes = plugin.typeExtension.arazzo1(extendedTypes, version);
|
|
150
158
|
break;
|
|
151
159
|
default:
|
|
152
160
|
throw new Error('Not implemented');
|
|
@@ -209,43 +217,43 @@ class StyleguideConfig {
|
|
|
209
217
|
decorators,
|
|
210
218
|
};
|
|
211
219
|
}
|
|
212
|
-
|
|
220
|
+
getRulesForSpecVersion(version) {
|
|
213
221
|
switch (version) {
|
|
214
222
|
case oas_types_1.SpecMajorVersion.OAS3:
|
|
215
223
|
// eslint-disable-next-line no-case-declarations
|
|
216
|
-
const oas3Rules = [];
|
|
224
|
+
const oas3Rules = [];
|
|
217
225
|
this.plugins.forEach((p) => p.preprocessors?.oas3 && oas3Rules.push(p.preprocessors.oas3));
|
|
218
226
|
this.plugins.forEach((p) => p.rules?.oas3 && oas3Rules.push(p.rules.oas3));
|
|
219
227
|
this.plugins.forEach((p) => p.decorators?.oas3 && oas3Rules.push(p.decorators.oas3));
|
|
220
228
|
return oas3Rules;
|
|
221
229
|
case oas_types_1.SpecMajorVersion.OAS2:
|
|
222
230
|
// eslint-disable-next-line no-case-declarations
|
|
223
|
-
const oas2Rules = [];
|
|
231
|
+
const oas2Rules = [];
|
|
224
232
|
this.plugins.forEach((p) => p.preprocessors?.oas2 && oas2Rules.push(p.preprocessors.oas2));
|
|
225
233
|
this.plugins.forEach((p) => p.rules?.oas2 && oas2Rules.push(p.rules.oas2));
|
|
226
234
|
this.plugins.forEach((p) => p.decorators?.oas2 && oas2Rules.push(p.decorators.oas2));
|
|
227
235
|
return oas2Rules;
|
|
228
236
|
case oas_types_1.SpecMajorVersion.Async2:
|
|
229
237
|
// eslint-disable-next-line no-case-declarations
|
|
230
|
-
const asyncApi2Rules = [];
|
|
238
|
+
const asyncApi2Rules = [];
|
|
231
239
|
this.plugins.forEach((p) => p.preprocessors?.async2 && asyncApi2Rules.push(p.preprocessors.async2));
|
|
232
240
|
this.plugins.forEach((p) => p.rules?.async2 && asyncApi2Rules.push(p.rules.async2));
|
|
233
241
|
this.plugins.forEach((p) => p.decorators?.async2 && asyncApi2Rules.push(p.decorators.async2));
|
|
234
242
|
return asyncApi2Rules;
|
|
235
243
|
case oas_types_1.SpecMajorVersion.Async3:
|
|
236
244
|
// eslint-disable-next-line no-case-declarations
|
|
237
|
-
const asyncApi3Rules = [];
|
|
245
|
+
const asyncApi3Rules = [];
|
|
238
246
|
this.plugins.forEach((p) => p.preprocessors?.async3 && asyncApi3Rules.push(p.preprocessors.async3));
|
|
239
247
|
this.plugins.forEach((p) => p.rules?.async3 && asyncApi3Rules.push(p.rules.async3));
|
|
240
248
|
this.plugins.forEach((p) => p.decorators?.async3 && asyncApi3Rules.push(p.decorators.async3));
|
|
241
249
|
return asyncApi3Rules;
|
|
242
|
-
case oas_types_1.SpecMajorVersion.
|
|
250
|
+
case oas_types_1.SpecMajorVersion.Arazzo1:
|
|
243
251
|
// eslint-disable-next-line no-case-declarations
|
|
244
|
-
const
|
|
245
|
-
this.plugins.forEach((p) => p.preprocessors?.
|
|
246
|
-
this.plugins.forEach((p) => p.rules?.
|
|
247
|
-
this.plugins.forEach((p) => p.decorators?.
|
|
248
|
-
return
|
|
252
|
+
const arazzo1Rules = [];
|
|
253
|
+
this.plugins.forEach((p) => p.preprocessors?.arazzo1 && arazzo1Rules.push(p.preprocessors.arazzo1));
|
|
254
|
+
this.plugins.forEach((p) => p.rules?.arazzo1 && arazzo1Rules.push(p.rules.arazzo1));
|
|
255
|
+
this.plugins.forEach((p) => p.decorators?.arazzo1 && arazzo1Rules.push(p.decorators.arazzo1));
|
|
256
|
+
return arazzo1Rules;
|
|
249
257
|
}
|
|
250
258
|
}
|
|
251
259
|
skipRules(rules) {
|
|
@@ -285,6 +293,16 @@ class StyleguideConfig {
|
|
|
285
293
|
}
|
|
286
294
|
}
|
|
287
295
|
exports.StyleguideConfig = StyleguideConfig;
|
|
296
|
+
// To support backwards compatibility with the old `spec` key we rename it to `struct`.
|
|
297
|
+
function replaceSpecWithStruct(ruleGroups, config) {
|
|
298
|
+
for (const ruleGroup of ruleGroups) {
|
|
299
|
+
if (config[ruleGroup] && (0, utils_1.isPlainObject)(config[ruleGroup]) && 'spec' in config[ruleGroup]) {
|
|
300
|
+
(0, utils_1.showWarningForDeprecatedField)('spec', 'struct');
|
|
301
|
+
config[ruleGroup].struct = config[ruleGroup].spec;
|
|
302
|
+
delete config[ruleGroup].spec;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
288
306
|
class Config {
|
|
289
307
|
constructor(rawConfig, configFile) {
|
|
290
308
|
this.rawConfig = rawConfig;
|