@redocly/openapi-core 1.10.3 → 1.10.4
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 +7 -0
- package/lib/bundle.d.ts +1 -1
- package/lib/config/types.d.ts +0 -10
- package/lib/config/types.js +0 -13
- package/lib/env.js +3 -1
- package/lib/oas-types.d.ts +1 -1
- package/lib/types/redocly-yaml.js +3 -3
- package/package.json +2 -1
- package/src/__tests__/lint.test.ts +2 -30
- package/src/config/types.ts +0 -13
- package/src/env.ts +3 -1
- package/src/types/redocly-yaml.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/types/portal-config-schema.d.ts +0 -5299
- package/lib/types/portal-config-schema.js +0 -338
- package/lib/types/theme-config.d.ts +0 -2541
- package/lib/types/theme-config.js +0 -637
- package/src/types/portal-config-schema.ts +0 -416
- package/src/types/theme-config.ts +0 -781
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ApigeeDevOnboardingIntegrationAuthType,
|
|
3
|
-
AuthProviderType,
|
|
4
|
-
DEFAULT_TEAM_CLAIM_NAME,
|
|
5
|
-
} from '../config';
|
|
6
|
-
import { themeConfigSchema } from './theme-config';
|
|
7
|
-
|
|
8
|
-
import type { FromSchema } from 'json-schema-to-ts';
|
|
9
|
-
import type { ThemeConfig } from './theme-config';
|
|
10
|
-
|
|
11
|
-
const oidcIssuerMetadataSchema = {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
end_session_endpoint: { type: 'string' },
|
|
15
|
-
token_endpoint: { type: 'string' },
|
|
16
|
-
authorization_endpoint: { type: 'string' },
|
|
17
|
-
jwks_uri: { type: 'string' },
|
|
18
|
-
},
|
|
19
|
-
required: ['token_endpoint', 'authorization_endpoint'],
|
|
20
|
-
additionalProperties: true,
|
|
21
|
-
} as const;
|
|
22
|
-
|
|
23
|
-
const oidcProviderConfigSchema = {
|
|
24
|
-
type: 'object',
|
|
25
|
-
properties: {
|
|
26
|
-
type: { type: 'string', const: AuthProviderType.OIDC },
|
|
27
|
-
title: { type: 'string' },
|
|
28
|
-
pkce: { type: 'boolean', default: false },
|
|
29
|
-
configurationUrl: { type: 'string', minLength: 1 },
|
|
30
|
-
configuration: oidcIssuerMetadataSchema,
|
|
31
|
-
clientId: { type: 'string', minLength: 1 },
|
|
32
|
-
clientSecret: { type: 'string', minLength: 0 },
|
|
33
|
-
teamsClaimName: { type: 'string' },
|
|
34
|
-
teamsClaimMap: { type: 'object', additionalProperties: { type: 'string' } },
|
|
35
|
-
defaultTeams: { type: 'array', items: { type: 'string' } },
|
|
36
|
-
scopes: { type: 'array', items: { type: 'string' } },
|
|
37
|
-
tokenExpirationTime: { type: 'number' },
|
|
38
|
-
authorizationRequestCustomParams: { type: 'object', additionalProperties: { type: 'string' } },
|
|
39
|
-
tokenRequestCustomParams: { type: 'object', additionalProperties: { type: 'string' } },
|
|
40
|
-
audience: { type: 'array', items: { type: 'string' } },
|
|
41
|
-
},
|
|
42
|
-
required: ['type', 'clientId'],
|
|
43
|
-
oneOf: [{ required: ['configurationUrl'] }, { required: ['configuration'] }],
|
|
44
|
-
additionalProperties: false,
|
|
45
|
-
} as const;
|
|
46
|
-
|
|
47
|
-
const saml2ProviderConfigSchema = {
|
|
48
|
-
type: 'object',
|
|
49
|
-
properties: {
|
|
50
|
-
type: { type: 'string', const: AuthProviderType.SAML2 },
|
|
51
|
-
title: { type: 'string' },
|
|
52
|
-
issuerId: { type: 'string' },
|
|
53
|
-
entityId: { type: 'string' },
|
|
54
|
-
ssoUrl: { type: 'string' },
|
|
55
|
-
x509PublicCert: { type: 'string' },
|
|
56
|
-
teamsAttributeName: { type: 'string', default: DEFAULT_TEAM_CLAIM_NAME },
|
|
57
|
-
teamsAttributeMap: { type: 'object', additionalProperties: { type: 'string' } },
|
|
58
|
-
defaultTeams: { type: 'array', items: { type: 'string' } },
|
|
59
|
-
},
|
|
60
|
-
additionalProperties: false,
|
|
61
|
-
required: ['type', 'issuerId', 'ssoUrl', 'x509PublicCert'],
|
|
62
|
-
} as const;
|
|
63
|
-
|
|
64
|
-
const basicAuthProviderConfigSchema = {
|
|
65
|
-
type: 'object',
|
|
66
|
-
properties: {
|
|
67
|
-
type: { type: 'string', const: AuthProviderType.BASIC },
|
|
68
|
-
title: { type: 'string' },
|
|
69
|
-
credentials: {
|
|
70
|
-
type: 'array',
|
|
71
|
-
items: {
|
|
72
|
-
type: 'object',
|
|
73
|
-
properties: {
|
|
74
|
-
username: { type: 'string' },
|
|
75
|
-
password: { type: 'string' },
|
|
76
|
-
passwordHash: { type: 'string' },
|
|
77
|
-
teams: { type: 'array', items: { type: 'string' } },
|
|
78
|
-
},
|
|
79
|
-
required: ['username'],
|
|
80
|
-
additionalProperties: false,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
required: ['type', 'credentials'],
|
|
85
|
-
additionalProperties: false,
|
|
86
|
-
} as const;
|
|
87
|
-
|
|
88
|
-
const authProviderConfigSchema = {
|
|
89
|
-
oneOf: [oidcProviderConfigSchema, saml2ProviderConfigSchema, basicAuthProviderConfigSchema],
|
|
90
|
-
discriminator: { propertyName: 'type' },
|
|
91
|
-
} as const;
|
|
92
|
-
|
|
93
|
-
const ssoOnPremConfigSchema = {
|
|
94
|
-
type: 'object',
|
|
95
|
-
additionalProperties: authProviderConfigSchema,
|
|
96
|
-
} as const;
|
|
97
|
-
|
|
98
|
-
const ssoConfigSchema = {
|
|
99
|
-
oneOf: [
|
|
100
|
-
{
|
|
101
|
-
type: 'array',
|
|
102
|
-
items: {
|
|
103
|
-
type: 'string',
|
|
104
|
-
enum: ['REDOCLY', 'CORPORATE', 'GUEST'],
|
|
105
|
-
},
|
|
106
|
-
uniqueItems: true,
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
type: 'string',
|
|
110
|
-
enum: ['REDOCLY', 'CORPORATE', 'GUEST'],
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
} as const;
|
|
114
|
-
|
|
115
|
-
const redirectConfigSchema = {
|
|
116
|
-
type: 'object',
|
|
117
|
-
properties: {
|
|
118
|
-
to: { type: 'string' },
|
|
119
|
-
type: { type: 'number', default: 301 },
|
|
120
|
-
},
|
|
121
|
-
additionalProperties: false,
|
|
122
|
-
} as const;
|
|
123
|
-
|
|
124
|
-
const redirectsConfigSchema = {
|
|
125
|
-
type: 'object',
|
|
126
|
-
additionalProperties: redirectConfigSchema,
|
|
127
|
-
default: {},
|
|
128
|
-
} as const;
|
|
129
|
-
|
|
130
|
-
const apiConfigSchema = {
|
|
131
|
-
type: 'object',
|
|
132
|
-
properties: {
|
|
133
|
-
root: { type: 'string' },
|
|
134
|
-
output: { type: 'string', pattern: '(.ya?ml|.json)$' },
|
|
135
|
-
rbac: { type: 'object', additionalProperties: true },
|
|
136
|
-
theme: {
|
|
137
|
-
type: 'object',
|
|
138
|
-
properties: {
|
|
139
|
-
openapi: themeConfigSchema.properties.openapi,
|
|
140
|
-
graphql: themeConfigSchema.properties.graphql,
|
|
141
|
-
},
|
|
142
|
-
additionalProperties: false,
|
|
143
|
-
},
|
|
144
|
-
title: { type: 'string' },
|
|
145
|
-
metadata: { type: 'object', additionalProperties: true },
|
|
146
|
-
rules: { type: 'object', additionalProperties: true },
|
|
147
|
-
decorators: { type: 'object', additionalProperties: true },
|
|
148
|
-
},
|
|
149
|
-
required: ['root'],
|
|
150
|
-
} as const;
|
|
151
|
-
|
|
152
|
-
const metadataConfigSchema = {
|
|
153
|
-
type: 'object',
|
|
154
|
-
additionalProperties: true,
|
|
155
|
-
} as const;
|
|
156
|
-
|
|
157
|
-
const seoConfigSchema = {
|
|
158
|
-
type: 'object',
|
|
159
|
-
properties: {
|
|
160
|
-
title: { type: 'string' },
|
|
161
|
-
description: { type: 'string' },
|
|
162
|
-
siteUrl: { type: 'string' },
|
|
163
|
-
image: { type: 'string' },
|
|
164
|
-
keywords: {
|
|
165
|
-
oneOf: [{ type: 'array', items: { type: 'string' } }, { type: 'string' }],
|
|
166
|
-
},
|
|
167
|
-
lang: { type: 'string' },
|
|
168
|
-
jsonLd: { type: 'object' },
|
|
169
|
-
meta: {
|
|
170
|
-
type: 'array',
|
|
171
|
-
items: {
|
|
172
|
-
type: 'object',
|
|
173
|
-
properties: {
|
|
174
|
-
name: { type: 'string' },
|
|
175
|
-
content: { type: 'string' },
|
|
176
|
-
},
|
|
177
|
-
required: ['name', 'content'],
|
|
178
|
-
additionalProperties: false,
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
additionalProperties: false,
|
|
183
|
-
} as const;
|
|
184
|
-
|
|
185
|
-
const rbacScopeItemsSchema = { type: 'object', additionalProperties: { type: 'string' } } as const;
|
|
186
|
-
|
|
187
|
-
const rbacConfigSchema = {
|
|
188
|
-
type: 'object',
|
|
189
|
-
properties: {
|
|
190
|
-
cms: rbacScopeItemsSchema,
|
|
191
|
-
content: {
|
|
192
|
-
type: 'object',
|
|
193
|
-
properties: {
|
|
194
|
-
'**': rbacScopeItemsSchema,
|
|
195
|
-
},
|
|
196
|
-
additionalProperties: rbacScopeItemsSchema,
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
additionalProperties: rbacScopeItemsSchema,
|
|
200
|
-
} as const;
|
|
201
|
-
|
|
202
|
-
const graviteeAdapterConfigSchema = {
|
|
203
|
-
type: 'object',
|
|
204
|
-
properties: {
|
|
205
|
-
type: { type: 'string', const: 'GRAVITEE' },
|
|
206
|
-
apiBaseUrl: { type: 'string' },
|
|
207
|
-
env: { type: 'string' },
|
|
208
|
-
allowApiProductsOutsideCatalog: { type: 'boolean', default: false },
|
|
209
|
-
stage: { type: 'string', default: 'non-production' },
|
|
210
|
-
|
|
211
|
-
auth: { type: 'object', properties: { static: { type: 'string' } } },
|
|
212
|
-
},
|
|
213
|
-
additionalProperties: false,
|
|
214
|
-
required: ['type', 'apiBaseUrl'],
|
|
215
|
-
} as const;
|
|
216
|
-
|
|
217
|
-
const apigeeAdapterAuthOauth2Schema = {
|
|
218
|
-
type: 'object',
|
|
219
|
-
properties: {
|
|
220
|
-
type: { type: 'string', const: ApigeeDevOnboardingIntegrationAuthType.OAUTH2 },
|
|
221
|
-
tokenEndpoint: { type: 'string' },
|
|
222
|
-
clientId: { type: 'string' },
|
|
223
|
-
clientSecret: { type: 'string' },
|
|
224
|
-
},
|
|
225
|
-
additionalProperties: false,
|
|
226
|
-
required: ['type', 'tokenEndpoint', 'clientId', 'clientSecret'],
|
|
227
|
-
} as const;
|
|
228
|
-
|
|
229
|
-
const apigeeAdapterAuthServiceAccountSchema = {
|
|
230
|
-
type: 'object',
|
|
231
|
-
properties: {
|
|
232
|
-
type: { type: 'string', const: ApigeeDevOnboardingIntegrationAuthType.SERVICE_ACCOUNT },
|
|
233
|
-
serviceAccountEmail: { type: 'string' },
|
|
234
|
-
serviceAccountPrivateKey: { type: 'string' },
|
|
235
|
-
},
|
|
236
|
-
additionalProperties: false,
|
|
237
|
-
required: ['type', 'serviceAccountEmail', 'serviceAccountPrivateKey'],
|
|
238
|
-
} as const;
|
|
239
|
-
|
|
240
|
-
const apigeeXAdapterConfigSchema = {
|
|
241
|
-
type: 'object',
|
|
242
|
-
properties: {
|
|
243
|
-
type: { type: 'string', const: 'APIGEE_X' },
|
|
244
|
-
apiUrl: { type: 'string' },
|
|
245
|
-
stage: { type: 'string', default: 'non-production' },
|
|
246
|
-
organizationName: { type: 'string' },
|
|
247
|
-
ignoreApiProducts: { type: 'array', items: { type: 'string' } },
|
|
248
|
-
allowApiProductsOutsideCatalog: { type: 'boolean', default: false },
|
|
249
|
-
auth: {
|
|
250
|
-
type: 'object',
|
|
251
|
-
oneOf: [apigeeAdapterAuthOauth2Schema, apigeeAdapterAuthServiceAccountSchema],
|
|
252
|
-
discriminator: { propertyName: 'type' },
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
additionalProperties: false,
|
|
256
|
-
required: ['type', 'organizationName', 'auth'],
|
|
257
|
-
} as const;
|
|
258
|
-
|
|
259
|
-
const apigeeEdgeAdapterConfigSchema = {
|
|
260
|
-
...apigeeXAdapterConfigSchema,
|
|
261
|
-
properties: {
|
|
262
|
-
...apigeeXAdapterConfigSchema.properties,
|
|
263
|
-
type: { type: 'string', const: 'APIGEE_EDGE' },
|
|
264
|
-
},
|
|
265
|
-
} as const;
|
|
266
|
-
|
|
267
|
-
const devOnboardingAdapterConfigSchema = {
|
|
268
|
-
type: 'object',
|
|
269
|
-
oneOf: [apigeeXAdapterConfigSchema, apigeeEdgeAdapterConfigSchema, graviteeAdapterConfigSchema],
|
|
270
|
-
discriminator: { propertyName: 'type' },
|
|
271
|
-
} as const;
|
|
272
|
-
|
|
273
|
-
const devOnboardingConfigSchema = {
|
|
274
|
-
type: 'object',
|
|
275
|
-
required: ['adapters'],
|
|
276
|
-
additionalProperties: false,
|
|
277
|
-
properties: {
|
|
278
|
-
adapters: {
|
|
279
|
-
type: 'array',
|
|
280
|
-
items: devOnboardingAdapterConfigSchema,
|
|
281
|
-
},
|
|
282
|
-
},
|
|
283
|
-
} as const;
|
|
284
|
-
|
|
285
|
-
const i18ConfigSchema = {
|
|
286
|
-
type: 'object',
|
|
287
|
-
properties: {
|
|
288
|
-
defaultLocale: {
|
|
289
|
-
type: 'string',
|
|
290
|
-
},
|
|
291
|
-
locales: {
|
|
292
|
-
type: 'array',
|
|
293
|
-
items: {
|
|
294
|
-
type: 'object',
|
|
295
|
-
properties: {
|
|
296
|
-
code: {
|
|
297
|
-
type: 'string',
|
|
298
|
-
},
|
|
299
|
-
name: {
|
|
300
|
-
type: 'string',
|
|
301
|
-
},
|
|
302
|
-
},
|
|
303
|
-
required: ['code'],
|
|
304
|
-
},
|
|
305
|
-
},
|
|
306
|
-
},
|
|
307
|
-
additionalProperties: false,
|
|
308
|
-
required: ['defaultLocale'],
|
|
309
|
-
} as const;
|
|
310
|
-
|
|
311
|
-
const responseHeaderSchema = {
|
|
312
|
-
type: 'object',
|
|
313
|
-
properties: {
|
|
314
|
-
name: { type: 'string' },
|
|
315
|
-
value: { type: 'string' },
|
|
316
|
-
},
|
|
317
|
-
additionalProperties: false,
|
|
318
|
-
required: ['name', 'value'],
|
|
319
|
-
} as const;
|
|
320
|
-
|
|
321
|
-
const redoclyConfigSchema = {
|
|
322
|
-
type: 'object',
|
|
323
|
-
properties: {
|
|
324
|
-
licenseKey: { type: 'string' },
|
|
325
|
-
redirects: redirectsConfigSchema,
|
|
326
|
-
seo: seoConfigSchema,
|
|
327
|
-
rbac: rbacConfigSchema,
|
|
328
|
-
responseHeaders: {
|
|
329
|
-
type: 'object',
|
|
330
|
-
additionalProperties: {
|
|
331
|
-
type: 'array',
|
|
332
|
-
items: responseHeaderSchema,
|
|
333
|
-
},
|
|
334
|
-
},
|
|
335
|
-
mockServer: {
|
|
336
|
-
type: 'object',
|
|
337
|
-
properties: {
|
|
338
|
-
off: { type: 'boolean', default: false },
|
|
339
|
-
position: { type: 'string', enum: ['first', 'last', 'replace', 'off'], default: 'first' },
|
|
340
|
-
strictExamples: { type: 'boolean', default: false },
|
|
341
|
-
errorIfForcedExampleNotFound: { type: 'boolean', default: false },
|
|
342
|
-
description: { type: 'string' },
|
|
343
|
-
},
|
|
344
|
-
},
|
|
345
|
-
apis: {
|
|
346
|
-
type: 'object',
|
|
347
|
-
additionalProperties: apiConfigSchema,
|
|
348
|
-
},
|
|
349
|
-
ssoOnPrem: ssoOnPremConfigSchema,
|
|
350
|
-
sso: ssoConfigSchema,
|
|
351
|
-
residency: { type: 'string' },
|
|
352
|
-
developerOnboarding: devOnboardingConfigSchema,
|
|
353
|
-
i18n: i18ConfigSchema,
|
|
354
|
-
metadata: metadataConfigSchema,
|
|
355
|
-
ignore: {
|
|
356
|
-
type: 'array',
|
|
357
|
-
items: {
|
|
358
|
-
type: 'string',
|
|
359
|
-
},
|
|
360
|
-
},
|
|
361
|
-
theme: themeConfigSchema,
|
|
362
|
-
},
|
|
363
|
-
default: { redirects: {} },
|
|
364
|
-
additionalProperties: true,
|
|
365
|
-
} as const;
|
|
366
|
-
|
|
367
|
-
const environmentSchema = {
|
|
368
|
-
...redoclyConfigSchema,
|
|
369
|
-
additionalProperties: false,
|
|
370
|
-
} as const;
|
|
371
|
-
|
|
372
|
-
export const rootRedoclyConfigSchema = {
|
|
373
|
-
...redoclyConfigSchema,
|
|
374
|
-
properties: {
|
|
375
|
-
plugins: {
|
|
376
|
-
type: 'array',
|
|
377
|
-
items: { type: 'string' },
|
|
378
|
-
},
|
|
379
|
-
...redoclyConfigSchema.properties,
|
|
380
|
-
env: {
|
|
381
|
-
type: 'object',
|
|
382
|
-
additionalProperties: environmentSchema, // TODO: if we want full validation we need to override apis, theme and the root
|
|
383
|
-
},
|
|
384
|
-
},
|
|
385
|
-
default: {},
|
|
386
|
-
additionalProperties: false,
|
|
387
|
-
} as const;
|
|
388
|
-
|
|
389
|
-
export type RedoclyConfig<T = ThemeConfig> = FromSchema<typeof rootRedoclyConfigSchema> & {
|
|
390
|
-
theme?: T;
|
|
391
|
-
};
|
|
392
|
-
export type RedirectConfig = FromSchema<typeof redirectConfigSchema>;
|
|
393
|
-
export type RedirectsConfig = FromSchema<typeof redirectsConfigSchema>;
|
|
394
|
-
|
|
395
|
-
export type AuthProviderConfig = FromSchema<typeof authProviderConfigSchema>;
|
|
396
|
-
export type BasicAuthProviderConfig = FromSchema<typeof basicAuthProviderConfigSchema>;
|
|
397
|
-
export type OidcProviderConfig = FromSchema<typeof oidcProviderConfigSchema>;
|
|
398
|
-
export type Saml2ProviderConfig = FromSchema<typeof saml2ProviderConfigSchema>;
|
|
399
|
-
export type SeoConfig = FromSchema<typeof seoConfigSchema>;
|
|
400
|
-
export type RbacConfig = FromSchema<typeof rbacConfigSchema>;
|
|
401
|
-
export type RbacScopeItems = FromSchema<typeof rbacScopeItemsSchema>;
|
|
402
|
-
export type OidcIssuerMetadata = FromSchema<typeof oidcIssuerMetadataSchema>;
|
|
403
|
-
|
|
404
|
-
export type DevOnboardingAdapterConfig = FromSchema<typeof devOnboardingAdapterConfigSchema>;
|
|
405
|
-
export type GraviteeAdapterConfig = FromSchema<typeof graviteeAdapterConfigSchema>;
|
|
406
|
-
export type ApigeeAdapterConfig = FromSchema<
|
|
407
|
-
typeof apigeeXAdapterConfigSchema | typeof apigeeEdgeAdapterConfigSchema
|
|
408
|
-
>;
|
|
409
|
-
export type ApigeeAdapterAuthOauth2 = FromSchema<typeof apigeeAdapterAuthOauth2Schema>;
|
|
410
|
-
export type ApigeeAdapterAuthServiceAccount = FromSchema<
|
|
411
|
-
typeof apigeeAdapterAuthServiceAccountSchema
|
|
412
|
-
>;
|
|
413
|
-
export type SsoConfig = FromSchema<typeof ssoOnPremConfigSchema>;
|
|
414
|
-
export type I18nConfig = FromSchema<typeof i18ConfigSchema>;
|
|
415
|
-
|
|
416
|
-
export type ApiConfig = FromSchema<typeof apiConfigSchema>;
|