@redocly/config 0.8.2 → 0.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.
@@ -1,640 +1,42 @@
1
- import { redocConfigSchema } from './redoc-config-schema';
2
1
  import { graphqlConfigSchema } from './graphql-config-schema';
3
- import { deprecatedRefDocsSchema } from './reference-docs-config-schema';
4
- const logoConfigSchema = {
5
- type: 'object',
6
- properties: {
7
- image: { type: 'string' },
8
- srcSet: { type: 'string' },
9
- altText: { type: 'string' },
10
- link: { type: 'string' },
11
- favicon: { type: 'string' },
12
- },
13
- additionalProperties: false,
14
- };
15
- const hideConfigSchema = {
16
- type: 'object',
17
- properties: {
18
- hide: { type: 'boolean' },
19
- },
20
- additionalProperties: false,
21
- };
22
- const scriptConfigSchema = {
23
- type: 'object',
24
- properties: {
25
- src: { type: 'string' },
26
- async: { type: 'boolean' },
27
- crossorigin: { type: 'string' },
28
- defer: { type: 'boolean' },
29
- fetchpriority: { type: 'string' },
30
- integrity: { type: 'string' },
31
- module: { type: 'boolean' },
32
- nomodule: { type: 'boolean' },
33
- nonce: { type: 'string' },
34
- referrerpolicy: { type: 'string' },
35
- type: { type: 'string' },
36
- },
37
- required: ['src'],
38
- additionalProperties: true,
39
- };
40
- const linksConfigSchema = {
41
- type: 'object',
42
- properties: {
43
- href: { type: 'string' },
44
- as: { type: 'string' },
45
- crossorigin: { type: 'string' },
46
- fetchpriority: { type: 'string' },
47
- hreflang: { type: 'string' },
48
- imagesizes: { type: 'string' },
49
- imagesrcset: { type: 'string' },
50
- integrity: { type: 'string' },
51
- media: { type: 'string' },
52
- prefetch: { type: 'string' },
53
- referrerpolicy: { type: 'string' },
54
- rel: { type: 'string' },
55
- sizes: { type: 'string' },
56
- title: { type: 'string' },
57
- type: { type: 'string' },
58
- },
59
- required: ['href'],
60
- additionalProperties: true,
61
- };
62
- export const markdownConfigSchema = {
63
- type: 'object',
64
- properties: {
65
- frontMatterKeysToResolve: {
66
- type: 'array',
67
- items: { type: 'string' },
68
- default: ['image', 'links'],
69
- },
70
- partialsFolders: {
71
- type: 'array',
72
- items: { type: 'string' },
73
- default: ['_partials'],
74
- },
75
- lastUpdatedBlock: {
76
- type: 'object',
77
- properties: Object.assign({ format: {
78
- type: 'string',
79
- enum: ['timeago', 'iso', 'long', 'short'],
80
- default: 'timeago',
81
- }, locale: { type: 'string' } }, hideConfigSchema.properties),
82
- additionalProperties: false,
83
- default: {},
84
- },
85
- toc: {
86
- type: 'object',
87
- properties: Object.assign({ header: { type: 'string', default: 'On this page' }, depth: { type: 'integer', default: 3, minimum: 1 } }, hideConfigSchema.properties),
88
- additionalProperties: false,
89
- default: {},
90
- },
91
- editPage: {
92
- type: 'object',
93
- properties: Object.assign({ baseUrl: { type: 'string' } }, hideConfigSchema.properties),
94
- additionalProperties: false,
95
- default: {},
96
- },
97
- },
98
- additionalProperties: false,
99
- default: {},
100
- };
101
- export const amplitudeAnalyticsConfigSchema = {
102
- type: 'object',
103
- properties: {
104
- includeInDevelopment: { type: 'boolean' },
105
- apiKey: { type: 'string' },
106
- head: { type: 'boolean' },
107
- respectDNT: { type: 'boolean' },
108
- exclude: { type: 'array', items: { type: 'string' } },
109
- outboundClickEventName: { type: 'string' },
110
- pageViewEventName: { type: 'string' },
111
- amplitudeConfig: { type: 'object', additionalProperties: true },
112
- },
113
- additionalProperties: false,
114
- required: ['apiKey'],
115
- };
116
- export const fullstoryAnalyticsConfigSchema = {
117
- type: 'object',
118
- properties: {
119
- includeInDevelopment: { type: 'boolean' },
120
- orgId: { type: 'string' },
121
- },
122
- additionalProperties: false,
123
- required: ['orgId'],
124
- };
125
- export const heapAnalyticsConfigSchema = {
126
- type: 'object',
127
- properties: {
128
- includeInDevelopment: { type: 'boolean' },
129
- appId: { type: 'string' },
130
- },
131
- additionalProperties: false,
132
- required: ['appId'],
133
- };
134
- export const rudderstackAnalyticsConfigSchema = {
135
- type: 'object',
136
- properties: {
137
- includeInDevelopment: { type: 'boolean' },
138
- writeKey: { type: 'string', minLength: 10 },
139
- trackPage: { type: 'boolean' },
140
- dataPlaneUrl: { type: 'string' },
141
- controlPlaneUrl: { type: 'string' },
142
- sdkUrl: { type: 'string' },
143
- loadOptions: { type: 'object', additionalProperties: true },
144
- },
145
- additionalProperties: false,
146
- required: ['writeKey'],
147
- };
148
- export const segmentAnalyticsConfigSchema = {
149
- type: 'object',
150
- properties: {
151
- includeInDevelopment: { type: 'boolean' },
152
- writeKey: { type: 'string', minLength: 10 },
153
- trackPage: { type: 'boolean' },
154
- includeTitleInPageCall: { type: 'boolean' },
155
- host: { type: 'string' },
156
- },
157
- additionalProperties: false,
158
- required: ['writeKey'],
159
- };
160
- export const gtmAnalyticsConfigSchema = {
161
- type: 'object',
162
- properties: {
163
- includeInDevelopment: { type: 'boolean' },
164
- trackingId: { type: 'string' },
165
- gtmAuth: { type: 'string' },
166
- gtmPreview: { type: 'string' },
167
- defaultDataLayer: {},
168
- dataLayerName: { type: 'string' },
169
- enableWebVitalsTracking: { type: 'boolean' },
170
- selfHostedOrigin: { type: 'string' },
171
- pageViewEventName: { type: 'string' },
172
- },
173
- additionalProperties: false,
174
- required: ['trackingId'],
175
- };
176
- export const productGoogleAnalyticsConfigSchema = {
177
- type: 'object',
178
- properties: {
179
- includeInDevelopment: { type: 'boolean' },
180
- trackingId: { type: 'string' },
181
- conversionId: { type: 'string' },
182
- floodlightId: { type: 'string' },
183
- optimizeId: { type: 'string' },
184
- exclude: { type: 'array', items: { type: 'string' } },
185
- },
186
- additionalProperties: false,
187
- required: ['trackingId'],
188
- };
189
- export const googleAnalyticsConfigSchema = {
190
- type: 'object',
191
- properties: {
192
- includeInDevelopment: { type: 'boolean' },
193
- trackingId: { type: 'string' },
194
- conversionId: { type: 'string' },
195
- floodlightId: { type: 'string' },
196
- head: { type: 'boolean' },
197
- respectDNT: { type: 'boolean' },
198
- exclude: { type: 'array', items: { type: 'string' } },
199
- optimizeId: { type: 'string' },
200
- anonymizeIp: { type: 'boolean' },
201
- cookieExpires: { type: 'number' },
202
- // All enabled tracking configs
203
- trackers: {
204
- type: 'object',
205
- additionalProperties: productGoogleAnalyticsConfigSchema,
206
- },
207
- },
208
- additionalProperties: false,
209
- required: ['trackingId'],
210
- };
211
- const adobeAnalyticsConfigSchema = {
212
- type: 'object',
213
- properties: {
214
- includeInDevelopment: { type: 'boolean' },
215
- scriptUrl: { type: 'string' },
216
- pageViewEventName: { type: 'string' },
217
- },
218
- additionalProperties: false,
219
- required: ['scriptUrl'],
220
- };
221
- const navItemSchema = {
222
- type: 'object',
223
- properties: {
224
- page: { type: 'string' },
225
- directory: { type: 'string' },
226
- disconnect: { type: 'boolean', default: false },
227
- group: { type: 'string' },
228
- label: { type: 'string' },
229
- href: { type: 'string' },
230
- external: { type: 'boolean' },
231
- labelTranslationKey: { type: 'string' },
232
- groupTranslationKey: { type: 'string' },
233
- icon: {
234
- oneOf: [
235
- { type: 'string' },
236
- { type: 'object', properties: { srcSet: { type: 'string' } }, required: ['srcSet'] },
237
- ],
238
- },
239
- separator: { type: 'string' },
240
- separatorLine: { type: 'boolean' },
241
- linePosition: {
242
- type: 'string',
243
- enum: ['top', 'bottom'],
244
- default: 'top',
245
- },
246
- version: { type: 'string' },
247
- menuStyle: { type: 'string', enum: ['drilldown'] },
248
- expanded: { type: 'string', const: 'always' },
249
- selectFirstItemOnExpand: { type: 'boolean' },
250
- flatten: { type: 'boolean' },
251
- linkedSidebars: {
252
- type: 'array',
253
- items: { type: 'string' },
254
- },
255
- // Allow users to eject the navbar and implement additional levels of nesting
256
- items: { type: 'array', items: { type: 'object', additionalProperties: true } },
257
- },
258
- };
259
- const navItemsSchema = {
260
- type: 'array',
261
- items: Object.assign(Object.assign({}, navItemSchema), { properties: Object.assign(Object.assign({}, navItemSchema.properties), { items: { type: 'array', items: navItemSchema } }) }),
262
- };
263
- export const productConfigSchema = {
264
- type: 'object',
265
- properties: {
266
- name: { type: 'string' },
267
- icon: { type: 'string' },
268
- folder: { type: 'string' },
269
- },
270
- additionalProperties: false,
271
- required: ['name', 'folder'],
272
- };
273
- const suggestedPageSchema = {
274
- type: 'object',
275
- properties: {
276
- page: { type: 'string' },
277
- label: { type: 'string' },
278
- labelTranslationKey: { type: 'string' },
279
- },
280
- required: ['page'],
281
- };
282
- export const catalogFilterSchema = {
283
- type: 'object',
284
- additionalProperties: false,
285
- required: ['title', 'property'],
286
- properties: {
287
- type: {
288
- type: 'string',
289
- enum: ['select', 'checkboxes', 'date-range'],
290
- default: 'checkboxes',
291
- },
292
- title: { type: 'string' },
293
- titleTranslationKey: { type: 'string' },
294
- property: { type: 'string' },
295
- parentFilter: { type: 'string' },
296
- valuesMapping: { type: 'object', additionalProperties: { type: 'string' } },
297
- missingCategoryName: { type: 'string' },
298
- missingCategoryNameTranslationKey: { type: 'string' },
299
- options: { type: 'array', items: { type: 'string' } },
300
- },
301
- };
302
- export const scorecardConfigSchema = {
303
- type: 'object',
304
- additionalProperties: true,
305
- required: [],
306
- properties: {
307
- ignoreNonCompliant: { type: 'boolean', default: false },
308
- teamMetadataProperty: {
309
- type: 'object',
310
- properties: {
311
- property: { type: 'string' },
312
- label: { type: 'string' },
313
- default: { type: 'string' },
314
- },
315
- },
316
- levels: {
317
- type: 'array',
318
- items: {
319
- type: 'object',
320
- required: ['name'],
321
- properties: {
322
- name: { type: 'string' },
323
- color: { type: 'string' },
324
- extends: { type: 'array', items: { type: 'string' } },
325
- rules: {
326
- type: 'object',
327
- additionalProperties: {
328
- oneOf: [{ type: 'string' }, { type: 'object' }],
329
- },
330
- },
331
- },
332
- additionalProperties: false,
333
- },
334
- },
335
- targets: {
336
- type: 'array',
337
- items: {
338
- type: 'object',
339
- required: ['where'],
340
- properties: {
341
- minimumLevel: { type: 'string' },
342
- where: {
343
- type: 'object',
344
- required: ['metadata'],
345
- properties: {
346
- metadata: { type: 'object', additionalProperties: { type: 'string' } },
347
- },
348
- additionalProperties: false,
349
- },
350
- },
351
- additionalProperties: false,
352
- },
353
- },
354
- },
355
- };
356
- export const catalogSchema = {
357
- type: 'object',
358
- additionalProperties: true,
359
- required: ['slug', 'items'],
360
- properties: {
361
- slug: { type: 'string' },
362
- filters: { type: 'array', items: catalogFilterSchema },
363
- groupByFirstFilter: { type: 'boolean' },
364
- filterValuesCasing: {
365
- type: 'string',
366
- enum: ['sentence', 'original', 'lowercase', 'uppercase'],
367
- },
368
- items: navItemsSchema,
369
- requiredPermission: { type: 'string' },
370
- separateVersions: { type: 'boolean' },
371
- title: { type: 'string' },
372
- titleTranslationKey: { type: 'string' },
373
- description: { type: 'string' },
374
- descriptionTranslationKey: { type: 'string' },
375
- },
376
- };
377
- const catalogsConfigSchema = {
378
- type: 'object',
379
- patternProperties: {
380
- '.*': catalogSchema,
381
- },
382
- };
2
+ import { feedbackConfigSchema } from './feedback-config-schema';
3
+ import { logoConfigSchema, analyticsConfigSchema, breadcrumbsConfigSchema, catalogsConfigSchema, codeSnippetConfigSchema, colorModeConfigSchema, footerConfigSchema, linksConfigSchema, markdownConfigSchema, navbarConfigSchema, navigationConfigSchema, openapiConfigSchema, productGoogleAnalyticsConfigSchema, productsConfigSchema, scorecardConfigSchema, scriptsConfigSchema, searchConfigSchema, sidebarConfigSchema, userMenuConfigSchema, versionPickerConfigSchema, } from './ex-theme-config-schemas';
383
4
  export const themeConfigSchema = {
384
5
  type: 'object',
385
6
  properties: {
7
+ /**
8
+ * @deprecated Should use `plugins` instead
9
+ */
386
10
  imports: {
387
11
  type: 'array',
388
12
  items: { type: 'string' },
389
- default: [],
390
13
  },
391
14
  logo: logoConfigSchema,
392
- navbar: {
393
- type: 'object',
394
- properties: Object.assign({ items: navItemsSchema }, hideConfigSchema.properties),
395
- additionalProperties: false,
396
- },
397
- products: {
398
- type: 'object',
399
- additionalProperties: productConfigSchema,
400
- },
401
- footer: {
402
- type: 'object',
403
- properties: Object.assign({ items: navItemsSchema, copyrightText: { type: 'string' }, logo: hideConfigSchema }, hideConfigSchema.properties),
404
- additionalProperties: false,
405
- },
406
- sidebar: {
407
- type: 'object',
408
- properties: Object.assign({ separatorLine: { type: 'boolean' }, linePosition: {
409
- type: 'string',
410
- enum: ['top', 'bottom'],
411
- default: 'bottom',
412
- } }, hideConfigSchema.properties),
413
- additionalProperties: false,
414
- },
415
- scripts: {
416
- type: 'object',
417
- properties: {
418
- head: { type: 'array', items: scriptConfigSchema },
419
- body: { type: 'array', items: scriptConfigSchema },
420
- },
421
- additionalProperties: false,
422
- },
423
- links: { type: 'array', items: linksConfigSchema },
424
- feedback: {
425
- type: 'object',
426
- properties: {
427
- hide: {
428
- type: 'boolean',
429
- default: false,
430
- },
431
- type: {
432
- type: 'string',
433
- enum: ['rating', 'sentiment', 'comment', 'reasons', 'mood', 'scale'],
434
- default: 'sentiment',
435
- },
436
- settings: Object.assign({ type: 'object', properties: {
437
- label: { type: 'string' },
438
- submitText: { type: 'string' },
439
- buttonText: { type: 'string' },
440
- component: {
441
- type: 'string',
442
- enum: ['radio', 'checkbox'],
443
- default: 'checkbox',
444
- },
445
- items: { type: 'array', items: { type: 'string' }, minItems: 1 },
446
- leftScaleLabel: { type: 'string' },
447
- rightScaleLabel: { type: 'string' },
448
- reasons: {
449
- type: 'object',
450
- properties: {
451
- hide: {
452
- type: 'boolean',
453
- default: false,
454
- },
455
- component: {
456
- type: 'string',
457
- enum: ['radio', 'checkbox'],
458
- default: 'checkbox',
459
- },
460
- label: { type: 'string' },
461
- items: { type: 'array', items: { type: 'string' } },
462
- },
463
- additionalProperties: false,
464
- },
465
- comment: {
466
- type: 'object',
467
- properties: {
468
- hide: {
469
- type: 'boolean',
470
- default: false,
471
- },
472
- label: { type: 'string' },
473
- likeLabel: { type: 'string' },
474
- dislikeLabel: { type: 'string' },
475
- satisfiedLabel: { type: 'string' },
476
- neutralLabel: { type: 'string' },
477
- dissatisfiedLabel: { type: 'string' },
478
- },
479
- additionalProperties: false,
480
- },
481
- }, additionalProperties: false }, hideConfigSchema.properties),
482
- },
483
- additionalProperties: false,
484
- default: {},
485
- },
486
- search: {
487
- type: 'object',
488
- properties: Object.assign({ placement: {
489
- type: 'string',
490
- default: 'navbar',
491
- }, shortcuts: {
492
- type: 'array',
493
- items: { type: 'string' },
494
- default: ['/'],
495
- }, suggestedPages: {
496
- type: 'array',
497
- items: suggestedPageSchema,
498
- }, fuzzy: {
499
- type: 'boolean',
500
- default: false,
501
- } }, hideConfigSchema.properties),
502
- additionalProperties: false,
503
- default: {},
504
- },
505
- colorMode: {
506
- type: 'object',
507
- properties: Object.assign({ ignoreDetection: { type: 'boolean' }, modes: {
508
- type: 'array',
509
- items: { type: 'string' },
510
- default: ['light', 'dark'],
511
- } }, hideConfigSchema.properties),
512
- additionalProperties: false,
513
- default: {},
514
- },
515
- navigation: {
516
- type: 'object',
517
- properties: {
518
- nextButton: {
519
- type: 'object',
520
- properties: Object.assign({ text: { type: 'string', default: 'Next page' } }, hideConfigSchema.properties),
521
- additionalProperties: false,
522
- default: {},
523
- },
524
- previousButton: {
525
- type: 'object',
526
- properties: Object.assign({ text: { type: 'string', default: 'Previous page' } }, hideConfigSchema.properties),
527
- additionalProperties: false,
528
- default: {},
529
- },
530
- },
531
- additionalProperties: false,
532
- default: {},
533
- },
534
- codeSnippet: {
535
- type: 'object',
536
- properties: {
537
- elementFormat: { type: 'string', default: 'icon' },
538
- copy: {
539
- type: 'object',
540
- properties: Object.assign({}, hideConfigSchema.properties),
541
- additionalProperties: false,
542
- default: { hide: false },
543
- },
544
- report: {
545
- type: 'object',
546
- properties: Object.assign({ tooltipText: { type: 'string' }, buttonText: { type: 'string' }, label: { type: 'string' } }, hideConfigSchema.properties),
547
- additionalProperties: false,
548
- default: { hide: false },
549
- },
550
- expand: {
551
- type: 'object',
552
- properties: Object.assign({}, hideConfigSchema.properties),
553
- additionalProperties: false,
554
- default: { hide: false },
555
- },
556
- collapse: {
557
- type: 'object',
558
- properties: Object.assign({}, hideConfigSchema.properties),
559
- additionalProperties: false,
560
- default: { hide: false },
561
- },
562
- },
563
- additionalProperties: false,
564
- default: {},
565
- },
15
+ navbar: navbarConfigSchema,
16
+ products: productsConfigSchema,
17
+ footer: footerConfigSchema,
18
+ sidebar: sidebarConfigSchema,
19
+ scripts: scriptsConfigSchema,
20
+ links: linksConfigSchema,
21
+ feedback: feedbackConfigSchema,
22
+ search: searchConfigSchema,
23
+ colorMode: colorModeConfigSchema,
24
+ navigation: navigationConfigSchema,
25
+ codeSnippet: codeSnippetConfigSchema,
566
26
  markdown: markdownConfigSchema,
567
- openapi: Object.assign(Object.assign({}, redocConfigSchema), { properties: Object.assign(Object.assign({}, redocConfigSchema.properties), deprecatedRefDocsSchema.properties) }),
27
+ openapi: openapiConfigSchema,
568
28
  graphql: graphqlConfigSchema,
569
- analytics: {
570
- type: 'object',
571
- properties: {
572
- adobe: adobeAnalyticsConfigSchema,
573
- amplitude: amplitudeAnalyticsConfigSchema,
574
- fullstory: fullstoryAnalyticsConfigSchema,
575
- heap: heapAnalyticsConfigSchema,
576
- rudderstack: rudderstackAnalyticsConfigSchema,
577
- segment: segmentAnalyticsConfigSchema,
578
- gtm: gtmAnalyticsConfigSchema,
579
- ga: googleAnalyticsConfigSchema,
580
- },
581
- },
582
- userMenu: {
583
- type: 'object',
584
- properties: Object.assign({ items: {
585
- type: 'array',
586
- items: {
587
- type: 'object',
588
- properties: {
589
- label: { type: 'string' },
590
- external: { type: 'boolean' },
591
- link: { type: 'string' },
592
- separatorLine: { type: 'boolean' },
593
- },
594
- additionalProperties: true,
595
- },
596
- default: [],
597
- }, hideLoginButton: { type: 'boolean' } }, hideConfigSchema.properties),
598
- additionalProperties: false,
599
- default: {},
600
- },
601
- versionPicker: {
602
- type: 'object',
603
- properties: {
604
- hide: { type: 'boolean' },
605
- showForUnversioned: {
606
- type: 'boolean',
607
- },
608
- },
609
- },
610
- breadcrumbs: {
611
- type: 'object',
612
- properties: {
613
- hide: { type: 'boolean' },
614
- prefixItems: {
615
- type: 'array',
616
- items: {
617
- type: 'object',
618
- properties: {
619
- label: { type: 'string' },
620
- labelTranslationKey: { type: 'string' },
621
- page: { type: 'string' },
622
- },
623
- additionalProperties: false,
624
- default: {},
625
- },
626
- },
627
- },
628
- additionalProperties: false,
629
- default: {},
630
- },
29
+ analytics: analyticsConfigSchema,
30
+ userMenu: userMenuConfigSchema,
31
+ versionPicker: versionPickerConfigSchema,
32
+ breadcrumbs: breadcrumbsConfigSchema,
631
33
  catalog: catalogsConfigSchema,
632
34
  scorecard: scorecardConfigSchema,
633
35
  },
634
36
  additionalProperties: true,
635
- default: {},
636
37
  };
637
38
  export const closedThemeConfigSchema = Object.assign(Object.assign({}, themeConfigSchema), { additionalProperties: false });
39
+ // TODO: remove
638
40
  export const productThemeOverrideSchema = {
639
41
  type: 'object',
640
42
  properties: {
@@ -659,9 +61,11 @@ export const productThemeOverrideSchema = {
659
61
  export const productConfigOverrideSchema = {
660
62
  $id: 'product-config-override',
661
63
  type: 'object',
662
- properties: {
663
- theme: productThemeOverrideSchema,
664
- },
64
+ properties: Object.assign(Object.assign({}, productThemeOverrideSchema.properties), {
65
+ /**
66
+ * @deprecated left for backwards compatibility
67
+ */
68
+ theme: productThemeOverrideSchema }),
665
69
  additionalProperties: false,
666
70
  };
667
71
  //# sourceMappingURL=default-theme-config-schema.js.map