@redocly/openapi-core 1.8.2 → 1.9.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 +16 -0
- package/lib/bundle.d.ts +1 -1
- package/lib/config/all.js +1 -0
- package/lib/config/minimal.js +1 -0
- package/lib/config/recommended-strict.js +1 -0
- package/lib/config/recommended.js +1 -0
- package/lib/lint.d.ts +1 -0
- package/lib/lint.js +1 -1
- package/lib/oas-types.d.ts +1 -1
- package/lib/ref-utils.js +4 -4
- package/lib/resolve.js +9 -1
- package/lib/rules/common/no-required-schema-properties-undefined.d.ts +2 -0
- package/lib/rules/common/no-required-schema-properties-undefined.js +37 -0
- package/lib/rules/oas2/index.js +2 -0
- package/lib/rules/oas3/index.js +2 -0
- package/lib/types/index.d.ts +7 -7
- package/lib/types/json-schema-adapter.d.ts +3 -0
- package/lib/types/json-schema-adapter.js +173 -0
- package/lib/types/oas2.d.ts +3 -2
- package/lib/types/oas3.d.ts +3 -2
- package/lib/types/oas3_1.d.ts +3 -2
- package/lib/types/portal-config-schema.d.ts +5261 -52
- package/lib/types/portal-config-schema.js +71 -55
- package/lib/types/redocly-yaml.d.ts +14 -2
- package/lib/types/redocly-yaml.js +102 -39
- package/lib/types/theme-config.d.ts +819 -36
- package/lib/types/theme-config.js +67 -29
- package/lib/utils.d.ts +2 -2
- package/lib/visitors.js +1 -1
- package/lib/walk.js +7 -1
- package/package.json +1 -1
- package/src/__tests__/lint.test.ts +1218 -36
- package/src/__tests__/ref-utils.test.ts +22 -0
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +2 -0
- package/src/config/__tests__/load.test.ts +13 -13
- package/src/config/all.ts +1 -0
- package/src/config/minimal.ts +1 -0
- package/src/config/recommended-strict.ts +1 -0
- package/src/config/recommended.ts +1 -0
- package/src/decorators/oas2/remove-unused-components.ts +3 -2
- package/src/decorators/oas3/remove-unused-components.ts +3 -2
- package/src/lint.ts +2 -1
- package/src/ref-utils.ts +4 -4
- package/src/resolve.ts +13 -1
- package/src/rules/common/__tests__/no-required-schema-properties-undefined.test.ts +550 -0
- package/src/rules/common/no-required-schema-properties-undefined.ts +53 -0
- package/src/rules/oas2/index.ts +2 -0
- package/src/rules/oas3/index.ts +2 -0
- package/src/types/index.ts +7 -12
- package/src/types/json-schema-adapter.ts +217 -0
- package/src/types/oas2.ts +5 -2
- package/src/types/oas3.ts +6 -2
- package/src/types/oas3_1.ts +5 -2
- package/src/types/portal-config-schema.ts +111 -61
- package/src/types/redocly-yaml.ts +119 -43
- package/src/types/theme-config.ts +125 -27
- package/src/utils.ts +2 -2
- package/src/visitors.ts +1 -1
- package/src/walk.ts +7 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rootRedoclyConfigSchema =
|
|
3
|
+
exports.rootRedoclyConfigSchema = void 0;
|
|
4
4
|
const config_1 = require("../config");
|
|
5
|
+
const theme_config_1 = require("./theme-config");
|
|
5
6
|
const oidcIssuerMetadataSchema = {
|
|
6
7
|
type: 'object',
|
|
7
8
|
properties: {
|
|
@@ -18,10 +19,11 @@ const oidcProviderConfigSchema = {
|
|
|
18
19
|
properties: {
|
|
19
20
|
type: { type: 'string', const: config_1.AuthProviderType.OIDC },
|
|
20
21
|
title: { type: 'string' },
|
|
22
|
+
pkce: { type: 'boolean', default: false },
|
|
21
23
|
configurationUrl: { type: 'string', minLength: 1 },
|
|
22
24
|
configuration: oidcIssuerMetadataSchema,
|
|
23
25
|
clientId: { type: 'string', minLength: 1 },
|
|
24
|
-
clientSecret: { type: 'string', minLength:
|
|
26
|
+
clientSecret: { type: 'string', minLength: 0 },
|
|
25
27
|
teamsClaimName: { type: 'string' },
|
|
26
28
|
teamsClaimMap: { type: 'object', additionalProperties: { type: 'string' } },
|
|
27
29
|
defaultTeams: { type: 'array', items: { type: 'string' } },
|
|
@@ -31,7 +33,7 @@ const oidcProviderConfigSchema = {
|
|
|
31
33
|
tokenRequestCustomParams: { type: 'object', additionalProperties: { type: 'string' } },
|
|
32
34
|
audience: { type: 'array', items: { type: 'string' } },
|
|
33
35
|
},
|
|
34
|
-
required: ['type', 'clientId'
|
|
36
|
+
required: ['type', 'clientId'],
|
|
35
37
|
oneOf: [{ required: ['configurationUrl'] }, { required: ['configuration'] }],
|
|
36
38
|
additionalProperties: false,
|
|
37
39
|
};
|
|
@@ -78,41 +80,58 @@ const authProviderConfigSchema = {
|
|
|
78
80
|
oneOf: [oidcProviderConfigSchema, saml2ProviderConfigSchema, basicAuthProviderConfigSchema],
|
|
79
81
|
discriminator: { propertyName: 'type' },
|
|
80
82
|
};
|
|
81
|
-
|
|
83
|
+
const ssoOnPremConfigSchema = {
|
|
82
84
|
type: 'object',
|
|
83
|
-
properties: {},
|
|
84
85
|
additionalProperties: authProviderConfigSchema,
|
|
85
86
|
};
|
|
87
|
+
const ssoConfigSchema = {
|
|
88
|
+
oneOf: [
|
|
89
|
+
{
|
|
90
|
+
type: 'array',
|
|
91
|
+
items: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
enum: ['REDOCLY', 'CORPORATE', 'GUEST'],
|
|
94
|
+
},
|
|
95
|
+
uniqueItems: true,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
type: 'string',
|
|
99
|
+
enum: ['REDOCLY', 'CORPORATE', 'GUEST'],
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
};
|
|
86
103
|
const redirectConfigSchema = {
|
|
87
104
|
type: 'object',
|
|
88
105
|
properties: {
|
|
89
106
|
to: { type: 'string' },
|
|
90
107
|
type: { type: 'number', default: 301 },
|
|
91
108
|
},
|
|
92
|
-
|
|
109
|
+
additionalProperties: false,
|
|
93
110
|
};
|
|
94
111
|
const redirectsConfigSchema = {
|
|
95
112
|
type: 'object',
|
|
96
|
-
|
|
97
|
-
additionalProperties: 'redirectConfigSchema',
|
|
113
|
+
additionalProperties: redirectConfigSchema,
|
|
98
114
|
default: {},
|
|
99
115
|
};
|
|
100
|
-
|
|
116
|
+
const apiConfigSchema = {
|
|
101
117
|
type: 'object',
|
|
102
118
|
properties: {
|
|
103
119
|
root: { type: 'string' },
|
|
120
|
+
output: { type: 'string', pattern: '(.ya?ml|.json)$' },
|
|
104
121
|
rbac: { type: 'object', additionalProperties: true },
|
|
105
122
|
theme: {
|
|
106
123
|
type: 'object',
|
|
107
124
|
properties: {
|
|
108
|
-
openapi:
|
|
125
|
+
openapi: theme_config_1.themeConfigSchema.properties.openapi,
|
|
126
|
+
graphql: theme_config_1.themeConfigSchema.properties.graphql,
|
|
109
127
|
},
|
|
110
128
|
additionalProperties: false,
|
|
111
129
|
},
|
|
112
130
|
title: { type: 'string' },
|
|
113
131
|
metadata: { type: 'object', additionalProperties: true },
|
|
132
|
+
rules: { type: 'object', additionalProperties: true },
|
|
133
|
+
decorators: { type: 'object', additionalProperties: true },
|
|
114
134
|
},
|
|
115
|
-
additionalProperties: true,
|
|
116
135
|
required: ['root'],
|
|
117
136
|
};
|
|
118
137
|
const metadataConfigSchema = {
|
|
@@ -126,7 +145,9 @@ const seoConfigSchema = {
|
|
|
126
145
|
description: { type: 'string' },
|
|
127
146
|
siteUrl: { type: 'string' },
|
|
128
147
|
image: { type: 'string' },
|
|
129
|
-
keywords: {
|
|
148
|
+
keywords: {
|
|
149
|
+
oneOf: [{ type: 'array', items: { type: 'string' } }, { type: 'string' }],
|
|
150
|
+
},
|
|
130
151
|
lang: { type: 'string' },
|
|
131
152
|
jsonLd: { type: 'object' },
|
|
132
153
|
meta: {
|
|
@@ -142,16 +163,20 @@ const seoConfigSchema = {
|
|
|
142
163
|
},
|
|
143
164
|
},
|
|
144
165
|
},
|
|
166
|
+
additionalProperties: false,
|
|
145
167
|
};
|
|
146
|
-
const rbacScopeItemsSchema = {
|
|
147
|
-
type: 'object',
|
|
148
|
-
properties: {},
|
|
149
|
-
additionalProperties: { type: 'string' },
|
|
150
|
-
};
|
|
168
|
+
const rbacScopeItemsSchema = { type: 'object', additionalProperties: { type: 'string' } };
|
|
151
169
|
const rbacConfigSchema = {
|
|
152
170
|
type: 'object',
|
|
153
171
|
properties: {
|
|
154
|
-
|
|
172
|
+
cms: rbacScopeItemsSchema,
|
|
173
|
+
content: {
|
|
174
|
+
type: 'object',
|
|
175
|
+
properties: {
|
|
176
|
+
'**': rbacScopeItemsSchema,
|
|
177
|
+
},
|
|
178
|
+
additionalProperties: rbacScopeItemsSchema,
|
|
179
|
+
},
|
|
155
180
|
},
|
|
156
181
|
additionalProperties: rbacScopeItemsSchema,
|
|
157
182
|
};
|
|
@@ -216,6 +241,7 @@ const devOnboardingAdapterConfigSchema = {
|
|
|
216
241
|
const devOnboardingConfigSchema = {
|
|
217
242
|
type: 'object',
|
|
218
243
|
required: ['adapters'],
|
|
244
|
+
additionalProperties: false,
|
|
219
245
|
properties: {
|
|
220
246
|
adapters: {
|
|
221
247
|
type: 'array',
|
|
@@ -245,7 +271,8 @@ const i18ConfigSchema = {
|
|
|
245
271
|
},
|
|
246
272
|
},
|
|
247
273
|
},
|
|
248
|
-
|
|
274
|
+
additionalProperties: false,
|
|
275
|
+
required: ['defaultLocale'],
|
|
249
276
|
};
|
|
250
277
|
const responseHeaderSchema = {
|
|
251
278
|
type: 'object',
|
|
@@ -256,24 +283,13 @@ const responseHeaderSchema = {
|
|
|
256
283
|
additionalProperties: false,
|
|
257
284
|
required: ['name', 'value'],
|
|
258
285
|
};
|
|
259
|
-
|
|
260
|
-
seoConfigSchema,
|
|
261
|
-
rbacConfigSchema,
|
|
262
|
-
rbacScopeItemsSchema,
|
|
263
|
-
ssoConfigSchema: exports.ssoConfigSchema,
|
|
264
|
-
devOnboardingConfigSchema,
|
|
265
|
-
i18ConfigSchema,
|
|
266
|
-
redirectsConfigSchema,
|
|
267
|
-
redirectConfigSchema,
|
|
268
|
-
// TODO: Extract other types that need to be linted in the config
|
|
269
|
-
};
|
|
270
|
-
exports.redoclyConfigSchema = {
|
|
286
|
+
const redoclyConfigSchema = {
|
|
271
287
|
type: 'object',
|
|
272
288
|
properties: {
|
|
273
289
|
licenseKey: { type: 'string' },
|
|
274
|
-
redirects:
|
|
275
|
-
seo:
|
|
276
|
-
rbac:
|
|
290
|
+
redirects: redirectsConfigSchema,
|
|
291
|
+
seo: seoConfigSchema,
|
|
292
|
+
rbac: rbacConfigSchema,
|
|
277
293
|
responseHeaders: {
|
|
278
294
|
type: 'object',
|
|
279
295
|
additionalProperties: {
|
|
@@ -293,30 +309,30 @@ exports.redoclyConfigSchema = {
|
|
|
293
309
|
},
|
|
294
310
|
apis: {
|
|
295
311
|
type: 'object',
|
|
296
|
-
additionalProperties:
|
|
312
|
+
additionalProperties: apiConfigSchema,
|
|
297
313
|
},
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
314
|
+
ssoOnPrem: ssoOnPremConfigSchema,
|
|
315
|
+
sso: ssoConfigSchema,
|
|
316
|
+
residency: { type: 'string' },
|
|
317
|
+
developerOnboarding: devOnboardingConfigSchema,
|
|
318
|
+
i18n: i18ConfigSchema,
|
|
301
319
|
metadata: metadataConfigSchema,
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
oneOf: [
|
|
307
|
-
Object.assign(Object.assign({}, exports.redoclyConfigSchema), { additionalProperties: false }),
|
|
308
|
-
{
|
|
309
|
-
type: 'object',
|
|
310
|
-
properties: {
|
|
311
|
-
$ref: { type: 'string' },
|
|
320
|
+
ignore: {
|
|
321
|
+
type: 'array',
|
|
322
|
+
items: {
|
|
323
|
+
type: 'string',
|
|
312
324
|
},
|
|
313
|
-
required: ['$ref'],
|
|
314
|
-
additionalProperties: false,
|
|
315
325
|
},
|
|
316
|
-
|
|
326
|
+
theme: theme_config_1.themeConfigSchema,
|
|
327
|
+
},
|
|
328
|
+
default: { redirects: {} },
|
|
329
|
+
additionalProperties: true,
|
|
317
330
|
};
|
|
318
|
-
|
|
331
|
+
const environmentSchema = Object.assign(Object.assign({}, redoclyConfigSchema), { additionalProperties: false });
|
|
332
|
+
exports.rootRedoclyConfigSchema = Object.assign(Object.assign({}, redoclyConfigSchema), { properties: Object.assign(Object.assign({ plugins: {
|
|
333
|
+
type: 'array',
|
|
334
|
+
items: { type: 'string' },
|
|
335
|
+
} }, redoclyConfigSchema.properties), { env: {
|
|
319
336
|
type: 'object',
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
} }), default: {}, required: ['redirects'] });
|
|
337
|
+
additionalProperties: environmentSchema, // TODO: if we want full validation we need to override apis, theme and the root
|
|
338
|
+
} }), default: {}, additionalProperties: false });
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { NodeType } from '.';
|
|
1
|
+
import type { NodeType } from '.';
|
|
2
|
+
import type { JSONSchema } from 'json-schema-to-ts';
|
|
2
3
|
declare const builtInCommonRules: readonly ["spec", "info-contact", "operation-operationId", "tag-description", "tags-alphabetical"];
|
|
3
4
|
export type BuiltInCommonRuleId = typeof builtInCommonRules[number];
|
|
4
|
-
declare const builtInCommonOASRules: readonly ["info-license-url", "info-license", "no-ambiguous-paths", "no-enum-type-mismatch", "no-http-verbs-in-paths", "no-identical-paths", "no-invalid-parameter-examples", "no-invalid-schema-examples", "no-path-trailing-slash", "operation-2xx-response", "operation-4xx-response", "operation-description", "operation-operationId-unique", "operation-operationId-url-safe", "operation-parameters-unique", "operation-singular-tag", "operation-summary", "operation-tag-defined", "parameter-description", "path-declaration-must-exist", "path-excludes-patterns", "path-http-verbs-order", "path-not-include-query", "path-params-defined", "path-parameters-defined", "path-segment-plural", "paths-kebab-case", "required-string-property-missing-min-length", "response-contains-header", "scalar-property-missing-example", "security-defined", "spec-strict-refs", "no-unresolved-refs"];
|
|
5
|
+
declare const builtInCommonOASRules: readonly ["info-license-url", "info-license", "no-ambiguous-paths", "no-enum-type-mismatch", "no-http-verbs-in-paths", "no-identical-paths", "no-invalid-parameter-examples", "no-invalid-schema-examples", "no-path-trailing-slash", "operation-2xx-response", "operation-4xx-response", "operation-description", "operation-operationId-unique", "operation-operationId-url-safe", "operation-parameters-unique", "operation-singular-tag", "operation-summary", "operation-tag-defined", "parameter-description", "path-declaration-must-exist", "path-excludes-patterns", "path-http-verbs-order", "path-not-include-query", "path-params-defined", "path-parameters-defined", "path-segment-plural", "paths-kebab-case", "required-string-property-missing-min-length", "response-contains-header", "scalar-property-missing-example", "security-defined", "spec-strict-refs", "no-unresolved-refs", "no-required-schema-properties-undefined"];
|
|
5
6
|
export type BuiltInCommonOASRuleId = typeof builtInCommonOASRules[number];
|
|
6
7
|
declare const builtInOAS2Rules: readonly ["boolean-parameter-prefixes", "request-mime-type", "response-contains-property", "response-mime-type"];
|
|
7
8
|
export type BuiltInOAS2RuleId = typeof builtInOAS2Rules[number];
|
|
@@ -9,5 +10,16 @@ declare const builtInOAS3Rules: readonly ["boolean-parameter-prefixes", "compone
|
|
|
9
10
|
export type BuiltInOAS3RuleId = typeof builtInOAS3Rules[number];
|
|
10
11
|
declare const builtInAsync2Rules: readonly ["channels-kebab-case", "no-channel-trailing-slash"];
|
|
11
12
|
export type BuiltInAsync2RuleId = typeof builtInAsync2Rules[number];
|
|
13
|
+
declare const oas2NodeTypesList: readonly ["Root", "Tag", "TagList", "ExternalDocs", "SecurityRequirement", "SecurityRequirementList", "Info", "Contact", "License", "Paths", "PathItem", "Parameter", "ParameterList", "ParameterItems", "Operation", "Example", "ExamplesMap", "Examples", "Header", "Responses", "Response", "Schema", "Xml", "SchemaProperties", "NamedSchemas", "NamedResponses", "NamedParameters", "NamedSecuritySchemes", "SecurityScheme", "TagGroup", "TagGroups", "EnumDescriptions", "Logo", "XCodeSample", "XCodeSampleList", "XServer", "XServerList"];
|
|
14
|
+
export type Oas2NodeType = typeof oas2NodeTypesList[number];
|
|
15
|
+
declare const oas3NodeTypesList: readonly ["Root", "Tag", "TagList", "ExternalDocs", "Server", "ServerList", "ServerVariable", "ServerVariablesMap", "SecurityRequirement", "SecurityRequirementList", "Info", "Contact", "License", "Paths", "PathItem", "Parameter", "ParameterList", "Operation", "Callback", "CallbacksMap", "RequestBody", "MediaTypesMap", "MediaType", "Example", "ExamplesMap", "Encoding", "EncodingMap", "Header", "HeadersMap", "Responses", "Response", "Link", "LinksMap", "Schema", "Xml", "SchemaProperties", "DiscriminatorMapping", "Discriminator", "Components", "NamedSchemas", "NamedResponses", "NamedParameters", "NamedExamples", "NamedRequestBodies", "NamedHeaders", "NamedSecuritySchemes", "NamedLinks", "NamedCallbacks", "ImplicitFlow", "PasswordFlow", "ClientCredentials", "AuthorizationCode", "OAuth2Flows", "SecurityScheme", "TagGroup", "TagGroups", "EnumDescriptions", "Logo", "XCodeSample", "XCodeSampleList", "XUsePkce", "WebhooksMap"];
|
|
16
|
+
export type Oas3NodeType = typeof oas3NodeTypesList[number];
|
|
17
|
+
declare const oas3_1NodeTypesList: readonly ["Root", "Schema", "SchemaProperties", "Info", "License", "Components", "NamedPathItems", "SecurityScheme", "Operation"];
|
|
18
|
+
export type Oas3_1NodeType = typeof oas3_1NodeTypesList[number];
|
|
19
|
+
export declare const createConfigTypes: (extraSchemas: JSONSchema) => {
|
|
20
|
+
ConfigRoot: NodeType;
|
|
21
|
+
ConfigApisProperties: NodeType;
|
|
22
|
+
ConfigRootTheme: NodeType;
|
|
23
|
+
};
|
|
12
24
|
export declare const ConfigTypes: Record<string, NodeType>;
|
|
13
25
|
export {};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConfigTypes = void 0;
|
|
3
|
+
exports.ConfigTypes = exports.createConfigTypes = void 0;
|
|
4
4
|
const portal_config_schema_1 = require("./portal-config-schema");
|
|
5
|
-
const theme_config_1 = require("./theme-config");
|
|
6
5
|
const _1 = require(".");
|
|
7
6
|
const utils_1 = require("../utils");
|
|
8
|
-
const
|
|
7
|
+
const json_schema_adapter_1 = require("./json-schema-adapter");
|
|
9
8
|
const builtInCommonRules = [
|
|
10
9
|
'spec',
|
|
11
10
|
'info-contact',
|
|
@@ -47,6 +46,7 @@ const builtInCommonOASRules = [
|
|
|
47
46
|
'security-defined',
|
|
48
47
|
'spec-strict-refs',
|
|
49
48
|
'no-unresolved-refs',
|
|
49
|
+
'no-required-schema-properties-undefined',
|
|
50
50
|
];
|
|
51
51
|
const builtInOAS2Rules = [
|
|
52
52
|
'boolean-parameter-prefixes',
|
|
@@ -80,8 +80,46 @@ const builtInRules = [
|
|
|
80
80
|
...builtInOAS3Rules,
|
|
81
81
|
...builtInAsync2Rules,
|
|
82
82
|
];
|
|
83
|
-
const
|
|
84
|
-
'
|
|
83
|
+
const oas2NodeTypesList = [
|
|
84
|
+
'Root',
|
|
85
|
+
'Tag',
|
|
86
|
+
'TagList',
|
|
87
|
+
'ExternalDocs',
|
|
88
|
+
'SecurityRequirement',
|
|
89
|
+
'SecurityRequirementList',
|
|
90
|
+
'Info',
|
|
91
|
+
'Contact',
|
|
92
|
+
'License',
|
|
93
|
+
'Paths',
|
|
94
|
+
'PathItem',
|
|
95
|
+
'Parameter',
|
|
96
|
+
'ParameterList',
|
|
97
|
+
'ParameterItems',
|
|
98
|
+
'Operation',
|
|
99
|
+
'Example',
|
|
100
|
+
'ExamplesMap',
|
|
101
|
+
'Examples',
|
|
102
|
+
'Header',
|
|
103
|
+
'Responses',
|
|
104
|
+
'Response',
|
|
105
|
+
'Schema',
|
|
106
|
+
'Xml',
|
|
107
|
+
'SchemaProperties',
|
|
108
|
+
'NamedSchemas',
|
|
109
|
+
'NamedResponses',
|
|
110
|
+
'NamedParameters',
|
|
111
|
+
'NamedSecuritySchemes',
|
|
112
|
+
'SecurityScheme',
|
|
113
|
+
'TagGroup',
|
|
114
|
+
'TagGroups',
|
|
115
|
+
'EnumDescriptions',
|
|
116
|
+
'Logo',
|
|
117
|
+
'XCodeSample',
|
|
118
|
+
'XCodeSampleList',
|
|
119
|
+
'XServer',
|
|
120
|
+
'XServerList',
|
|
121
|
+
];
|
|
122
|
+
const oas3NodeTypesList = [
|
|
85
123
|
'Root',
|
|
86
124
|
'Tag',
|
|
87
125
|
'TagList',
|
|
@@ -136,12 +174,27 @@ const nodeTypesList = [
|
|
|
136
174
|
'AuthorizationCode',
|
|
137
175
|
'OAuth2Flows',
|
|
138
176
|
'SecurityScheme',
|
|
177
|
+
'TagGroup',
|
|
178
|
+
'TagGroups',
|
|
179
|
+
'EnumDescriptions',
|
|
180
|
+
'Logo',
|
|
139
181
|
'XCodeSample',
|
|
140
182
|
'XCodeSampleList',
|
|
183
|
+
'XUsePkce',
|
|
141
184
|
'WebhooksMap',
|
|
142
|
-
'SpecExtension',
|
|
143
|
-
'Message',
|
|
144
185
|
];
|
|
186
|
+
const oas3_1NodeTypesList = [
|
|
187
|
+
'Root',
|
|
188
|
+
'Schema',
|
|
189
|
+
'SchemaProperties',
|
|
190
|
+
'Info',
|
|
191
|
+
'License',
|
|
192
|
+
'Components',
|
|
193
|
+
'NamedPathItems',
|
|
194
|
+
'SecurityScheme',
|
|
195
|
+
'Operation',
|
|
196
|
+
];
|
|
197
|
+
const asyncNodeTypesList = ['Message'];
|
|
145
198
|
const ConfigStyleguide = {
|
|
146
199
|
properties: {
|
|
147
200
|
extends: {
|
|
@@ -167,14 +220,7 @@ const ConfigStyleguide = {
|
|
|
167
220
|
async2Decorators: { type: 'object' },
|
|
168
221
|
},
|
|
169
222
|
};
|
|
170
|
-
const
|
|
171
|
-
properties: Object.assign({ plugins: {
|
|
172
|
-
type: 'array',
|
|
173
|
-
items: { type: 'string' },
|
|
174
|
-
} }, ConfigStyleguide.properties),
|
|
175
|
-
};
|
|
176
|
-
const ConfigRoot = {
|
|
177
|
-
properties: Object.assign(Object.assign(Object.assign({}, portal_config_schema_1.rootRedoclyConfigSchema.properties), RootConfigStyleguide.properties), { apis: 'ConfigApis', theme: 'ConfigRootTheme', 'features.openapi': 'ConfigReferenceDocs', 'features.mockServer': 'ConfigMockServer', organization: { type: 'string' }, region: { enum: ['us', 'eu'] }, telemetry: { enum: ['on', 'off'] }, resolve: {
|
|
223
|
+
const createConfigRoot = (nodeTypes) => (Object.assign(Object.assign({}, nodeTypes.rootRedoclyConfigSchema), { properties: Object.assign(Object.assign(Object.assign({}, nodeTypes.rootRedoclyConfigSchema.properties), ConfigStyleguide.properties), { apis: 'ConfigApis', theme: 'ConfigRootTheme', 'features.openapi': 'ConfigReferenceDocs', 'features.mockServer': 'ConfigMockServer', organization: { type: 'string' }, region: { enum: ['us', 'eu'] }, telemetry: { enum: ['on', 'off'] }, resolve: {
|
|
178
224
|
properties: {
|
|
179
225
|
http: 'ConfigHTTP',
|
|
180
226
|
doNotResolveExamples: { type: 'boolean' },
|
|
@@ -184,25 +230,24 @@ const ConfigRoot = {
|
|
|
184
230
|
items: {
|
|
185
231
|
type: 'string',
|
|
186
232
|
},
|
|
187
|
-
} })
|
|
188
|
-
};
|
|
233
|
+
} }) }));
|
|
189
234
|
const ConfigApis = {
|
|
190
235
|
properties: {},
|
|
191
236
|
additionalProperties: 'ConfigApisProperties',
|
|
192
237
|
};
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
238
|
+
const createConfigApisProperties = (nodeTypes) => {
|
|
239
|
+
var _a;
|
|
240
|
+
return (Object.assign(Object.assign({}, nodeTypes['rootRedoclyConfigSchema.apis_additionalProperties']), { properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = nodeTypes['rootRedoclyConfigSchema.apis_additionalProperties']) === null || _a === void 0 ? void 0 : _a.properties), { labels: {
|
|
241
|
+
type: 'array',
|
|
242
|
+
items: {
|
|
243
|
+
type: 'string',
|
|
244
|
+
},
|
|
245
|
+
} }), ConfigStyleguide.properties), { 'features.openapi': 'ConfigReferenceDocs', 'features.mockServer': 'ConfigMockServer', files: {
|
|
246
|
+
type: 'array',
|
|
247
|
+
items: {
|
|
248
|
+
type: 'string',
|
|
249
|
+
},
|
|
250
|
+
} }) }));
|
|
206
251
|
};
|
|
207
252
|
const ConfigHTTP = {
|
|
208
253
|
properties: {
|
|
@@ -214,8 +259,9 @@ const ConfigHTTP = {
|
|
|
214
259
|
},
|
|
215
260
|
},
|
|
216
261
|
};
|
|
217
|
-
const
|
|
218
|
-
|
|
262
|
+
const createConfigRootTheme = (nodeTypes) => {
|
|
263
|
+
var _a;
|
|
264
|
+
return (Object.assign(Object.assign({}, nodeTypes['rootRedoclyConfigSchema.theme']), { properties: Object.assign(Object.assign({}, (_a = nodeTypes['rootRedoclyConfigSchema.theme']) === null || _a === void 0 ? void 0 : _a.properties), { openapi: 'ConfigReferenceDocs' }) }));
|
|
219
265
|
};
|
|
220
266
|
const Rules = {
|
|
221
267
|
properties: {},
|
|
@@ -251,7 +297,18 @@ const ObjectRule = {
|
|
|
251
297
|
};
|
|
252
298
|
const AssertionDefinitionSubject = {
|
|
253
299
|
properties: {
|
|
254
|
-
type: {
|
|
300
|
+
type: {
|
|
301
|
+
enum: [
|
|
302
|
+
...new Set([
|
|
303
|
+
'any',
|
|
304
|
+
...oas2NodeTypesList,
|
|
305
|
+
...oas3NodeTypesList,
|
|
306
|
+
...oas3_1NodeTypesList,
|
|
307
|
+
...asyncNodeTypesList,
|
|
308
|
+
'SpecExtension',
|
|
309
|
+
]),
|
|
310
|
+
],
|
|
311
|
+
},
|
|
255
312
|
property: (value) => {
|
|
256
313
|
if (Array.isArray(value)) {
|
|
257
314
|
return { type: 'array', items: { type: 'string' } };
|
|
@@ -704,6 +761,7 @@ const GenerateCodeSamples = {
|
|
|
704
761
|
required: ['languages'],
|
|
705
762
|
};
|
|
706
763
|
const ConfigReferenceDocs = {
|
|
764
|
+
// TODO: partially invalid @Viacheslav
|
|
707
765
|
properties: {
|
|
708
766
|
theme: 'ConfigTheme',
|
|
709
767
|
corsProxyUrl: { type: 'string' },
|
|
@@ -838,11 +896,15 @@ const ConfigMockServer = {
|
|
|
838
896
|
errorIfForcedExampleNotFound: { type: 'boolean' },
|
|
839
897
|
},
|
|
840
898
|
};
|
|
841
|
-
|
|
842
|
-
|
|
899
|
+
const createConfigTypes = (extraSchemas) => {
|
|
900
|
+
// Create types based on external schemas
|
|
901
|
+
const nodeTypes = (0, json_schema_adapter_1.getNodeTypesFromJSONSchema)('rootRedoclyConfigSchema', extraSchemas);
|
|
902
|
+
return Object.assign(Object.assign(Object.assign({}, CoreConfigTypes), { ConfigRoot: createConfigRoot(nodeTypes), ConfigApisProperties: createConfigApisProperties(nodeTypes), ConfigRootTheme: createConfigRootTheme(nodeTypes) }), nodeTypes);
|
|
903
|
+
};
|
|
904
|
+
exports.createConfigTypes = createConfigTypes;
|
|
905
|
+
const CoreConfigTypes = {
|
|
906
|
+
Assert,
|
|
843
907
|
ConfigApis,
|
|
844
|
-
ConfigApisProperties,
|
|
845
|
-
RootConfigStyleguide,
|
|
846
908
|
ConfigStyleguide,
|
|
847
909
|
ConfigReferenceDocs,
|
|
848
910
|
ConfigMockServer,
|
|
@@ -852,7 +914,6 @@ exports.ConfigTypes = Object.assign({ Assert,
|
|
|
852
914
|
ConfigSidebarLinks,
|
|
853
915
|
CommonConfigSidebarLinks,
|
|
854
916
|
ConfigTheme,
|
|
855
|
-
ConfigRootTheme,
|
|
856
917
|
AssertDefinition,
|
|
857
918
|
ThemeColors,
|
|
858
919
|
CommonThemeColors,
|
|
@@ -901,4 +962,6 @@ exports.ConfigTypes = Object.assign({ Assert,
|
|
|
901
962
|
Heading,
|
|
902
963
|
Typography,
|
|
903
964
|
AssertionDefinitionAssertions,
|
|
904
|
-
AssertionDefinitionSubject
|
|
965
|
+
AssertionDefinitionSubject,
|
|
966
|
+
};
|
|
967
|
+
exports.ConfigTypes = (0, exports.createConfigTypes)(portal_config_schema_1.rootRedoclyConfigSchema);
|