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