@redocly/openapi-core 1.25.14 → 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 +18 -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 -27
- package/lib/types/redocly-yaml.d.ts +6 -8
- package/lib/types/redocly-yaml.js +47 -12
- package/lib/typings/arazzo.d.ts +1 -15
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +3 -2
- package/lib/visitors.d.ts +5 -7
- package/package.json +2 -2
- 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 -25
- package/src/types/redocly-yaml.ts +48 -16
- package/src/typings/arazzo.ts +1 -20
- package/src/utils.ts +4 -2
- package/src/visitors.ts +4 -8
- 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';
|
|
@@ -59,15 +50,6 @@ export interface ExtendedOperation {
|
|
|
59
50
|
| 'CONNECT';
|
|
60
51
|
}
|
|
61
52
|
|
|
62
|
-
export interface ExpectSchema {
|
|
63
|
-
statusCode?: number;
|
|
64
|
-
mimeType?: string;
|
|
65
|
-
body?: any;
|
|
66
|
-
schema?: {
|
|
67
|
-
[key: string]: any;
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
53
|
export interface Replacement {
|
|
72
54
|
target: string;
|
|
73
55
|
value: string | object | any[];
|
|
@@ -129,7 +111,6 @@ export interface Step {
|
|
|
129
111
|
outputs?: {
|
|
130
112
|
[key: string]: string | object | any[] | boolean | number;
|
|
131
113
|
};
|
|
132
|
-
'x-expect'?: ExpectSchema;
|
|
133
114
|
'x-operation'?: ExtendedOperation;
|
|
134
115
|
requestBody?: RequestBody;
|
|
135
116
|
}
|
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
|
@@ -55,10 +55,8 @@ import type {
|
|
|
55
55
|
ArazzoDefinition,
|
|
56
56
|
ArazzoSourceDescription,
|
|
57
57
|
CriteriaObject,
|
|
58
|
-
ExpectSchema,
|
|
59
58
|
ExtendedOperation,
|
|
60
59
|
InfoObject,
|
|
61
|
-
NoneSourceDescription,
|
|
62
60
|
OnFailureObject,
|
|
63
61
|
OnSuccessObject,
|
|
64
62
|
OpenAPISourceDescription,
|
|
@@ -240,11 +238,9 @@ type ArazzoFlatVisitor = {
|
|
|
240
238
|
ParameterObject?: VisitFunctionOrObject<Parameter>;
|
|
241
239
|
InfoObject?: VisitFunctionOrObject<InfoObject>;
|
|
242
240
|
OpenAPISourceDescription?: VisitFunctionOrObject<OpenAPISourceDescription>;
|
|
243
|
-
NoneSourceDescription?: VisitFunctionOrObject<NoneSourceDescription>;
|
|
244
241
|
ArazzoSourceDescription?: VisitFunctionOrObject<ArazzoSourceDescription>;
|
|
245
242
|
SourceDescription?: VisitFunctionOrObject<SourceDescription>;
|
|
246
243
|
ExtendedOperation?: VisitFunctionOrObject<ExtendedOperation>;
|
|
247
|
-
ExpectSchema?: VisitFunctionOrObject<ExpectSchema>;
|
|
248
244
|
Replacement?: VisitFunctionOrObject<Replacement>;
|
|
249
245
|
RequestBody?: VisitFunctionOrObject<RequestBody>;
|
|
250
246
|
CriteriaObject?: VisitFunctionOrObject<CriteriaObject>;
|
|
@@ -321,7 +317,7 @@ export type Async3Visitor = BaseVisitor &
|
|
|
321
317
|
Async3NestedVisitor &
|
|
322
318
|
Record<string, VisitFunction<any> | NestedVisitObject<any, Async3NestedVisitor>>;
|
|
323
319
|
|
|
324
|
-
export type
|
|
320
|
+
export type Arazzo1Visitor = BaseVisitor &
|
|
325
321
|
ArazzoNestedVisitor &
|
|
326
322
|
Record<string, VisitFunction<any> | NestedVisitObject<any, ArazzoNestedVisitor>>;
|
|
327
323
|
|
|
@@ -348,17 +344,17 @@ export type Oas3Rule = (options: Record<string, any>) => Oas3Visitor | Oas3Visit
|
|
|
348
344
|
export type Oas2Rule = (options: Record<string, any>) => Oas2Visitor | Oas2Visitor[];
|
|
349
345
|
export type Async2Rule = (options: Record<string, any>) => Async2Visitor | Async2Visitor[];
|
|
350
346
|
export type Async3Rule = (options: Record<string, any>) => Async3Visitor | Async3Visitor[];
|
|
351
|
-
export type
|
|
347
|
+
export type Arazzo1Rule = (options: Record<string, any>) => Arazzo1Visitor | Arazzo1Visitor[];
|
|
352
348
|
export type Oas3Preprocessor = (options: Record<string, any>) => Oas3Visitor;
|
|
353
349
|
export type Oas2Preprocessor = (options: Record<string, any>) => Oas2Visitor;
|
|
354
350
|
export type Async2Preprocessor = (options: Record<string, any>) => Async2Visitor;
|
|
355
351
|
export type Async3Preprocessor = (options: Record<string, any>) => Async3Visitor;
|
|
356
|
-
export type
|
|
352
|
+
export type Arazzo1Preprocessor = (options: Record<string, any>) => Arazzo1Visitor;
|
|
357
353
|
export type Oas3Decorator = (options: Record<string, any>) => Oas3Visitor;
|
|
358
354
|
export type Oas2Decorator = (options: Record<string, any>) => Oas2Visitor;
|
|
359
355
|
export type Async2Decorator = (options: Record<string, any>) => Async2Visitor;
|
|
360
356
|
export type Async3Decorator = (options: Record<string, any>) => Async3Visitor;
|
|
361
|
-
export type
|
|
357
|
+
export type Arazzo1Decorator = (options: Record<string, any>) => Arazzo1Visitor;
|
|
362
358
|
|
|
363
359
|
// alias for the latest version supported
|
|
364
360
|
// every time we update it - consider semver
|