@redocly/config 0.6.2 → 0.7.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.
@@ -0,0 +1,519 @@
1
+ "use strict";
2
+ // Needed for supporting deprecated Reference Docs config options
3
+ // Transferred from https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/types/redocly-yaml.ts
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.deprecatedRefDocsSchema = void 0;
6
+ const ConfigLanguage = {
7
+ type: 'object',
8
+ properties: {
9
+ label: { type: 'string' },
10
+ lang: {
11
+ enum: [
12
+ 'curl',
13
+ 'C#',
14
+ 'Go',
15
+ 'Java',
16
+ 'Java8+Apache',
17
+ 'JavaScript',
18
+ 'Node.js',
19
+ 'PHP',
20
+ 'Python',
21
+ 'R',
22
+ 'Ruby',
23
+ ],
24
+ },
25
+ },
26
+ required: ['lang'],
27
+ };
28
+ const ConfigLabels = {
29
+ type: 'object',
30
+ properties: {
31
+ enum: { type: 'string' },
32
+ enumSingleValue: { type: 'string' },
33
+ enumArray: { type: 'string' },
34
+ default: { type: 'string' },
35
+ deprecated: { type: 'string' },
36
+ example: { type: 'string' },
37
+ examples: { type: 'string' },
38
+ nullable: { type: 'string' },
39
+ recursive: { type: 'string' },
40
+ arrayOf: { type: 'string' },
41
+ webhook: { type: 'string' },
42
+ authorizations: { type: 'string' },
43
+ tryItAuthBasicUsername: { type: 'string' },
44
+ tryItAuthBasicPassword: { type: 'string' },
45
+ },
46
+ };
47
+ const CommonConfigSidebarLinks = {
48
+ type: 'object',
49
+ properties: {
50
+ label: { type: 'string' },
51
+ link: { type: 'string' },
52
+ target: { type: 'string' },
53
+ },
54
+ required: ['label', 'link'],
55
+ };
56
+ const ConfigSidebarLinks = {
57
+ type: 'object',
58
+ properties: {
59
+ beforeInfo: { type: 'array', items: CommonConfigSidebarLinks },
60
+ end: { type: 'array', items: CommonConfigSidebarLinks },
61
+ },
62
+ };
63
+ const CommonThemeColors = {
64
+ type: 'object',
65
+ properties: {
66
+ main: { type: 'string' },
67
+ light: { type: 'string' },
68
+ dark: { type: 'string' },
69
+ contrastText: { type: 'string' },
70
+ },
71
+ };
72
+ const CommonColorProps = {
73
+ type: 'object',
74
+ properties: {
75
+ backgroundColor: { type: 'string' },
76
+ borderColor: { type: 'string' },
77
+ color: { type: 'string' },
78
+ tabTextColor: { type: 'string' },
79
+ },
80
+ };
81
+ const BorderThemeColors = {
82
+ type: 'object',
83
+ properties: pickObjectProps(CommonThemeColors.properties, ['light', 'dark']),
84
+ };
85
+ const HttpColors = {
86
+ type: 'object',
87
+ properties: {
88
+ basic: { type: 'string' },
89
+ delete: { type: 'string' },
90
+ get: { type: 'string' },
91
+ head: { type: 'string' },
92
+ link: { type: 'string' },
93
+ options: { type: 'string' },
94
+ patch: { type: 'string' },
95
+ post: { type: 'string' },
96
+ put: { type: 'string' },
97
+ },
98
+ };
99
+ const ResponseColors = {
100
+ type: 'object',
101
+ properties: {
102
+ error: CommonColorProps,
103
+ info: CommonColorProps,
104
+ redirect: CommonColorProps,
105
+ success: CommonColorProps,
106
+ },
107
+ };
108
+ const SecondaryColors = {
109
+ type: 'object',
110
+ properties: omitObjectProps(CommonThemeColors.properties, ['dark']),
111
+ };
112
+ const TextThemeColors = {
113
+ type: 'object',
114
+ properties: {
115
+ primary: { type: 'string' },
116
+ secondary: { type: 'string' },
117
+ light: { type: 'string' },
118
+ },
119
+ };
120
+ const ThemeColors = {
121
+ type: 'object',
122
+ properties: {
123
+ accent: CommonThemeColors,
124
+ border: BorderThemeColors,
125
+ error: CommonThemeColors,
126
+ http: HttpColors,
127
+ primary: CommonThemeColors,
128
+ responses: ResponseColors,
129
+ secondary: SecondaryColors,
130
+ success: CommonThemeColors,
131
+ text: TextThemeColors,
132
+ tonalOffset: { type: 'number' },
133
+ warning: CommonThemeColors,
134
+ },
135
+ };
136
+ const SizeProps = {
137
+ type: 'object',
138
+ properties: {
139
+ fontSize: { type: 'string' },
140
+ padding: { type: 'string' },
141
+ minWidth: { type: 'string' },
142
+ },
143
+ };
144
+ const Sizes = {
145
+ type: 'object',
146
+ properties: {
147
+ small: SizeProps,
148
+ medium: SizeProps,
149
+ large: SizeProps,
150
+ xlarge: SizeProps,
151
+ },
152
+ };
153
+ const FontConfig = {
154
+ type: 'object',
155
+ properties: {
156
+ fontFamily: { type: 'string' },
157
+ fontSize: { type: 'string' },
158
+ fontWeight: { type: 'string' },
159
+ lineHeight: { type: 'string' },
160
+ },
161
+ };
162
+ const ButtonsConfig = {
163
+ type: 'object',
164
+ properties: Object.assign(Object.assign({}, omitObjectProps(FontConfig.properties, ['fontSize', 'lineHeight'])), { borderRadius: { type: 'string' }, hoverStyle: { type: 'string' }, boxShadow: { type: 'string' }, hoverBoxShadow: { type: 'string' }, sizes: Sizes }),
165
+ };
166
+ const BadgeFontConfig = {
167
+ type: 'object',
168
+ properties: pickObjectProps(FontConfig.properties, ['fontSize', 'lineHeight']),
169
+ };
170
+ const BadgeSizes = {
171
+ type: 'object',
172
+ properties: {
173
+ medium: BadgeFontConfig,
174
+ small: BadgeFontConfig,
175
+ },
176
+ };
177
+ const HttpBadgesConfig = {
178
+ type: 'object',
179
+ properties: Object.assign(Object.assign({}, omitObjectProps(FontConfig.properties, ['fontSize', 'lineHeight'])), { borderRadius: { type: 'string' }, color: { type: 'string' }, sizes: BadgeSizes }),
180
+ };
181
+ const LabelControls = {
182
+ type: 'object',
183
+ properties: {
184
+ top: { type: 'string' },
185
+ width: { type: 'string' },
186
+ height: { type: 'string' },
187
+ },
188
+ };
189
+ const Panels = {
190
+ type: 'object',
191
+ properties: {
192
+ borderRadius: { type: 'string' },
193
+ backgroundColor: { type: 'string' },
194
+ },
195
+ };
196
+ const TryItButton = {
197
+ type: 'object',
198
+ properties: {
199
+ fullWidth: { type: 'boolean' },
200
+ },
201
+ };
202
+ const ConfigThemeComponents = {
203
+ type: 'object',
204
+ properties: {
205
+ buttons: ButtonsConfig,
206
+ httpBadges: HttpBadgesConfig,
207
+ layoutControls: LabelControls,
208
+ panels: Panels,
209
+ tryItButton: TryItButton,
210
+ tryItSendButton: TryItButton,
211
+ },
212
+ };
213
+ const Breakpoints = {
214
+ type: 'object',
215
+ properties: {
216
+ small: { type: 'string' },
217
+ medium: { type: 'string' },
218
+ large: { type: 'string' },
219
+ },
220
+ };
221
+ const StackedConfig = {
222
+ type: 'object',
223
+ properties: {
224
+ maxWidth: Breakpoints,
225
+ },
226
+ };
227
+ const ThreePanelConfig = {
228
+ type: 'object',
229
+ properties: {
230
+ maxWidth: Breakpoints,
231
+ middlePanelMaxWidth: Breakpoints,
232
+ },
233
+ };
234
+ const Layout = {
235
+ type: 'object',
236
+ properties: {
237
+ showDarkRightPanel: { type: 'boolean' },
238
+ stacked: StackedConfig,
239
+ 'three-panel': ThreePanelConfig,
240
+ },
241
+ };
242
+ const SchemaColorsConfig = {
243
+ type: 'object',
244
+ properties: {
245
+ backgroundColor: { type: 'string' },
246
+ border: { type: 'string' },
247
+ },
248
+ };
249
+ const ConfigThemeSchema = {
250
+ type: 'object',
251
+ properties: {
252
+ breakFieldNames: { type: 'boolean' },
253
+ caretColor: { type: 'string' },
254
+ caretSize: { type: 'string' },
255
+ constraints: SchemaColorsConfig,
256
+ defaultDetailsWidth: { type: 'string' },
257
+ examples: SchemaColorsConfig,
258
+ labelsTextSize: { type: 'string' },
259
+ linesColor: { type: 'string' },
260
+ nestedBackground: { type: 'string' },
261
+ nestingSpacing: { type: 'string' },
262
+ requireLabelColor: { type: 'string' },
263
+ typeNameColor: { type: 'string' },
264
+ typeTitleColor: { type: 'string' },
265
+ },
266
+ };
267
+ const GroupItemsConfig = {
268
+ type: 'object',
269
+ properties: {
270
+ subItemsColor: { type: 'string' },
271
+ textTransform: { type: 'string' },
272
+ fontWeight: { type: 'string' },
273
+ },
274
+ };
275
+ const Level1Items = {
276
+ type: 'object',
277
+ properties: pickObjectProps(GroupItemsConfig.properties, ['textTransform']),
278
+ };
279
+ const SpacingConfig = {
280
+ type: 'object',
281
+ properties: {
282
+ unit: { type: 'number' },
283
+ paddingHorizontal: { type: 'string' },
284
+ paddingVertical: { type: 'string' },
285
+ offsetTop: { type: 'string' },
286
+ offsetLeft: { type: 'string' },
287
+ offsetNesting: { type: 'string' },
288
+ },
289
+ };
290
+ const Sidebar = {
291
+ type: 'object',
292
+ properties: Object.assign(Object.assign({}, omitObjectProps(FontConfig.properties, ['fontWeight', 'lineHeight'])), { activeBgColor: { type: 'string' }, activeTextColor: { type: 'string' }, backgroundColor: { type: 'string' }, borderRadius: { type: 'string' }, breakPath: { type: 'boolean' }, caretColor: { type: 'string' }, caretSize: { type: 'string' }, groupItems: GroupItemsConfig, level1items: Level1Items, rightLineColor: { type: 'string' }, separatorLabelColor: { type: 'string' }, showAtBreakpoint: { type: 'string' }, spacing: SpacingConfig, textColor: { type: 'string' }, width: { type: 'string' } }),
293
+ };
294
+ const Heading = {
295
+ type: 'object',
296
+ properties: Object.assign(Object.assign({}, FontConfig.properties), { color: { type: 'string' }, transform: { type: 'string' } }),
297
+ };
298
+ const CodeConfig = {
299
+ type: 'object',
300
+ properties: Object.assign(Object.assign({}, FontConfig.properties), { backgroundColor: { type: 'string' }, color: { type: 'string' }, wordBreak: {
301
+ type: 'string',
302
+ enum: [
303
+ 'break-all',
304
+ 'break-word',
305
+ 'keep-all',
306
+ 'normal',
307
+ 'revert',
308
+ 'unset',
309
+ 'inherit',
310
+ 'initial',
311
+ ],
312
+ }, wrap: { type: 'boolean' } }),
313
+ };
314
+ const HeadingsConfig = {
315
+ type: 'object',
316
+ properties: omitObjectProps(FontConfig.properties, ['fontSize']),
317
+ };
318
+ const LinksConfig = {
319
+ type: 'object',
320
+ properties: {
321
+ color: { type: 'string' },
322
+ hover: { type: 'string' },
323
+ textDecoration: { type: 'string' },
324
+ hoverTextDecoration: { type: 'string' },
325
+ visited: { type: 'string' },
326
+ },
327
+ };
328
+ const Typography = {
329
+ type: 'object',
330
+ properties: Object.assign(Object.assign({ code: CodeConfig, fieldName: FontConfig }, pickObjectProps(FontConfig.properties, ['fontSize', 'fontFamily'])), { fontWeightBold: { type: 'string' }, fontWeightLight: { type: 'string' }, fontWeightRegular: { type: 'string' }, heading1: Heading, heading2: Heading, heading3: Heading, headings: HeadingsConfig, lineHeight: { type: 'string' }, links: LinksConfig, optimizeSpeed: { type: 'boolean' }, rightPanelHeading: Heading, smoothing: {
331
+ type: 'string',
332
+ enum: ['auto', 'none', 'antialiased', 'subpixel-antialiased', 'grayscale'],
333
+ } }),
334
+ };
335
+ const TokenProps = {
336
+ type: 'object',
337
+ properties: Object.assign({ color: { type: 'string' } }, omitObjectProps(FontConfig.properties, ['fontWeight'])),
338
+ };
339
+ const CodeBlock = {
340
+ type: 'object',
341
+ properties: {
342
+ backgroundColor: { type: 'string' },
343
+ borderRadius: { type: 'string' },
344
+ tokens: TokenProps,
345
+ },
346
+ };
347
+ const ConfigThemeLogo = {
348
+ type: 'object',
349
+ properties: {
350
+ gutter: { type: 'string' },
351
+ maxHeight: { type: 'string' },
352
+ maxWidth: { type: 'string' },
353
+ },
354
+ };
355
+ const Fab = {
356
+ type: 'object',
357
+ properties: {
358
+ backgroundColor: { type: 'string' },
359
+ color: { type: 'string' },
360
+ },
361
+ };
362
+ const ButtonOverrides = {
363
+ type: 'object',
364
+ properties: {
365
+ custom: { type: 'string' },
366
+ },
367
+ };
368
+ const Overrides = {
369
+ type: 'object',
370
+ properties: {
371
+ DownloadButton: ButtonOverrides,
372
+ NextSectionButton: ButtonOverrides,
373
+ },
374
+ };
375
+ const RightPanel = {
376
+ type: 'object',
377
+ properties: {
378
+ backgroundColor: { type: 'string' },
379
+ panelBackgroundColor: { type: 'string' },
380
+ panelControlsBackgroundColor: { type: 'string' },
381
+ showAtBreakpoint: { type: 'string' },
382
+ textColor: { type: 'string' },
383
+ width: { type: 'string' },
384
+ },
385
+ };
386
+ const Shape = {
387
+ type: 'object',
388
+ properties: { borderRadius: { type: 'string' } },
389
+ };
390
+ const ThemeSpacing = {
391
+ type: 'object',
392
+ properties: {
393
+ sectionHorizontal: { type: 'number' },
394
+ sectionVertical: { type: 'number' },
395
+ unit: { type: 'number' },
396
+ },
397
+ };
398
+ const ConfigTheme = {
399
+ type: 'object',
400
+ properties: {
401
+ breakpoints: Breakpoints,
402
+ codeBlock: CodeBlock,
403
+ colors: ThemeColors,
404
+ components: ConfigThemeComponents,
405
+ layout: Layout,
406
+ logo: ConfigThemeLogo,
407
+ fab: Fab,
408
+ overrides: Overrides,
409
+ rightPanel: RightPanel,
410
+ schema: ConfigThemeSchema,
411
+ shape: Shape,
412
+ sidebar: Sidebar,
413
+ spacing: ThemeSpacing,
414
+ typography: Typography,
415
+ links: { properties: { color: { type: 'string' } } },
416
+ codeSample: { properties: { backgroundColor: { type: 'string' } } },
417
+ },
418
+ };
419
+ const GenerateCodeSamples = {
420
+ type: 'object',
421
+ properties: {
422
+ skipOptionalParameters: { type: 'boolean' },
423
+ languages: { type: 'array', items: ConfigLanguage },
424
+ },
425
+ required: ['languages'],
426
+ };
427
+ exports.deprecatedRefDocsSchema = {
428
+ type: 'object',
429
+ properties: {
430
+ theme: ConfigTheme,
431
+ ctrlFHijack: { type: 'boolean' },
432
+ defaultSampleLanguage: { type: 'string' },
433
+ disableDeepLinks: { type: 'boolean' },
434
+ disableSearch: { type: 'boolean' },
435
+ disableSidebar: { type: 'boolean' },
436
+ downloadDefinitionUrl: { type: 'string' },
437
+ expandDefaultServerVariables: { type: 'boolean' },
438
+ enumSkipQuotes: { type: 'boolean' },
439
+ expandDefaultRequest: { type: 'boolean' },
440
+ expandDefaultResponse: { type: 'boolean' },
441
+ expandResponses: { type: 'string' },
442
+ expandSingleSchemaField: { type: 'boolean' },
443
+ generateCodeSamples: GenerateCodeSamples,
444
+ generatedPayloadSamplesMaxDepth: { type: 'number' },
445
+ hideDownloadButton: { type: 'boolean' },
446
+ hideHostname: { type: 'boolean' },
447
+ hideInfoSection: { type: 'boolean' },
448
+ hideLogo: { type: 'boolean' },
449
+ hideRequestPayloadSample: { type: 'boolean' },
450
+ hideRightPanel: { type: 'boolean' },
451
+ hideSchemaPattern: { type: 'boolean' },
452
+ hideSingleRequestSampleTab: { type: 'boolean' },
453
+ hideSecuritySection: { type: 'boolean' },
454
+ hideTryItPanel: { type: 'boolean' },
455
+ hideFab: { type: 'boolean' },
456
+ hideOneOfDescription: { type: 'boolean' },
457
+ htmlTemplate: { type: 'string' },
458
+ jsonSampleExpandLevel: {
459
+ oneOf: [{ type: 'number', minimum: 1 }, { type: 'string' }],
460
+ },
461
+ labels: ConfigLabels,
462
+ menuToggle: { type: 'boolean' },
463
+ nativeScrollbars: { type: 'boolean' },
464
+ noAutoAuth: { type: 'boolean' },
465
+ onDeepLinkClick: { type: 'object' },
466
+ pagination: { enum: ['none', 'section', 'item'] },
467
+ pathInMiddlePanel: { type: 'boolean' },
468
+ payloadSampleIdx: { type: 'number', minimum: 0 },
469
+ requestInterceptor: { type: 'object' },
470
+ requiredPropsFirst: { type: 'boolean' },
471
+ routingStrategy: { type: 'string' },
472
+ samplesTabsMaxCount: { type: 'number' },
473
+ schemaExpansionLevel: {
474
+ oneOf: [{ type: 'number', minimum: 0 }, { type: 'string' }],
475
+ },
476
+ minCharacterLengthToInitSearch: { type: 'number', minimum: 1 },
477
+ maxResponseHeadersToShowInTryIt: { type: 'number', minimum: 0 },
478
+ scrollYOffset: {
479
+ oneOf: [{ type: 'number' }, { type: 'string' }],
480
+ },
481
+ searchAutoExpand: { type: 'boolean' },
482
+ searchFieldLevelBoost: { type: 'number', minimum: 0 },
483
+ searchMaxDepth: { type: 'number', minimum: 1 },
484
+ searchMode: { type: 'string', enum: ['default', 'path-only'] },
485
+ searchOperationTitleBoost: { type: 'number' },
486
+ searchTagTitleBoost: { type: 'number' },
487
+ sendXUserAgentInTryIt: { type: 'boolean' },
488
+ showChangeLayoutButton: { type: 'boolean' },
489
+ showConsole: { type: 'boolean' },
490
+ showNextButton: { type: 'boolean' },
491
+ showRightPanelToggle: { type: 'boolean' },
492
+ showSecuritySchemeType: { type: 'boolean' },
493
+ showWebhookVerb: { type: 'boolean' },
494
+ showObjectSchemaExamples: { type: 'boolean' },
495
+ disableTryItRequestUrlEncoding: { type: 'boolean' },
496
+ sidebarLinks: ConfigSidebarLinks,
497
+ sideNavStyle: { type: 'string', enum: ['summary-only', 'path-first', 'id-only'] },
498
+ simpleOneOfTypeLabel: { type: 'boolean' },
499
+ sortEnumValuesAlphabetically: { type: 'boolean' },
500
+ sortOperationsAlphabetically: { type: 'boolean' },
501
+ sortPropsAlphabetically: { type: 'boolean' },
502
+ sortTagsAlphabetically: { type: 'boolean' },
503
+ suppressWarnings: { type: 'boolean' },
504
+ unstable_externalDescription: { type: 'boolean' },
505
+ unstable_ignoreMimeParameters: { type: 'boolean' },
506
+ untrustedDefinition: { type: 'boolean' },
507
+ showAccessMode: { type: 'boolean' },
508
+ preserveOriginalExtensionsName: { type: 'boolean' },
509
+ markdownHeadingsAnchorLevel: { type: 'number' },
510
+ },
511
+ additionalProperties: false,
512
+ };
513
+ function pickObjectProps(object, keys) {
514
+ return Object.fromEntries(keys.filter((key) => key in object).map((key) => [key, object[key]]));
515
+ }
516
+ function omitObjectProps(object, keys) {
517
+ return Object.fromEntries(Object.entries(object).filter(([key]) => !keys.includes(key)));
518
+ }
519
+ //# sourceMappingURL=reference-docs-config-schema.js.map