@redocly/openapi-core 1.9.0 → 1.10.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 +12 -0
- package/lib/bundle.d.ts +1 -1
- package/lib/bundle.js +2 -2
- package/lib/config/config.d.ts +0 -6
- package/lib/config/config.js +1 -19
- package/lib/config/load.js +2 -2
- package/lib/decorators/common/registry-dependencies.js +2 -2
- package/lib/index.d.ts +3 -2
- package/lib/index.js +17 -2
- package/lib/lint.d.ts +1 -0
- package/lib/lint.js +1 -1
- package/lib/oas-types.d.ts +1 -1
- package/lib/redocly/domains.d.ts +14 -0
- package/lib/redocly/domains.js +41 -0
- package/lib/redocly/index.d.ts +1 -2
- package/lib/redocly/index.js +14 -24
- package/lib/redocly/registry-api.d.ts +2 -2
- package/lib/redocly/registry-api.js +9 -9
- package/lib/ref-utils.js +2 -2
- package/lib/resolve.js +9 -1
- 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 +13 -1
- package/lib/types/redocly-yaml.js +101 -39
- package/lib/types/theme-config.d.ts +819 -36
- package/lib/types/theme-config.js +67 -29
- package/lib/utils.d.ts +4 -2
- package/lib/utils.js +7 -1
- package/lib/visitors.js +1 -1
- package/lib/walk.js +7 -1
- package/package.json +2 -1
- package/src/__tests__/lint.test.ts +1218 -36
- package/src/__tests__/ref-utils.test.ts +22 -0
- package/src/bundle.ts +1 -1
- package/src/config/__tests__/load.test.ts +13 -13
- package/src/config/config.ts +1 -23
- package/src/config/load.ts +2 -1
- package/src/decorators/common/registry-dependencies.ts +1 -1
- package/src/decorators/oas2/remove-unused-components.ts +3 -2
- package/src/decorators/oas3/remove-unused-components.ts +3 -2
- package/src/index.ts +11 -2
- package/src/lint.ts +2 -1
- package/src/redocly/__tests__/domains.test.ts +52 -0
- package/src/redocly/__tests__/redocly-client.test.ts +5 -3
- package/src/redocly/domains.ts +48 -0
- package/src/redocly/index.ts +14 -24
- package/src/redocly/registry-api.ts +25 -31
- package/src/ref-utils.ts +2 -2
- package/src/resolve.ts +13 -1
- 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 +118 -43
- package/src/types/theme-config.ts +125 -27
- package/src/utils.ts +9 -3
- 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,4 +1,5 @@
|
|
|
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
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"];
|
|
@@ -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',
|
|
@@ -81,8 +80,46 @@ const builtInRules = [
|
|
|
81
80
|
...builtInOAS3Rules,
|
|
82
81
|
...builtInAsync2Rules,
|
|
83
82
|
];
|
|
84
|
-
const
|
|
85
|
-
'
|
|
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 = [
|
|
86
123
|
'Root',
|
|
87
124
|
'Tag',
|
|
88
125
|
'TagList',
|
|
@@ -137,12 +174,27 @@ const nodeTypesList = [
|
|
|
137
174
|
'AuthorizationCode',
|
|
138
175
|
'OAuth2Flows',
|
|
139
176
|
'SecurityScheme',
|
|
177
|
+
'TagGroup',
|
|
178
|
+
'TagGroups',
|
|
179
|
+
'EnumDescriptions',
|
|
180
|
+
'Logo',
|
|
140
181
|
'XCodeSample',
|
|
141
182
|
'XCodeSampleList',
|
|
183
|
+
'XUsePkce',
|
|
142
184
|
'WebhooksMap',
|
|
143
|
-
'SpecExtension',
|
|
144
|
-
'Message',
|
|
145
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'];
|
|
146
198
|
const ConfigStyleguide = {
|
|
147
199
|
properties: {
|
|
148
200
|
extends: {
|
|
@@ -168,14 +220,7 @@ const ConfigStyleguide = {
|
|
|
168
220
|
async2Decorators: { type: 'object' },
|
|
169
221
|
},
|
|
170
222
|
};
|
|
171
|
-
const
|
|
172
|
-
properties: Object.assign({ plugins: {
|
|
173
|
-
type: 'array',
|
|
174
|
-
items: { type: 'string' },
|
|
175
|
-
} }, ConfigStyleguide.properties),
|
|
176
|
-
};
|
|
177
|
-
const ConfigRoot = {
|
|
178
|
-
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: {
|
|
179
224
|
properties: {
|
|
180
225
|
http: 'ConfigHTTP',
|
|
181
226
|
doNotResolveExamples: { type: 'boolean' },
|
|
@@ -185,25 +230,24 @@ const ConfigRoot = {
|
|
|
185
230
|
items: {
|
|
186
231
|
type: 'string',
|
|
187
232
|
},
|
|
188
|
-
} })
|
|
189
|
-
};
|
|
233
|
+
} }) }));
|
|
190
234
|
const ConfigApis = {
|
|
191
235
|
properties: {},
|
|
192
236
|
additionalProperties: 'ConfigApisProperties',
|
|
193
237
|
};
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
+
} }) }));
|
|
207
251
|
};
|
|
208
252
|
const ConfigHTTP = {
|
|
209
253
|
properties: {
|
|
@@ -215,8 +259,9 @@ const ConfigHTTP = {
|
|
|
215
259
|
},
|
|
216
260
|
},
|
|
217
261
|
};
|
|
218
|
-
const
|
|
219
|
-
|
|
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' }) }));
|
|
220
265
|
};
|
|
221
266
|
const Rules = {
|
|
222
267
|
properties: {},
|
|
@@ -252,7 +297,18 @@ const ObjectRule = {
|
|
|
252
297
|
};
|
|
253
298
|
const AssertionDefinitionSubject = {
|
|
254
299
|
properties: {
|
|
255
|
-
type: {
|
|
300
|
+
type: {
|
|
301
|
+
enum: [
|
|
302
|
+
...new Set([
|
|
303
|
+
'any',
|
|
304
|
+
...oas2NodeTypesList,
|
|
305
|
+
...oas3NodeTypesList,
|
|
306
|
+
...oas3_1NodeTypesList,
|
|
307
|
+
...asyncNodeTypesList,
|
|
308
|
+
'SpecExtension',
|
|
309
|
+
]),
|
|
310
|
+
],
|
|
311
|
+
},
|
|
256
312
|
property: (value) => {
|
|
257
313
|
if (Array.isArray(value)) {
|
|
258
314
|
return { type: 'array', items: { type: 'string' } };
|
|
@@ -705,6 +761,7 @@ const GenerateCodeSamples = {
|
|
|
705
761
|
required: ['languages'],
|
|
706
762
|
};
|
|
707
763
|
const ConfigReferenceDocs = {
|
|
764
|
+
// TODO: partially invalid @Viacheslav
|
|
708
765
|
properties: {
|
|
709
766
|
theme: 'ConfigTheme',
|
|
710
767
|
corsProxyUrl: { type: 'string' },
|
|
@@ -839,11 +896,15 @@ const ConfigMockServer = {
|
|
|
839
896
|
errorIfForcedExampleNotFound: { type: 'boolean' },
|
|
840
897
|
},
|
|
841
898
|
};
|
|
842
|
-
|
|
843
|
-
|
|
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,
|
|
844
907
|
ConfigApis,
|
|
845
|
-
ConfigApisProperties,
|
|
846
|
-
RootConfigStyleguide,
|
|
847
908
|
ConfigStyleguide,
|
|
848
909
|
ConfigReferenceDocs,
|
|
849
910
|
ConfigMockServer,
|
|
@@ -853,7 +914,6 @@ exports.ConfigTypes = Object.assign({ Assert,
|
|
|
853
914
|
ConfigSidebarLinks,
|
|
854
915
|
CommonConfigSidebarLinks,
|
|
855
916
|
ConfigTheme,
|
|
856
|
-
ConfigRootTheme,
|
|
857
917
|
AssertDefinition,
|
|
858
918
|
ThemeColors,
|
|
859
919
|
CommonThemeColors,
|
|
@@ -902,4 +962,6 @@ exports.ConfigTypes = Object.assign({ Assert,
|
|
|
902
962
|
Heading,
|
|
903
963
|
Typography,
|
|
904
964
|
AssertionDefinitionAssertions,
|
|
905
|
-
AssertionDefinitionSubject
|
|
965
|
+
AssertionDefinitionSubject,
|
|
966
|
+
};
|
|
967
|
+
exports.ConfigTypes = (0, exports.createConfigTypes)(portal_config_schema_1.rootRedoclyConfigSchema);
|