@redocly/openapi-core 1.0.0-beta.101 → 1.0.0-beta.104
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/lib/config/config.d.ts +3 -3
- package/lib/config/load.d.ts +1 -1
- package/lib/config/load.js +15 -2
- package/lib/config/rules.d.ts +1 -1
- package/lib/config/types.d.ts +4 -2
- package/lib/decorators/common/filters/filter-helper.d.ts +3 -0
- package/lib/decorators/common/filters/filter-helper.js +67 -0
- package/lib/decorators/common/filters/filter-in.d.ts +2 -0
- package/lib/decorators/common/filters/filter-in.js +17 -0
- package/lib/decorators/common/filters/filter-out.d.ts +2 -0
- package/lib/decorators/common/filters/filter-out.js +17 -0
- package/lib/decorators/oas2/index.d.ts +2 -0
- package/lib/decorators/oas2/index.js +5 -1
- package/lib/decorators/oas3/index.d.ts +2 -0
- package/lib/decorators/oas3/index.js +5 -1
- package/lib/index.d.ts +1 -1
- package/lib/lint.d.ts +2 -0
- package/lib/lint.js +2 -2
- package/lib/redocly/registry-api-types.d.ts +2 -0
- package/lib/redocly/registry-api.d.ts +1 -1
- package/lib/redocly/registry-api.js +3 -1
- package/lib/rules/ajv.d.ts +1 -1
- package/lib/rules/ajv.js +1 -1
- package/lib/rules/common/assertions/asserts.d.ts +6 -1
- package/lib/rules/common/assertions/asserts.js +81 -51
- package/lib/rules/common/assertions/utils.d.ts +2 -1
- package/lib/rules/common/assertions/utils.js +27 -8
- package/lib/types/redocly-yaml.js +317 -27
- package/lib/utils.d.ts +2 -1
- package/lib/utils.js +5 -1
- package/lib/walk.d.ts +4 -14
- package/lib/walk.js +35 -26
- package/package.json +3 -2
- package/src/__tests__/lint.test.ts +17 -4
- package/src/config/__tests__/load.test.ts +6 -0
- package/src/config/load.ts +28 -5
- package/src/config/types.ts +6 -5
- package/src/decorators/__tests__/filter-in.test.ts +310 -0
- package/src/decorators/__tests__/filter-out.test.ts +331 -0
- package/src/decorators/common/filters/filter-helper.ts +72 -0
- package/src/decorators/common/filters/filter-in.ts +18 -0
- package/src/decorators/common/filters/filter-out.ts +18 -0
- package/src/decorators/oas2/index.ts +5 -1
- package/src/decorators/oas3/index.ts +5 -1
- package/src/index.ts +1 -0
- package/src/lint.ts +4 -3
- package/src/redocly/registry-api-types.ts +2 -0
- package/src/redocly/registry-api.ts +4 -0
- package/src/rules/ajv.ts +4 -4
- package/src/rules/common/assertions/__tests__/asserts.test.ts +149 -146
- package/src/rules/common/assertions/asserts.ts +97 -52
- package/src/rules/common/assertions/utils.ts +41 -16
- package/src/types/redocly-yaml.ts +322 -34
- package/src/utils.ts +10 -7
- package/src/walk.ts +59 -47
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isRef } from '../../../ref-utils';
|
|
1
|
+
import { isRef, Location } from '../../../ref-utils';
|
|
2
2
|
import { Problem, ProblemSeverity, UserContext } from '../../../walk';
|
|
3
3
|
import { asserts } from './asserts';
|
|
4
4
|
|
|
@@ -23,7 +23,7 @@ export type AssertToApply = {
|
|
|
23
23
|
export function buildVisitorObject(
|
|
24
24
|
subject: string,
|
|
25
25
|
context: Record<string, any>[],
|
|
26
|
-
subjectVisitor: any
|
|
26
|
+
subjectVisitor: any
|
|
27
27
|
) {
|
|
28
28
|
if (!context) {
|
|
29
29
|
return { [subject]: subjectVisitor };
|
|
@@ -46,7 +46,7 @@ export function buildVisitorObject(
|
|
|
46
46
|
|
|
47
47
|
if (matchParentKeys && excludeParentKeys) {
|
|
48
48
|
throw new Error(
|
|
49
|
-
`Both 'matchParentKeys' and 'excludeParentKeys' can't be under one context item
|
|
49
|
+
`Both 'matchParentKeys' and 'excludeParentKeys' can't be under one context item`
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -75,9 +75,12 @@ export function buildVisitorObject(
|
|
|
75
75
|
export function buildSubjectVisitor(
|
|
76
76
|
properties: string | string[],
|
|
77
77
|
asserts: AssertToApply[],
|
|
78
|
-
context?: Record<string, any>[]
|
|
78
|
+
context?: Record<string, any>[]
|
|
79
79
|
) {
|
|
80
|
-
return
|
|
80
|
+
return (
|
|
81
|
+
node: any,
|
|
82
|
+
{ report, location, rawLocation, key, type, resolve, rawNode }: UserContext
|
|
83
|
+
) => {
|
|
81
84
|
// We need to check context's last node if it has the same type as subject node;
|
|
82
85
|
// if yes - that means we didn't create context's last node visitor,
|
|
83
86
|
// so we need to handle 'matchParentKeys' and 'excludeParentKeys' conditions here;
|
|
@@ -101,14 +104,28 @@ export function buildSubjectVisitor(
|
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
for (const assert of asserts) {
|
|
107
|
+
const currentLocation = assert.name === 'ref' ? rawLocation : location;
|
|
104
108
|
if (properties) {
|
|
105
109
|
for (const property of properties) {
|
|
106
110
|
// we can have resolvable scalar so need to resolve value here.
|
|
107
111
|
const value = isRef(node[property]) ? resolve(node[property])?.node : node[property];
|
|
108
|
-
runAssertion(
|
|
112
|
+
runAssertion({
|
|
113
|
+
values: value,
|
|
114
|
+
rawValues: rawNode[property],
|
|
115
|
+
assert,
|
|
116
|
+
location: currentLocation.child(property),
|
|
117
|
+
report,
|
|
118
|
+
});
|
|
109
119
|
}
|
|
110
120
|
} else {
|
|
111
|
-
|
|
121
|
+
const value = assert.name === 'ref' ? rawNode : Object.keys(node);
|
|
122
|
+
runAssertion({
|
|
123
|
+
values: Object.keys(node),
|
|
124
|
+
rawValues: value,
|
|
125
|
+
assert,
|
|
126
|
+
location: currentLocation,
|
|
127
|
+
report,
|
|
128
|
+
});
|
|
112
129
|
}
|
|
113
130
|
}
|
|
114
131
|
};
|
|
@@ -148,20 +165,28 @@ export function isOrdered(value: any[], options: OrderOptions | OrderDirection):
|
|
|
148
165
|
return true;
|
|
149
166
|
}
|
|
150
167
|
|
|
151
|
-
|
|
152
|
-
values: string | string[]
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
)
|
|
157
|
-
|
|
158
|
-
|
|
168
|
+
type RunAssertionParams = {
|
|
169
|
+
values: string | string[];
|
|
170
|
+
rawValues: any;
|
|
171
|
+
assert: AssertToApply;
|
|
172
|
+
location: Location;
|
|
173
|
+
report: (problem: Problem) => void;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
function runAssertion({ values, rawValues, assert, location, report }: RunAssertionParams) {
|
|
177
|
+
const lintResult = asserts[assert.name](values, assert.conditions, location, rawValues);
|
|
178
|
+
if (!lintResult.isValid) {
|
|
159
179
|
report({
|
|
160
180
|
message: assert.message || `The ${assert.assertId} doesn't meet required conditions`,
|
|
161
|
-
location,
|
|
181
|
+
location: lintResult.location || location,
|
|
162
182
|
forceSeverity: assert.severity,
|
|
163
183
|
suggest: assert.suggest,
|
|
164
184
|
ruleId: assert.assertId,
|
|
165
185
|
});
|
|
166
186
|
}
|
|
167
187
|
}
|
|
188
|
+
|
|
189
|
+
export function regexFromString(input: string): RegExp | null {
|
|
190
|
+
const matches = input.match(/^\/(.*)\/(.*)|(.*)/);
|
|
191
|
+
return matches && new RegExp(matches[1] || matches[3], matches[2]);
|
|
192
|
+
}
|
|
@@ -1,13 +1,125 @@
|
|
|
1
1
|
import { NodeType, listOf } from '.';
|
|
2
|
-
import { omitObjectProps, pickObjectProps } from '../utils';
|
|
2
|
+
import { omitObjectProps, pickObjectProps, isCustomRuleId } from '../utils';
|
|
3
|
+
const builtInRulesList = [
|
|
4
|
+
'spec',
|
|
5
|
+
'info-description',
|
|
6
|
+
'info-contact',
|
|
7
|
+
'info-license',
|
|
8
|
+
'info-license-url',
|
|
9
|
+
'operation-2xx-response',
|
|
10
|
+
'operation-4xx-response',
|
|
11
|
+
'assertions',
|
|
12
|
+
'operation-operationId-unique',
|
|
13
|
+
'operation-parameters-unique',
|
|
14
|
+
'path-parameters-defined',
|
|
15
|
+
'operation-tag-defined',
|
|
16
|
+
'no-example-value-and-externalValue',
|
|
17
|
+
'no-enum-type-mismatch',
|
|
18
|
+
'no-path-trailing-slash',
|
|
19
|
+
'no-empty-servers',
|
|
20
|
+
'path-declaration-must-exist',
|
|
21
|
+
'operation-operationId-url-safe',
|
|
22
|
+
'operation-operationId',
|
|
23
|
+
'operation-summary',
|
|
24
|
+
'tags-alphabetical',
|
|
25
|
+
'no-server-example.com',
|
|
26
|
+
'no-server-trailing-slash',
|
|
27
|
+
'tag-description',
|
|
28
|
+
'operation-description',
|
|
29
|
+
'no-unused-components',
|
|
30
|
+
'path-not-include-query',
|
|
31
|
+
'path-params-defined',
|
|
32
|
+
'parameter-description',
|
|
33
|
+
'operation-singular-tag',
|
|
34
|
+
'operation-security-defined',
|
|
35
|
+
'no-unresolved-refs',
|
|
36
|
+
'paths-kebab-case',
|
|
37
|
+
'boolean-parameter-prefixes',
|
|
38
|
+
'path-http-verbs-order',
|
|
39
|
+
'no-invalid-media-type-examples',
|
|
40
|
+
'no-identical-paths',
|
|
41
|
+
'no-ambiguous-paths',
|
|
42
|
+
'no-undefined-server-variable',
|
|
43
|
+
'no-servers-empty-enum',
|
|
44
|
+
'no-http-verbs-in-paths',
|
|
45
|
+
'path-excludes-patterns',
|
|
46
|
+
'request-mime-type',
|
|
47
|
+
'response-mime-type',
|
|
48
|
+
'path-segment-plural',
|
|
49
|
+
'no-invalid-schema-examples',
|
|
50
|
+
'no-invalid-parameter-examples',
|
|
51
|
+
'response-contains-header',
|
|
52
|
+
'response-contains-property',
|
|
53
|
+
'scalar-property-missing-example',
|
|
54
|
+
];
|
|
55
|
+
const nodeTypesList = [
|
|
56
|
+
'DefinitionRoot',
|
|
57
|
+
'Tag',
|
|
58
|
+
'ExternalDocs',
|
|
59
|
+
'Server',
|
|
60
|
+
'ServerVariable',
|
|
61
|
+
'SecurityRequirement',
|
|
62
|
+
'Info',
|
|
63
|
+
'Contact',
|
|
64
|
+
'License',
|
|
65
|
+
'PathMap',
|
|
66
|
+
'PathItem',
|
|
67
|
+
'Parameter',
|
|
68
|
+
'Operation',
|
|
69
|
+
'Callback',
|
|
70
|
+
'RequestBody',
|
|
71
|
+
'MediaTypeMap',
|
|
72
|
+
'MediaType',
|
|
73
|
+
'Example',
|
|
74
|
+
'Encoding',
|
|
75
|
+
'Header',
|
|
76
|
+
'ResponsesMap',
|
|
77
|
+
'Response',
|
|
78
|
+
'Link',
|
|
79
|
+
'Schema',
|
|
80
|
+
'Xml',
|
|
81
|
+
'SchemaProperties',
|
|
82
|
+
'DiscriminatorMapping',
|
|
83
|
+
'Discriminator',
|
|
84
|
+
'Components',
|
|
85
|
+
'NamedSchemas',
|
|
86
|
+
'NamedResponses',
|
|
87
|
+
'NamedParameters',
|
|
88
|
+
'NamedExamples',
|
|
89
|
+
'NamedRequestBodies',
|
|
90
|
+
'NamedHeaders',
|
|
91
|
+
'NamedSecuritySchemes',
|
|
92
|
+
'NamedLinks',
|
|
93
|
+
'NamedCallbacks',
|
|
94
|
+
'ImplicitFlow',
|
|
95
|
+
'PasswordFlow',
|
|
96
|
+
'ClientCredentials',
|
|
97
|
+
'AuthorizationCode',
|
|
98
|
+
'SecuritySchemeFlows',
|
|
99
|
+
'SecurityScheme',
|
|
100
|
+
'XCodeSample',
|
|
101
|
+
'WebhooksMap',
|
|
102
|
+
];
|
|
3
103
|
|
|
4
104
|
const ConfigRoot: NodeType = {
|
|
5
105
|
properties: {
|
|
6
106
|
organization: { type: 'string' },
|
|
7
107
|
apis: 'ConfigApis',
|
|
108
|
+
apiDefinitions: {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {},
|
|
111
|
+
additionalProperties: { properties: { type: 'string' } },
|
|
112
|
+
}, // deprecated
|
|
8
113
|
lint: 'RootConfigLint',
|
|
9
114
|
'features.openapi': 'ConfigReferenceDocs',
|
|
115
|
+
referenceDocs: 'ConfigReferenceDocs', // deprecated
|
|
10
116
|
'features.mockServer': 'ConfigMockServer',
|
|
117
|
+
region: { enum: ['us', 'eu'] },
|
|
118
|
+
resolve: {
|
|
119
|
+
properties: {
|
|
120
|
+
http: 'ConfigHTTP',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
11
123
|
},
|
|
12
124
|
};
|
|
13
125
|
|
|
@@ -19,9 +131,17 @@ const ConfigApis: NodeType = {
|
|
|
19
131
|
const ConfigApisProperties: NodeType = {
|
|
20
132
|
properties: {
|
|
21
133
|
root: { type: 'string' },
|
|
134
|
+
labels: {
|
|
135
|
+
type: 'array',
|
|
136
|
+
items: {
|
|
137
|
+
type: 'string',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
22
140
|
lint: 'ConfigLint',
|
|
23
141
|
'features.openapi': 'ConfigReferenceDocs',
|
|
142
|
+
'features.mockServer': 'ConfigMockServer',
|
|
24
143
|
},
|
|
144
|
+
required: ['root'],
|
|
25
145
|
};
|
|
26
146
|
|
|
27
147
|
const ConfigHTTP: NodeType = {
|
|
@@ -44,10 +164,10 @@ const ConfigLint: NodeType = {
|
|
|
44
164
|
},
|
|
45
165
|
},
|
|
46
166
|
doNotResolveExamples: { type: 'boolean' },
|
|
47
|
-
rules:
|
|
48
|
-
oas2Rules:
|
|
49
|
-
oas3_0Rules:
|
|
50
|
-
oas3_1Rules:
|
|
167
|
+
rules: 'Rules',
|
|
168
|
+
oas2Rules: 'Rules',
|
|
169
|
+
oas3_0Rules: 'Rules',
|
|
170
|
+
oas3_1Rules: 'Rules',
|
|
51
171
|
preprocessors: { type: 'object' },
|
|
52
172
|
oas2Preprocessors: { type: 'object' },
|
|
53
173
|
oas3_0Preprocessors: { type: 'object' },
|
|
@@ -56,11 +176,6 @@ const ConfigLint: NodeType = {
|
|
|
56
176
|
oas2Decorators: { type: 'object' },
|
|
57
177
|
oas3_0Decorators: { type: 'object' },
|
|
58
178
|
oas3_1Decorators: { type: 'object' },
|
|
59
|
-
resolve: {
|
|
60
|
-
properties: {
|
|
61
|
-
http: 'ConfigHTTP',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
179
|
},
|
|
65
180
|
};
|
|
66
181
|
|
|
@@ -74,11 +189,111 @@ const RootConfigLint: NodeType = {
|
|
|
74
189
|
},
|
|
75
190
|
};
|
|
76
191
|
|
|
192
|
+
const Rules: NodeType = {
|
|
193
|
+
properties: {},
|
|
194
|
+
additionalProperties: (value: unknown, key: string) => {
|
|
195
|
+
if (key.startsWith('assert/')) {
|
|
196
|
+
return 'Assert';
|
|
197
|
+
} else if (builtInRulesList.includes(key) || isCustomRuleId(key)) {
|
|
198
|
+
if (typeof value === 'string') {
|
|
199
|
+
return { enum: ['error', 'warn', 'off'] };
|
|
200
|
+
} else {
|
|
201
|
+
return 'ObjectRule';
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// Otherwise is considered as invalid
|
|
205
|
+
return;
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const ObjectRule: NodeType = {
|
|
210
|
+
properties: {
|
|
211
|
+
severity: { enum: ['error', 'warn', 'off'] },
|
|
212
|
+
},
|
|
213
|
+
additionalProperties: {},
|
|
214
|
+
required: ['severity'],
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
const Assert: NodeType = {
|
|
218
|
+
properties: {
|
|
219
|
+
subject: (value: unknown) => {
|
|
220
|
+
if (Array.isArray(value)) {
|
|
221
|
+
return { type: 'array', items: { enum: nodeTypesList } };
|
|
222
|
+
} else {
|
|
223
|
+
return { enum: nodeTypesList };
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
property: (value: unknown) => {
|
|
227
|
+
if (Array.isArray(value)) {
|
|
228
|
+
return { type: 'array', items: { type: 'string' } };
|
|
229
|
+
} else if (value === null) {
|
|
230
|
+
return null;
|
|
231
|
+
} else {
|
|
232
|
+
return { type: 'string' };
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
context: listOf('Context'),
|
|
236
|
+
message: { type: 'string' },
|
|
237
|
+
suggest: { type: 'array', items: { type: 'string' } },
|
|
238
|
+
severity: { enum: ['error', 'warn', 'off'] },
|
|
239
|
+
enum: { type: 'array', items: { type: 'string' } },
|
|
240
|
+
pattern: { type: 'string' },
|
|
241
|
+
casing: {
|
|
242
|
+
enum: [
|
|
243
|
+
'camelCase',
|
|
244
|
+
'kebab-case',
|
|
245
|
+
'snake_case',
|
|
246
|
+
'PascalCase',
|
|
247
|
+
'MACRO_CASE',
|
|
248
|
+
'COBOL-CASE',
|
|
249
|
+
'flatcase',
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
mutuallyExclusive: { type: 'array', items: { type: 'string' } },
|
|
253
|
+
mutuallyRequired: { type: 'array', items: { type: 'string' } },
|
|
254
|
+
required: { type: 'array', items: { type: 'string' } },
|
|
255
|
+
requireAny: { type: 'array', items: { type: 'string' } },
|
|
256
|
+
disallowed: { type: 'array', items: { type: 'string' } },
|
|
257
|
+
defined: { type: 'boolean' },
|
|
258
|
+
undefined: { type: 'boolean' },
|
|
259
|
+
nonEmpty: { type: 'boolean' },
|
|
260
|
+
minLength: { type: 'integer' },
|
|
261
|
+
maxLength: { type: 'integer' },
|
|
262
|
+
ref: (value: string | boolean) =>
|
|
263
|
+
typeof value === 'string' ? { type: 'string' } : { type: 'boolean' },
|
|
264
|
+
},
|
|
265
|
+
required: ['subject'],
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
const Context: NodeType = {
|
|
269
|
+
properties: {
|
|
270
|
+
type: { enum: nodeTypesList },
|
|
271
|
+
matchParentKeys: { type: 'array', items: { type: 'string' } },
|
|
272
|
+
excludeParentKeys: { type: 'array', items: { type: 'string' } },
|
|
273
|
+
},
|
|
274
|
+
required: ['type'],
|
|
275
|
+
};
|
|
276
|
+
|
|
77
277
|
const ConfigLanguage: NodeType = {
|
|
78
278
|
properties: {
|
|
79
279
|
label: { type: 'string' },
|
|
80
|
-
lang: {
|
|
280
|
+
lang: {
|
|
281
|
+
enum: [
|
|
282
|
+
'curl',
|
|
283
|
+
'C#',
|
|
284
|
+
'Go',
|
|
285
|
+
'Java',
|
|
286
|
+
'Java8+Apache',
|
|
287
|
+
'JavaScript',
|
|
288
|
+
'Node.js',
|
|
289
|
+
'PHP',
|
|
290
|
+
'Python',
|
|
291
|
+
'R',
|
|
292
|
+
'Ruby',
|
|
293
|
+
],
|
|
294
|
+
},
|
|
81
295
|
},
|
|
296
|
+
required: ['lang'],
|
|
82
297
|
};
|
|
83
298
|
|
|
84
299
|
const ConfigLabels: NodeType = {
|
|
@@ -102,11 +317,18 @@ const ConfigLabels: NodeType = {
|
|
|
102
317
|
|
|
103
318
|
const ConfigSidebarLinks: NodeType = {
|
|
104
319
|
properties: {
|
|
105
|
-
|
|
320
|
+
beforeInfo: listOf('CommonConfigSidebarLinks'),
|
|
321
|
+
end: listOf('CommonConfigSidebarLinks'),
|
|
322
|
+
},
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
const CommonConfigSidebarLinks: NodeType = {
|
|
326
|
+
properties: {
|
|
106
327
|
label: { type: 'string' },
|
|
107
328
|
link: { type: 'string' },
|
|
108
329
|
target: { type: 'string' },
|
|
109
330
|
},
|
|
331
|
+
required: ['label', 'link'],
|
|
110
332
|
};
|
|
111
333
|
|
|
112
334
|
const CommonThemeColors: NodeType = {
|
|
@@ -147,7 +369,7 @@ const HttpColors: NodeType = {
|
|
|
147
369
|
|
|
148
370
|
const ResponseColors: NodeType = {
|
|
149
371
|
properties: {
|
|
150
|
-
|
|
372
|
+
error: 'CommonColorProps',
|
|
151
373
|
info: 'CommonColorProps',
|
|
152
374
|
redirect: 'CommonColorProps',
|
|
153
375
|
success: 'CommonColorProps',
|
|
@@ -242,12 +464,15 @@ const HttpBadgesConfig: NodeType = {
|
|
|
242
464
|
const LabelControls: NodeType = {
|
|
243
465
|
properties: {
|
|
244
466
|
top: { type: 'string' },
|
|
467
|
+
width: { type: 'string' },
|
|
468
|
+
height: { type: 'string' },
|
|
245
469
|
},
|
|
246
470
|
};
|
|
247
471
|
|
|
248
472
|
const Panels: NodeType = {
|
|
249
473
|
properties: {
|
|
250
474
|
borderRadius: { type: 'string' },
|
|
475
|
+
backgroundColor: { type: 'string' },
|
|
251
476
|
},
|
|
252
477
|
};
|
|
253
478
|
|
|
@@ -285,6 +510,7 @@ const StackedConfig: NodeType = {
|
|
|
285
510
|
const ThreePanelConfig: NodeType = {
|
|
286
511
|
properties: {
|
|
287
512
|
maxWidth: 'Breakpoints',
|
|
513
|
+
middlePanelMaxWidth: 'Breakpoints',
|
|
288
514
|
},
|
|
289
515
|
};
|
|
290
516
|
|
|
@@ -378,7 +604,18 @@ const CodeConfig: NodeType = {
|
|
|
378
604
|
...FontConfig.properties,
|
|
379
605
|
backgroundColor: { type: 'string' },
|
|
380
606
|
color: { type: 'string' },
|
|
381
|
-
wordBreak: {
|
|
607
|
+
wordBreak: {
|
|
608
|
+
enum: [
|
|
609
|
+
'break-all',
|
|
610
|
+
'break-word',
|
|
611
|
+
'keep-all',
|
|
612
|
+
'normal',
|
|
613
|
+
'revert',
|
|
614
|
+
'unset',
|
|
615
|
+
'inherit',
|
|
616
|
+
'initial',
|
|
617
|
+
],
|
|
618
|
+
},
|
|
382
619
|
wrap: { type: 'boolean' },
|
|
383
620
|
},
|
|
384
621
|
};
|
|
@@ -413,7 +650,7 @@ const Typography: NodeType = {
|
|
|
413
650
|
links: 'LinksConfig',
|
|
414
651
|
optimizeSpeed: { type: 'boolean' },
|
|
415
652
|
rightPanelHeading: 'Heading',
|
|
416
|
-
smoothing: {
|
|
653
|
+
smoothing: { enum: ['auto', 'none', 'antialiased', 'subpixel-antialiased', 'grayscale'] },
|
|
417
654
|
},
|
|
418
655
|
};
|
|
419
656
|
|
|
@@ -440,6 +677,13 @@ const Logo: NodeType = {
|
|
|
440
677
|
},
|
|
441
678
|
};
|
|
442
679
|
|
|
680
|
+
const Fab: NodeType = {
|
|
681
|
+
properties: {
|
|
682
|
+
backgroundColor: { type: 'string' },
|
|
683
|
+
color: { type: 'string' },
|
|
684
|
+
},
|
|
685
|
+
};
|
|
686
|
+
|
|
443
687
|
const ButtonOverrides: NodeType = {
|
|
444
688
|
properties: {
|
|
445
689
|
custom: { type: 'string' },
|
|
@@ -484,6 +728,7 @@ const ConfigTheme: NodeType = {
|
|
|
484
728
|
components: 'Components',
|
|
485
729
|
layout: 'Layout',
|
|
486
730
|
logo: 'Logo',
|
|
731
|
+
fab: 'Fab',
|
|
487
732
|
overrides: 'Overrides',
|
|
488
733
|
rightPanel: 'RightPanel',
|
|
489
734
|
schema: 'Schema',
|
|
@@ -491,8 +736,8 @@ const ConfigTheme: NodeType = {
|
|
|
491
736
|
sidebar: 'Sidebar',
|
|
492
737
|
spacing: 'ThemeSpacing',
|
|
493
738
|
typography: 'Typography',
|
|
494
|
-
links: { properties: { color: { type: 'string' } } },
|
|
495
|
-
codeSample: { properties: { backgroundColor: { type: 'string' } } },
|
|
739
|
+
links: { properties: { color: { type: 'string' } } }, // deprecated
|
|
740
|
+
codeSample: { properties: { backgroundColor: { type: 'string' } } }, // deprecated
|
|
496
741
|
},
|
|
497
742
|
};
|
|
498
743
|
|
|
@@ -501,6 +746,7 @@ const GenerateCodeSamples: NodeType = {
|
|
|
501
746
|
skipOptionalParameters: { type: 'boolean' },
|
|
502
747
|
languages: listOf('ConfigLanguage'),
|
|
503
748
|
},
|
|
749
|
+
required: ['languages'],
|
|
504
750
|
};
|
|
505
751
|
|
|
506
752
|
const ConfigReferenceDocs: NodeType = {
|
|
@@ -515,8 +761,8 @@ const ConfigReferenceDocs: NodeType = {
|
|
|
515
761
|
downloadDefinitionUrl: { type: 'string' },
|
|
516
762
|
expandDefaultServerVariables: { type: 'boolean' },
|
|
517
763
|
enumSkipQuotes: { type: 'boolean' },
|
|
518
|
-
expandDefaultRequest: { type: 'boolean'},
|
|
519
|
-
expandDefaultResponse: { type: 'boolean'},
|
|
764
|
+
expandDefaultRequest: { type: 'boolean' },
|
|
765
|
+
expandDefaultResponse: { type: 'boolean' },
|
|
520
766
|
expandResponses: { type: 'string' },
|
|
521
767
|
expandSingleSchemaField: { type: 'boolean' },
|
|
522
768
|
generateCodeSamples: 'GenerateCodeSamples',
|
|
@@ -527,43 +773,77 @@ const ConfigReferenceDocs: NodeType = {
|
|
|
527
773
|
hideLoading: { type: 'boolean' },
|
|
528
774
|
hideLogo: { type: 'boolean' },
|
|
529
775
|
hideRequestPayloadSample: { type: 'boolean' },
|
|
776
|
+
hideRightPanel: { type: 'boolean' },
|
|
530
777
|
hideSchemaPattern: { type: 'boolean' },
|
|
531
778
|
hideSchemaTitles: { type: 'boolean' },
|
|
532
779
|
hideSingleRequestSampleTab: { type: 'boolean' },
|
|
780
|
+
hideSecuritySection: { type: 'boolean' },
|
|
533
781
|
hideTryItPanel: { type: 'boolean' },
|
|
534
782
|
hideFab: { type: 'boolean' },
|
|
535
|
-
hideOneOfDescription: { type: 'boolean'},
|
|
783
|
+
hideOneOfDescription: { type: 'boolean' },
|
|
536
784
|
htmlTemplate: { type: 'string' },
|
|
537
|
-
jsonSampleExpandLevel:
|
|
785
|
+
jsonSampleExpandLevel: (value: unknown) => {
|
|
786
|
+
if (typeof value === 'number') {
|
|
787
|
+
return { type: 'number', minimum: 1 };
|
|
788
|
+
} else {
|
|
789
|
+
return { type: 'string' };
|
|
790
|
+
}
|
|
791
|
+
},
|
|
538
792
|
labels: 'ConfigLabels',
|
|
539
|
-
layout: {
|
|
793
|
+
layout: { enum: ['stacked', 'three-panel'] },
|
|
540
794
|
maxDisplayedEnumValues: { type: 'number' },
|
|
541
795
|
menuToggle: { type: 'boolean' },
|
|
542
796
|
nativeScrollbars: { type: 'boolean' },
|
|
543
|
-
noAutoAuth: { type: 'boolean' },
|
|
797
|
+
noAutoAuth: { type: 'boolean' }, // deprecated
|
|
544
798
|
oAuth2RedirectURI: { type: 'string' },
|
|
545
799
|
onDeepLinkClick: { type: 'object' },
|
|
546
800
|
onlyRequiredInSamples: { type: 'boolean' },
|
|
547
|
-
pagination: {
|
|
801
|
+
pagination: { enum: ['none', 'section', 'item'] },
|
|
548
802
|
pathInMiddlePanel: { type: 'boolean' },
|
|
549
|
-
payloadSampleIdx: { type: 'number' },
|
|
803
|
+
payloadSampleIdx: { type: 'number', minimum: 0 },
|
|
550
804
|
requestInterceptor: { type: 'object' },
|
|
551
805
|
requiredPropsFirst: { type: 'boolean' },
|
|
552
806
|
routingBasePath: { type: 'string' },
|
|
807
|
+
routingStrategy: { type: 'string' }, // deprecated
|
|
553
808
|
samplesTabsMaxCount: { type: 'number' },
|
|
554
|
-
schemaExpansionLevel:
|
|
809
|
+
schemaExpansionLevel: (value: unknown) => {
|
|
810
|
+
if (typeof value === 'number') {
|
|
811
|
+
return { type: 'number', minimum: 0 };
|
|
812
|
+
} else {
|
|
813
|
+
return { type: 'string' };
|
|
814
|
+
}
|
|
815
|
+
},
|
|
555
816
|
schemaDefinitionsTagName: { type: 'string' },
|
|
556
|
-
minCharacterLengthToInitSearch: { type: 'number' },
|
|
557
|
-
maxResponseHeadersToShowInTryIt: {type: 'number'},
|
|
558
|
-
scrollYOffset:
|
|
817
|
+
minCharacterLengthToInitSearch: { type: 'number', minimum: 1 },
|
|
818
|
+
maxResponseHeadersToShowInTryIt: { type: 'number', minimum: 0 },
|
|
819
|
+
scrollYOffset: (value: unknown) => {
|
|
820
|
+
if (typeof value === 'number') {
|
|
821
|
+
return { type: 'number' };
|
|
822
|
+
} else {
|
|
823
|
+
return { type: 'string' };
|
|
824
|
+
}
|
|
825
|
+
},
|
|
559
826
|
searchAutoExpand: { type: 'boolean' },
|
|
560
|
-
searchFieldLevelBoost: { type: 'number' },
|
|
561
|
-
|
|
827
|
+
searchFieldLevelBoost: { type: 'number', minimum: 0 },
|
|
828
|
+
searchMaxDepth: { type: 'number', minimum: 1 },
|
|
829
|
+
searchMode: { enum: ['default', 'path-only'] },
|
|
562
830
|
searchOperationTitleBoost: { type: 'number' },
|
|
563
831
|
searchTagTitleBoost: { type: 'number' },
|
|
832
|
+
sendXUserAgentInTryIt: { type: 'boolean' },
|
|
564
833
|
showChangeLayoutButton: { type: 'boolean' },
|
|
565
|
-
showConsole: { type: 'boolean' },
|
|
566
|
-
showExtensions:
|
|
834
|
+
showConsole: { type: 'boolean' }, // deprecated
|
|
835
|
+
showExtensions: (value: unknown) => {
|
|
836
|
+
if (typeof value === 'boolean') {
|
|
837
|
+
return { type: 'boolean' };
|
|
838
|
+
} else {
|
|
839
|
+
return {
|
|
840
|
+
type: 'array',
|
|
841
|
+
items: {
|
|
842
|
+
type: 'string',
|
|
843
|
+
},
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
},
|
|
567
847
|
showNextButton: { type: 'boolean' },
|
|
568
848
|
showRightPanelToggle: { type: 'boolean' },
|
|
569
849
|
showSecuritySchemeType: { type: 'boolean' },
|
|
@@ -571,12 +851,14 @@ const ConfigReferenceDocs: NodeType = {
|
|
|
571
851
|
showObjectSchemaExamples: { type: 'boolean' },
|
|
572
852
|
disableTryItRequestUrlEncoding: { type: 'boolean' },
|
|
573
853
|
sidebarLinks: 'ConfigSidebarLinks',
|
|
574
|
-
sideNavStyle: {
|
|
854
|
+
sideNavStyle: { enum: ['summary-only', 'path-first', 'id-only'] },
|
|
575
855
|
simpleOneOfTypeLabel: { type: 'boolean' },
|
|
576
856
|
sortEnumValuesAlphabetically: { type: 'boolean' },
|
|
577
857
|
sortOperationsAlphabetically: { type: 'boolean' },
|
|
578
858
|
sortPropsAlphabetically: { type: 'boolean' },
|
|
579
859
|
sortTagsAlphabetically: { type: 'boolean' },
|
|
860
|
+
suppressWarnings: { type: 'boolean' }, // deprecated
|
|
861
|
+
unstable_externalDescription: { type: 'boolean' }, // deprecated
|
|
580
862
|
unstable_ignoreMimeParameters: { type: 'boolean' },
|
|
581
863
|
untrustedDefinition: { type: 'boolean' },
|
|
582
864
|
},
|
|
@@ -591,6 +873,7 @@ const ConfigMockServer: NodeType = {
|
|
|
591
873
|
};
|
|
592
874
|
|
|
593
875
|
export const ConfigTypes: Record<string, NodeType> = {
|
|
876
|
+
Assert,
|
|
594
877
|
ConfigRoot,
|
|
595
878
|
ConfigApis,
|
|
596
879
|
ConfigApisProperties,
|
|
@@ -602,7 +885,9 @@ export const ConfigTypes: Record<string, NodeType> = {
|
|
|
602
885
|
ConfigLanguage,
|
|
603
886
|
ConfigLabels,
|
|
604
887
|
ConfigSidebarLinks,
|
|
888
|
+
CommonConfigSidebarLinks,
|
|
605
889
|
ConfigTheme,
|
|
890
|
+
Context,
|
|
606
891
|
ThemeColors,
|
|
607
892
|
CommonThemeColors,
|
|
608
893
|
BorderThemeColors,
|
|
@@ -633,9 +918,12 @@ export const ConfigTypes: Record<string, NodeType> = {
|
|
|
633
918
|
TokenProps,
|
|
634
919
|
CodeBlock,
|
|
635
920
|
Logo,
|
|
921
|
+
Fab,
|
|
636
922
|
ButtonOverrides,
|
|
637
923
|
Overrides,
|
|
924
|
+
ObjectRule,
|
|
638
925
|
RightPanel,
|
|
926
|
+
Rules,
|
|
639
927
|
Shape,
|
|
640
928
|
ThemeSpacing,
|
|
641
929
|
GenerateCodeSamples,
|