@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
|
@@ -8,8 +8,7 @@ import type { JSONSchema } from 'json-schema-to-ts';
|
|
|
8
8
|
import type { NodeType } from '.';
|
|
9
9
|
import type { Config } from '../config';
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
'spec',
|
|
11
|
+
const builtInOAS2Rules = [
|
|
13
12
|
'info-contact',
|
|
14
13
|
'operation-operationId',
|
|
15
14
|
'tag-description',
|
|
@@ -49,11 +48,6 @@ const builtInCommonOASRules = [
|
|
|
49
48
|
'spec-strict-refs',
|
|
50
49
|
'no-unresolved-refs',
|
|
51
50
|
'no-required-schema-properties-undefined',
|
|
52
|
-
] as const;
|
|
53
|
-
|
|
54
|
-
export type BuiltInCommonOASRuleId = typeof builtInCommonOASRules[number];
|
|
55
|
-
|
|
56
|
-
const builtInOAS2Rules = [
|
|
57
51
|
'boolean-parameter-prefixes',
|
|
58
52
|
'request-mime-type',
|
|
59
53
|
'response-contains-property',
|
|
@@ -63,6 +57,45 @@ const builtInOAS2Rules = [
|
|
|
63
57
|
export type BuiltInOAS2RuleId = typeof builtInOAS2Rules[number];
|
|
64
58
|
|
|
65
59
|
const builtInOAS3Rules = [
|
|
60
|
+
'info-contact',
|
|
61
|
+
'operation-operationId',
|
|
62
|
+
'tag-description',
|
|
63
|
+
'tags-alphabetical',
|
|
64
|
+
'info-license-url',
|
|
65
|
+
'info-license-strict',
|
|
66
|
+
'info-license',
|
|
67
|
+
'no-ambiguous-paths',
|
|
68
|
+
'no-enum-type-mismatch',
|
|
69
|
+
'no-http-verbs-in-paths',
|
|
70
|
+
'no-identical-paths',
|
|
71
|
+
'no-invalid-parameter-examples',
|
|
72
|
+
'no-invalid-schema-examples',
|
|
73
|
+
'no-path-trailing-slash',
|
|
74
|
+
'operation-2xx-response',
|
|
75
|
+
'operation-4xx-response',
|
|
76
|
+
'operation-description',
|
|
77
|
+
'operation-operationId-unique',
|
|
78
|
+
'operation-operationId-url-safe',
|
|
79
|
+
'operation-parameters-unique',
|
|
80
|
+
'operation-singular-tag',
|
|
81
|
+
'operation-summary',
|
|
82
|
+
'operation-tag-defined',
|
|
83
|
+
'parameter-description',
|
|
84
|
+
'path-declaration-must-exist',
|
|
85
|
+
'path-excludes-patterns',
|
|
86
|
+
'path-http-verbs-order',
|
|
87
|
+
'path-not-include-query',
|
|
88
|
+
'path-params-defined',
|
|
89
|
+
'path-parameters-defined',
|
|
90
|
+
'path-segment-plural',
|
|
91
|
+
'paths-kebab-case',
|
|
92
|
+
'required-string-property-missing-min-length',
|
|
93
|
+
'response-contains-header',
|
|
94
|
+
'scalar-property-missing-example',
|
|
95
|
+
'security-defined',
|
|
96
|
+
'spec-strict-refs',
|
|
97
|
+
'no-unresolved-refs',
|
|
98
|
+
'no-required-schema-properties-undefined',
|
|
66
99
|
'boolean-parameter-prefixes',
|
|
67
100
|
'component-name-unique',
|
|
68
101
|
'no-empty-servers',
|
|
@@ -84,7 +117,6 @@ const builtInOAS3Rules = [
|
|
|
84
117
|
export type BuiltInOAS3RuleId = typeof builtInOAS3Rules[number];
|
|
85
118
|
|
|
86
119
|
const builtInAsync2Rules = [
|
|
87
|
-
'spec',
|
|
88
120
|
'info-contact',
|
|
89
121
|
'info-license-strict',
|
|
90
122
|
'operation-operationId',
|
|
@@ -95,7 +127,6 @@ const builtInAsync2Rules = [
|
|
|
95
127
|
] as const;
|
|
96
128
|
|
|
97
129
|
const builtInAsync3Rules = [
|
|
98
|
-
'spec',
|
|
99
130
|
'info-contact',
|
|
100
131
|
'info-license-strict',
|
|
101
132
|
'operation-operationId',
|
|
@@ -109,33 +140,33 @@ export type BuiltInAsync2RuleId = typeof builtInAsync2Rules[number];
|
|
|
109
140
|
|
|
110
141
|
export type BuiltInAsync3RuleId = typeof builtInAsync3Rules[number];
|
|
111
142
|
|
|
112
|
-
const
|
|
113
|
-
'spec',
|
|
143
|
+
const builtInArazzo1Rules = [
|
|
114
144
|
'parameters-not-in-body',
|
|
115
145
|
'sourceDescription-type',
|
|
116
146
|
'version-enum',
|
|
117
147
|
'workflowId-unique',
|
|
118
148
|
'stepId-unique',
|
|
119
149
|
'sourceDescription-name-unique',
|
|
150
|
+
'sourceDescriptions-not-empty',
|
|
120
151
|
'workflow-dependsOn',
|
|
121
152
|
'parameters-unique',
|
|
122
153
|
'step-onSuccess-unique',
|
|
123
154
|
'step-onFailure-unique',
|
|
124
155
|
'requestBody-replacements-unique',
|
|
125
156
|
'no-criteria-xpath',
|
|
126
|
-
'no-actions-type-end',
|
|
127
157
|
'criteria-unique',
|
|
128
158
|
] as const;
|
|
129
159
|
|
|
130
|
-
export type
|
|
160
|
+
export type BuiltInArazzo1RuleId = typeof builtInArazzo1Rules[number];
|
|
131
161
|
|
|
132
162
|
const builtInRules = [
|
|
133
|
-
...builtInCommonOASRules,
|
|
134
163
|
...builtInOAS2Rules,
|
|
135
164
|
...builtInOAS3Rules,
|
|
136
165
|
...builtInAsync2Rules,
|
|
137
166
|
...builtInAsync3Rules,
|
|
138
|
-
...
|
|
167
|
+
...builtInArazzo1Rules,
|
|
168
|
+
'spec', // TODO: depricated in favor of struct
|
|
169
|
+
'struct',
|
|
139
170
|
] as const;
|
|
140
171
|
|
|
141
172
|
type BuiltInRuleId = typeof builtInRules[number];
|
|
@@ -278,7 +309,7 @@ const ConfigStyleguide: NodeType = {
|
|
|
278
309
|
oas3_0Rules: 'Rules',
|
|
279
310
|
oas3_1Rules: 'Rules',
|
|
280
311
|
async2Rules: 'Rules',
|
|
281
|
-
|
|
312
|
+
arazzo1Rules: 'Rules',
|
|
282
313
|
preprocessors: { type: 'object' },
|
|
283
314
|
oas2Preprocessors: { type: 'object' },
|
|
284
315
|
oas3_0Preprocessors: { type: 'object' },
|
|
@@ -290,7 +321,7 @@ const ConfigStyleguide: NodeType = {
|
|
|
290
321
|
oas3_0Decorators: { type: 'object' },
|
|
291
322
|
oas3_1Decorators: { type: 'object' },
|
|
292
323
|
async2Decorators: { type: 'object' },
|
|
293
|
-
|
|
324
|
+
arazzo1Decorators: { type: 'object' },
|
|
294
325
|
},
|
|
295
326
|
};
|
|
296
327
|
|
package/src/typings/arazzo.ts
CHANGED
|
@@ -12,22 +12,13 @@ export interface OpenAPISourceDescription {
|
|
|
12
12
|
'x-serverUrl'?: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export interface NoneSourceDescription {
|
|
16
|
-
name: string;
|
|
17
|
-
type: 'none';
|
|
18
|
-
'x-serverUrl': string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
15
|
export interface ArazzoSourceDescription {
|
|
22
16
|
name: string;
|
|
23
17
|
type: 'arazzo';
|
|
24
18
|
url: string;
|
|
25
19
|
}
|
|
26
20
|
|
|
27
|
-
export type SourceDescription =
|
|
28
|
-
| OpenAPISourceDescription
|
|
29
|
-
| NoneSourceDescription
|
|
30
|
-
| ArazzoSourceDescription;
|
|
21
|
+
export type SourceDescription = OpenAPISourceDescription | ArazzoSourceDescription;
|
|
31
22
|
|
|
32
23
|
export interface Parameter {
|
|
33
24
|
in?: 'header' | 'query' | 'path' | 'cookie' | 'body';
|
package/src/utils.ts
CHANGED
|
@@ -244,14 +244,16 @@ export function doesYamlFileExist(filePath: string): boolean {
|
|
|
244
244
|
export function showWarningForDeprecatedField(
|
|
245
245
|
deprecatedField: string,
|
|
246
246
|
updatedField?: string,
|
|
247
|
-
updatedObject?: string
|
|
247
|
+
updatedObject?: string,
|
|
248
|
+
link?: string
|
|
248
249
|
) {
|
|
250
|
+
const readMoreText = link ? `Read more about this change: ${link}` : '';
|
|
249
251
|
logger.warn(
|
|
250
252
|
`The '${colorize.red(deprecatedField)}' field is deprecated. ${
|
|
251
253
|
updatedField
|
|
252
254
|
? `Use ${colorize.green(getUpdatedFieldName(updatedField, updatedObject))} instead. `
|
|
253
255
|
: ''
|
|
254
|
-
}
|
|
256
|
+
}${readMoreText}\n`
|
|
255
257
|
);
|
|
256
258
|
}
|
|
257
259
|
|
package/src/visitors.ts
CHANGED
|
@@ -57,7 +57,6 @@ import type {
|
|
|
57
57
|
CriteriaObject,
|
|
58
58
|
ExtendedOperation,
|
|
59
59
|
InfoObject,
|
|
60
|
-
NoneSourceDescription,
|
|
61
60
|
OnFailureObject,
|
|
62
61
|
OnSuccessObject,
|
|
63
62
|
OpenAPISourceDescription,
|
|
@@ -239,7 +238,6 @@ type ArazzoFlatVisitor = {
|
|
|
239
238
|
ParameterObject?: VisitFunctionOrObject<Parameter>;
|
|
240
239
|
InfoObject?: VisitFunctionOrObject<InfoObject>;
|
|
241
240
|
OpenAPISourceDescription?: VisitFunctionOrObject<OpenAPISourceDescription>;
|
|
242
|
-
NoneSourceDescription?: VisitFunctionOrObject<NoneSourceDescription>;
|
|
243
241
|
ArazzoSourceDescription?: VisitFunctionOrObject<ArazzoSourceDescription>;
|
|
244
242
|
SourceDescription?: VisitFunctionOrObject<SourceDescription>;
|
|
245
243
|
ExtendedOperation?: VisitFunctionOrObject<ExtendedOperation>;
|
|
@@ -319,7 +317,7 @@ export type Async3Visitor = BaseVisitor &
|
|
|
319
317
|
Async3NestedVisitor &
|
|
320
318
|
Record<string, VisitFunction<any> | NestedVisitObject<any, Async3NestedVisitor>>;
|
|
321
319
|
|
|
322
|
-
export type
|
|
320
|
+
export type Arazzo1Visitor = BaseVisitor &
|
|
323
321
|
ArazzoNestedVisitor &
|
|
324
322
|
Record<string, VisitFunction<any> | NestedVisitObject<any, ArazzoNestedVisitor>>;
|
|
325
323
|
|
|
@@ -346,17 +344,17 @@ export type Oas3Rule = (options: Record<string, any>) => Oas3Visitor | Oas3Visit
|
|
|
346
344
|
export type Oas2Rule = (options: Record<string, any>) => Oas2Visitor | Oas2Visitor[];
|
|
347
345
|
export type Async2Rule = (options: Record<string, any>) => Async2Visitor | Async2Visitor[];
|
|
348
346
|
export type Async3Rule = (options: Record<string, any>) => Async3Visitor | Async3Visitor[];
|
|
349
|
-
export type
|
|
347
|
+
export type Arazzo1Rule = (options: Record<string, any>) => Arazzo1Visitor | Arazzo1Visitor[];
|
|
350
348
|
export type Oas3Preprocessor = (options: Record<string, any>) => Oas3Visitor;
|
|
351
349
|
export type Oas2Preprocessor = (options: Record<string, any>) => Oas2Visitor;
|
|
352
350
|
export type Async2Preprocessor = (options: Record<string, any>) => Async2Visitor;
|
|
353
351
|
export type Async3Preprocessor = (options: Record<string, any>) => Async3Visitor;
|
|
354
|
-
export type
|
|
352
|
+
export type Arazzo1Preprocessor = (options: Record<string, any>) => Arazzo1Visitor;
|
|
355
353
|
export type Oas3Decorator = (options: Record<string, any>) => Oas3Visitor;
|
|
356
354
|
export type Oas2Decorator = (options: Record<string, any>) => Oas2Visitor;
|
|
357
355
|
export type Async2Decorator = (options: Record<string, any>) => Async2Visitor;
|
|
358
356
|
export type Async3Decorator = (options: Record<string, any>) => Async3Visitor;
|
|
359
|
-
export type
|
|
357
|
+
export type Arazzo1Decorator = (options: Record<string, any>) => Arazzo1Visitor;
|
|
360
358
|
|
|
361
359
|
// alias for the latest version supported
|
|
362
360
|
// every time we update it - consider semver
|