@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
|
@@ -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,14 +140,14 @@ 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',
|
|
@@ -127,15 +158,16 @@ const builtInArazzoRules = [
|
|
|
127
158
|
'criteria-unique',
|
|
128
159
|
] as const;
|
|
129
160
|
|
|
130
|
-
export type
|
|
161
|
+
export type BuiltInArazzo1RuleId = typeof builtInArazzo1Rules[number];
|
|
131
162
|
|
|
132
163
|
const builtInRules = [
|
|
133
|
-
...builtInCommonOASRules,
|
|
134
164
|
...builtInOAS2Rules,
|
|
135
165
|
...builtInOAS3Rules,
|
|
136
166
|
...builtInAsync2Rules,
|
|
137
167
|
...builtInAsync3Rules,
|
|
138
|
-
...
|
|
168
|
+
...builtInArazzo1Rules,
|
|
169
|
+
'spec', // TODO: depricated in favor of struct
|
|
170
|
+
'struct',
|
|
139
171
|
] as const;
|
|
140
172
|
|
|
141
173
|
type BuiltInRuleId = typeof builtInRules[number];
|
|
@@ -278,7 +310,7 @@ const ConfigStyleguide: NodeType = {
|
|
|
278
310
|
oas3_0Rules: 'Rules',
|
|
279
311
|
oas3_1Rules: 'Rules',
|
|
280
312
|
async2Rules: 'Rules',
|
|
281
|
-
|
|
313
|
+
arazzo1Rules: 'Rules',
|
|
282
314
|
preprocessors: { type: 'object' },
|
|
283
315
|
oas2Preprocessors: { type: 'object' },
|
|
284
316
|
oas3_0Preprocessors: { type: 'object' },
|
|
@@ -290,7 +322,7 @@ const ConfigStyleguide: NodeType = {
|
|
|
290
322
|
oas3_0Decorators: { type: 'object' },
|
|
291
323
|
oas3_1Decorators: { type: 'object' },
|
|
292
324
|
async2Decorators: { type: 'object' },
|
|
293
|
-
|
|
325
|
+
arazzo1Decorators: { type: 'object' },
|
|
294
326
|
},
|
|
295
327
|
};
|
|
296
328
|
|
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
|