@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.
@@ -1,781 +0,0 @@
1
- import type { FromSchema } from 'json-schema-to-ts';
2
-
3
- const logoConfigSchema = {
4
- type: 'object',
5
- properties: {
6
- image: { type: 'string' },
7
- srcSet: { type: 'string' },
8
- altText: { type: 'string' },
9
- link: { type: 'string' },
10
- favicon: { type: 'string' },
11
- },
12
- additionalProperties: false,
13
- } as const;
14
-
15
- const hideConfigSchema = {
16
- type: 'object',
17
- properties: {
18
- hide: { type: 'boolean' },
19
- },
20
- additionalProperties: false,
21
- } as const;
22
-
23
- const scriptConfigSchema = {
24
- type: 'object',
25
- properties: {
26
- src: { type: 'string' },
27
- async: { type: 'boolean' },
28
- crossorigin: { type: 'string' },
29
- defer: { type: 'boolean' },
30
- fetchpriority: { type: 'string' },
31
- integrity: { type: 'string' },
32
- module: { type: 'boolean' },
33
- nomodule: { type: 'boolean' },
34
- nonce: { type: 'string' },
35
- referrerpolicy: { type: 'string' },
36
- type: { type: 'string' },
37
- },
38
- required: ['src'],
39
- additionalProperties: true,
40
- } as const;
41
-
42
- const linksConfigSchema = {
43
- type: 'object',
44
- properties: {
45
- href: { type: 'string' },
46
- as: { type: 'string' },
47
- crossorigin: { type: 'string' },
48
- fetchpriority: { type: 'string' },
49
- hreflang: { type: 'string' },
50
- imagesizes: { type: 'string' },
51
- imagesrcset: { type: 'string' },
52
- integrity: { type: 'string' },
53
- media: { type: 'string' },
54
- prefetch: { type: 'string' },
55
- referrerpolicy: { type: 'string' },
56
- rel: { type: 'string' },
57
- sizes: { type: 'string' },
58
- title: { type: 'string' },
59
- type: { type: 'string' },
60
- },
61
- required: ['href'],
62
- additionalProperties: true,
63
- } as const;
64
-
65
- const markdownConfigSchema = {
66
- type: 'object',
67
- properties: {
68
- frontMatterKeysToResolve: {
69
- type: 'array',
70
- items: { type: 'string' },
71
- default: ['image', 'links'],
72
- },
73
- partialsFolders: {
74
- type: 'array',
75
- items: { type: 'string' },
76
- default: ['_partials'],
77
- },
78
- lastUpdatedBlock: {
79
- type: 'object',
80
- properties: {
81
- format: {
82
- type: 'string',
83
- enum: ['timeago', 'iso', 'long', 'short'],
84
- default: 'timeago',
85
- },
86
- locale: { type: 'string' },
87
- ...hideConfigSchema.properties,
88
- },
89
- additionalProperties: false,
90
- default: {},
91
- },
92
- toc: {
93
- type: 'object',
94
- properties: {
95
- header: { type: 'string', default: 'On this page' },
96
- depth: { type: 'integer', default: 3, minimum: 1 },
97
- ...hideConfigSchema.properties,
98
- },
99
- additionalProperties: false,
100
- default: {},
101
- },
102
- editPage: {
103
- type: 'object',
104
- properties: {
105
- baseUrl: { type: 'string' },
106
- ...hideConfigSchema.properties,
107
- },
108
- additionalProperties: false,
109
- default: {},
110
- },
111
- },
112
- additionalProperties: false,
113
- default: {},
114
- } as const;
115
-
116
- const amplitudeAnalyticsConfigSchema = {
117
- type: 'object',
118
- properties: {
119
- includeInDevelopment: { type: 'boolean' },
120
- apiKey: { type: 'string' },
121
- head: { type: 'boolean' },
122
- respectDNT: { type: 'boolean' },
123
- exclude: { type: 'array', items: { type: 'string' } },
124
- outboundClickEventName: { type: 'string' },
125
- pageViewEventName: { type: 'string' },
126
- amplitudeConfig: { type: 'object', additionalProperties: true },
127
- },
128
- additionalProperties: false,
129
- required: ['apiKey'],
130
- } as const;
131
-
132
- const fullstoryAnalyticsConfigSchema = {
133
- type: 'object',
134
- properties: {
135
- includeInDevelopment: { type: 'boolean' },
136
- orgId: { type: 'string' },
137
- },
138
- additionalProperties: false,
139
- required: ['orgId'],
140
- } as const;
141
-
142
- const heapAnalyticsConfigSchema = {
143
- type: 'object',
144
- properties: {
145
- includeInDevelopment: { type: 'boolean' },
146
- appId: { type: 'string' },
147
- },
148
- additionalProperties: false,
149
- required: ['appId'],
150
- } as const;
151
-
152
- const rudderstackAnalyticsConfigSchema = {
153
- type: 'object',
154
- properties: {
155
- includeInDevelopment: { type: 'boolean' },
156
- writeKey: { type: 'string', minLength: 10 },
157
- trackPage: { type: 'boolean' },
158
- dataPlaneUrl: { type: 'string' },
159
- controlPlaneUrl: { type: 'string' },
160
- sdkUrl: { type: 'string' },
161
- loadOptions: { type: 'object', additionalProperties: true },
162
- },
163
- additionalProperties: false,
164
- required: ['writeKey'],
165
- } as const;
166
-
167
- const segmentAnalyticsConfigSchema = {
168
- type: 'object',
169
- properties: {
170
- includeInDevelopment: { type: 'boolean' },
171
- writeKey: { type: 'string', minLength: 10 },
172
- trackPage: { type: 'boolean' },
173
- includeTitleInPageCall: { type: 'boolean' },
174
- host: { type: 'string' },
175
- },
176
- additionalProperties: false,
177
- required: ['writeKey'],
178
- } as const;
179
-
180
- const gtmAnalyticsConfigSchema = {
181
- type: 'object',
182
- properties: {
183
- includeInDevelopment: { type: 'boolean' },
184
- trackingId: { type: 'string' },
185
- gtmAuth: { type: 'string' },
186
- gtmPreview: { type: 'string' },
187
- defaultDataLayer: {},
188
- dataLayerName: { type: 'string' },
189
- enableWebVitalsTracking: { type: 'boolean' },
190
- selfHostedOrigin: { type: 'string' },
191
- pageViewEventName: { type: 'string' },
192
- },
193
- additionalProperties: false,
194
- required: ['trackingId'],
195
- } as const;
196
-
197
- const productGoogleAnalyticsConfigSchema = {
198
- type: 'object',
199
- properties: {
200
- includeInDevelopment: { type: 'boolean' },
201
- trackingId: { type: 'string' },
202
-
203
- conversionId: { type: 'string' },
204
- floodlightId: { type: 'string' },
205
- optimizeId: { type: 'string' },
206
- exclude: { type: 'array', items: { type: 'string' } },
207
- },
208
- additionalProperties: false,
209
- required: ['trackingId'],
210
- } as const;
211
-
212
- const googleAnalyticsConfigSchema = {
213
- type: 'object',
214
- properties: {
215
- includeInDevelopment: { type: 'boolean' },
216
- trackingId: { type: 'string' },
217
-
218
- conversionId: { type: 'string' },
219
- floodlightId: { type: 'string' },
220
-
221
- head: { type: 'boolean' },
222
- respectDNT: { type: 'boolean' },
223
- exclude: { type: 'array', items: { type: 'string' } },
224
-
225
- optimizeId: { type: 'string' },
226
- anonymizeIp: { type: 'boolean' },
227
- cookieExpires: { type: 'number' },
228
-
229
- // All enabled tracking configs
230
- trackers: {
231
- type: 'object',
232
- additionalProperties: productGoogleAnalyticsConfigSchema,
233
- },
234
- },
235
- additionalProperties: false,
236
- required: ['trackingId'],
237
- } as const;
238
-
239
- const adobeAnalyticsConfigSchema = {
240
- type: 'object',
241
- properties: {
242
- includeInDevelopment: { type: 'boolean' },
243
- scriptUrl: { type: 'string' },
244
- pageViewEventName: { type: 'string' },
245
- },
246
- additionalProperties: false,
247
- required: ['scriptUrl'],
248
- } as const;
249
-
250
- const navItemSchema = {
251
- type: 'object',
252
- properties: {
253
- page: { type: 'string' },
254
- directory: { type: 'string' },
255
- disconnect: { type: 'boolean', default: false },
256
- group: { type: 'string' },
257
- label: { type: 'string' },
258
- separator: { type: 'string' },
259
- separatorLine: { type: 'boolean' },
260
- linePosition: {
261
- type: 'string',
262
- enum: ['top', 'bottom'],
263
- default: 'top',
264
- },
265
- version: { type: 'string' },
266
- menuStyle: { type: 'string', enum: ['drilldown'] },
267
- expanded: { type: 'string', const: 'always' },
268
- selectFirstItemOnExpand: { type: 'boolean' },
269
- flatten: { type: 'boolean' },
270
- linkedSidebars: {
271
- type: 'array',
272
- items: { type: 'string' },
273
- },
274
- },
275
- } as const;
276
-
277
- const navItemsSchema = {
278
- type: 'array',
279
- items: {
280
- ...navItemSchema,
281
- properties: {
282
- ...navItemSchema.properties,
283
- items: { type: 'array', items: navItemSchema },
284
- },
285
- },
286
- } as const;
287
-
288
- const productConfigSchema = {
289
- type: 'object',
290
- properties: {
291
- name: { type: 'string' },
292
- icon: { type: 'string' },
293
- folder: { type: 'string' },
294
- },
295
- additionalProperties: false,
296
- required: ['name', 'folder'],
297
- } as const;
298
-
299
- const suggestedPageSchema = {
300
- type: 'object',
301
- properties: {
302
- page: { type: 'string' },
303
- label: { type: 'string' },
304
- labelTranslationKey: { type: 'string' },
305
- },
306
- required: ['page'],
307
- } as const;
308
-
309
- const catalogFilterSchema = {
310
- type: 'object',
311
- additionalProperties: false,
312
- required: ['title', 'property'],
313
- properties: {
314
- type: { type: 'string', enum: ['select', 'checkboxes', 'date-range'] },
315
- title: { type: 'string' },
316
- titleTranslationKey: { type: 'string' },
317
- property: { type: 'string' },
318
- parentFilter: { type: 'string' },
319
- valuesMapping: { type: 'object', additionalProperties: { type: 'string' } },
320
- missingCategoryName: { type: 'string' },
321
- missingCategoryNameTranslationKey: { type: 'string' },
322
- options: { type: 'array', items: { type: 'string' } },
323
- },
324
- } as const;
325
-
326
- const scorecardConfigSchema = {
327
- type: 'object',
328
- additionalProperties: true,
329
- required: [],
330
- properties: {
331
- ignoreNonCompliant: { type: 'boolean', default: false },
332
- teamMetadataProperty: {
333
- type: 'object',
334
- properties: {
335
- property: { type: 'string' },
336
- label: { type: 'string' },
337
- default: { type: 'string' },
338
- },
339
- },
340
- levels: {
341
- type: 'array',
342
- items: {
343
- type: 'object',
344
- required: ['name'],
345
- properties: {
346
- name: { type: 'string' },
347
- color: { type: 'string' },
348
- extends: { type: 'array', items: { type: 'string' } },
349
- rules: {
350
- type: 'object',
351
- additionalProperties: {
352
- oneOf: [{ type: 'string' }, { type: 'object' }],
353
- },
354
- },
355
- },
356
- additionalProperties: false,
357
- },
358
- },
359
- targets: {
360
- type: 'array',
361
- items: {
362
- type: 'object',
363
- required: ['where'],
364
- properties: {
365
- minimumLevel: { type: 'string' },
366
- where: {
367
- type: 'object',
368
- required: ['metadata'],
369
- properties: {
370
- metadata: { type: 'object', additionalProperties: { type: 'string' } },
371
- },
372
- additionalProperties: false,
373
- },
374
- },
375
- additionalProperties: false,
376
- },
377
- },
378
- },
379
- } as const;
380
-
381
- const catalogSchema = {
382
- type: 'object',
383
- additionalProperties: true,
384
- required: ['slug', 'items'],
385
- properties: {
386
- slug: { type: 'string' },
387
- filters: { type: 'array', items: catalogFilterSchema },
388
- groupByFirstFilter: { type: 'boolean' },
389
- filterValuesCasing: {
390
- type: 'string',
391
- enum: ['sentence', 'original', 'lowercase', 'uppercase'],
392
- },
393
- items: navItemsSchema,
394
- requiredPermission: { type: 'string' },
395
- separateVersions: { type: 'boolean' },
396
- title: { type: 'string' },
397
- titleTranslationKey: { type: 'string' },
398
- description: { type: 'string' },
399
- descriptionTranslationKey: { type: 'string' },
400
- },
401
- } as const;
402
-
403
- const catalogsConfigSchema = {
404
- type: 'object',
405
- patternProperties: {
406
- '.*': catalogSchema,
407
- },
408
- } as const;
409
-
410
- export const themeConfigSchema = {
411
- type: 'object',
412
- properties: {
413
- imports: {
414
- type: 'array',
415
- items: { type: 'string' },
416
- default: [],
417
- },
418
- logo: logoConfigSchema,
419
- navbar: {
420
- type: 'object',
421
- properties: {
422
- items: navItemsSchema,
423
- ...hideConfigSchema.properties,
424
- },
425
- additionalProperties: false,
426
- },
427
- products: {
428
- type: 'object',
429
- additionalProperties: productConfigSchema,
430
- },
431
- footer: {
432
- type: 'object',
433
- properties: {
434
- items: navItemsSchema,
435
- copyrightText: { type: 'string' },
436
- logo: hideConfigSchema,
437
- ...hideConfigSchema.properties,
438
- },
439
- additionalProperties: false,
440
- },
441
- sidebar: {
442
- type: 'object',
443
- properties: {
444
- separatorLine: { type: 'boolean' },
445
- linePosition: {
446
- type: 'string',
447
- enum: ['top', 'bottom'],
448
- default: 'bottom',
449
- },
450
- ...hideConfigSchema.properties,
451
- },
452
- additionalProperties: false,
453
- },
454
- scripts: {
455
- type: 'object',
456
- properties: {
457
- head: { type: 'array', items: scriptConfigSchema },
458
- body: { type: 'array', items: scriptConfigSchema },
459
- },
460
- additionalProperties: false,
461
- },
462
- links: { type: 'array', items: linksConfigSchema },
463
- feedback: {
464
- type: 'object',
465
- properties: {
466
- hide: {
467
- type: 'boolean',
468
- default: false,
469
- },
470
- type: {
471
- type: 'string',
472
- enum: ['rating', 'sentiment', 'comment', 'reasons', 'mood', 'scale'],
473
- default: 'sentiment',
474
- },
475
- settings: {
476
- type: 'object',
477
- properties: {
478
- label: { type: 'string' },
479
- submitText: { type: 'string' },
480
- buttonText: { type: 'string' },
481
- component: {
482
- type: 'string',
483
- enum: ['radio', 'checkbox'],
484
- default: 'checkbox',
485
- },
486
- items: { type: 'array', items: { type: 'string' }, minItems: 1 },
487
- leftScaleLabel: { type: 'string' },
488
- rightScaleLabel: { type: 'string' },
489
- reasons: {
490
- type: 'object',
491
- properties: {
492
- hide: {
493
- type: 'boolean',
494
- default: false,
495
- },
496
- component: {
497
- type: 'string',
498
- enum: ['radio', 'checkbox'],
499
- default: 'checkbox',
500
- },
501
- label: { type: 'string' },
502
- items: { type: 'array', items: { type: 'string' } },
503
- },
504
- additionalProperties: false,
505
- },
506
- comment: {
507
- type: 'object',
508
- properties: {
509
- hide: {
510
- type: 'boolean',
511
- default: false,
512
- },
513
- label: { type: 'string' },
514
- likeLabel: { type: 'string' },
515
- dislikeLabel: { type: 'string' },
516
- satisfiedLabel: { type: 'string' },
517
- neutralLabel: { type: 'string' },
518
- dissatisfiedLabel: { type: 'string' },
519
- },
520
- additionalProperties: false,
521
- },
522
- },
523
- additionalProperties: false,
524
- ...hideConfigSchema.properties,
525
- },
526
- },
527
- additionalProperties: false,
528
- default: {},
529
- },
530
- search: {
531
- type: 'object',
532
- properties: {
533
- placement: {
534
- type: 'string',
535
- default: 'navbar',
536
- },
537
- shortcuts: {
538
- type: 'array',
539
- items: { type: 'string' },
540
- default: ['/'],
541
- },
542
- suggestedPages: {
543
- type: 'array',
544
- items: suggestedPageSchema,
545
- },
546
- ...hideConfigSchema.properties,
547
- },
548
- additionalProperties: false,
549
- default: {},
550
- },
551
- colorMode: {
552
- type: 'object',
553
- properties: {
554
- ignoreDetection: { type: 'boolean' },
555
- modes: {
556
- type: 'array',
557
- items: { type: 'string' },
558
- default: ['light', 'dark'],
559
- },
560
- ...hideConfigSchema.properties,
561
- },
562
- additionalProperties: false,
563
- default: {},
564
- },
565
- navigation: {
566
- type: 'object',
567
- properties: {
568
- nextButton: {
569
- type: 'object',
570
- properties: {
571
- text: { type: 'string', default: 'Next to {{label}}' },
572
- ...hideConfigSchema.properties,
573
- },
574
- additionalProperties: false,
575
- default: {},
576
- },
577
- previousButton: {
578
- type: 'object',
579
- properties: {
580
- text: { type: 'string', default: 'Back to {{label}}' },
581
- ...hideConfigSchema.properties,
582
- },
583
- additionalProperties: false,
584
- default: {},
585
- },
586
- },
587
- additionalProperties: false,
588
- default: {},
589
- },
590
- codeSnippet: {
591
- type: 'object',
592
- properties: {
593
- elementFormat: { type: 'string', default: 'icon' },
594
- copy: {
595
- type: 'object',
596
- properties: {
597
- ...hideConfigSchema.properties,
598
- },
599
- additionalProperties: false,
600
- default: { hide: false },
601
- },
602
- report: {
603
- type: 'object',
604
- properties: {
605
- tooltipText: { type: 'string' },
606
- buttonText: { type: 'string' },
607
- label: { type: 'string' },
608
- ...hideConfigSchema.properties,
609
- },
610
- additionalProperties: false,
611
- default: { hide: false },
612
- },
613
- expand: {
614
- type: 'object',
615
- properties: {
616
- ...hideConfigSchema.properties,
617
- },
618
- additionalProperties: false,
619
- default: { hide: false },
620
- },
621
- collapse: {
622
- type: 'object',
623
- properties: {
624
- ...hideConfigSchema.properties,
625
- },
626
- additionalProperties: false,
627
- default: { hide: false },
628
- },
629
- },
630
- additionalProperties: false,
631
- default: {},
632
- },
633
- markdown: markdownConfigSchema,
634
- openapi: { type: 'object', additionalProperties: true }, // TODO: put the real schema here @Viacheslav
635
- graphql: { type: 'object', additionalProperties: true },
636
- analytics: {
637
- type: 'object',
638
- properties: {
639
- adobe: adobeAnalyticsConfigSchema,
640
- amplitude: amplitudeAnalyticsConfigSchema,
641
- fullstory: fullstoryAnalyticsConfigSchema,
642
- heap: heapAnalyticsConfigSchema,
643
- rudderstack: rudderstackAnalyticsConfigSchema,
644
- segment: segmentAnalyticsConfigSchema,
645
- gtm: gtmAnalyticsConfigSchema,
646
- ga: googleAnalyticsConfigSchema,
647
- },
648
- },
649
- userProfile: {
650
- type: 'object',
651
- properties: {
652
- loginLabel: { type: 'string', default: 'Login' },
653
- logoutLabel: { type: 'string', default: 'Logout' },
654
- menu: {
655
- type: 'array',
656
- items: {
657
- type: 'object',
658
- properties: {
659
- label: { type: 'string' },
660
- external: { type: 'boolean' },
661
- link: { type: 'string' },
662
- separatorLine: { type: 'boolean' },
663
- },
664
- additionalProperties: true,
665
- },
666
- default: [],
667
- },
668
- ...hideConfigSchema.properties,
669
- },
670
- additionalProperties: false,
671
- default: {},
672
- },
673
- versionPicker: {
674
- type: 'object',
675
- properties: {
676
- hide: { type: 'boolean' },
677
- showForUnversioned: {
678
- type: 'boolean',
679
- },
680
- },
681
- },
682
- breadcrumbs: {
683
- type: 'object',
684
- properties: {
685
- hide: { type: 'boolean' },
686
- prefixItems: {
687
- type: 'array',
688
- items: {
689
- type: 'object',
690
- properties: {
691
- label: { type: 'string' },
692
- labelTranslationKey: { type: 'string' },
693
- page: { type: 'string' },
694
- },
695
- additionalProperties: false,
696
- default: {},
697
- },
698
- },
699
- },
700
- additionalProperties: false,
701
- default: {},
702
- },
703
- catalog: catalogsConfigSchema,
704
- scorecard: scorecardConfigSchema,
705
- },
706
- additionalProperties: true,
707
- default: {},
708
- } as const;
709
-
710
- export const productThemeOverrideSchema = {
711
- type: 'object',
712
- properties: {
713
- logo: themeConfigSchema.properties.logo,
714
- navbar: themeConfigSchema.properties.navbar,
715
- footer: themeConfigSchema.properties.footer,
716
- sidebar: themeConfigSchema.properties.sidebar,
717
- search: themeConfigSchema.properties.search,
718
- codeSnippet: themeConfigSchema.properties.codeSnippet,
719
- breadcrumbs: themeConfigSchema.properties.breadcrumbs,
720
- analytics: {
721
- type: 'object',
722
- properties: {
723
- ga: productGoogleAnalyticsConfigSchema,
724
- },
725
- },
726
- },
727
- additionalProperties: true,
728
- default: {},
729
- } as const;
730
-
731
- export type ThemeConfig = FromSchema<typeof themeConfigSchema>;
732
-
733
- // TODO: cannot export as it relies on external types
734
- // export type ThemeUIConfig = ThemeConfig & {
735
- // auth?: {
736
- // // used by portal dev login emulator
737
- // idpsInfo?: {
738
- // idpId: string;
739
- // type: string; // AuthProviderType
740
- // title: string | undefined;
741
- // }[];
742
- // devLogin?: boolean;
743
- // loginUrls?: Record<string, string>;
744
- // };
745
- // search?: {
746
- // shortcuts?: string[];
747
- // suggestedPages?: any[];
748
- // };
749
- // breadcrumbs?: {
750
- // prefixItems?: ResolvedNavLinkItem[];
751
- // };
752
- // products?: {
753
- // [key: string]: ProductUiConfig;
754
- // };
755
- // };
756
-
757
- export type ProductConfig = FromSchema<typeof productConfigSchema>;
758
-
759
- export type ProductGoogleAnalyticsConfig = FromSchema<typeof productGoogleAnalyticsConfigSchema>;
760
- // TODO: cannot export as it relies on external types
761
- // export type ProductThemeOverrideConfig = Pick<
762
- // ThemeUIConfig,
763
- // 'logo' | 'navbar' | 'footer' | 'sidebar' | 'search' | 'codeSnippet' | 'breadcrumbs'
764
- // > & { analytics?: { ga?: ProductGoogleAnalyticsConfig } };
765
- // export type ProductUiConfig = ProductConfig & {
766
- // slug: string;
767
- // link: string;
768
- // [REDOCLY_TEAMS_RBAC]?: { [key: string]: string };
769
- // themeOverride?: ProductThemeOverrideConfig;
770
- // };
771
-
772
- export type MarkdownConfig = FromSchema<typeof markdownConfigSchema>;
773
-
774
- export type AmplitudeAnalyticsConfig = FromSchema<typeof amplitudeAnalyticsConfigSchema>;
775
- export type RudderstackAnalyticsConfig = FromSchema<typeof rudderstackAnalyticsConfigSchema>;
776
- export type SegmentAnalyticsConfig = FromSchema<typeof segmentAnalyticsConfigSchema>;
777
- export type GtmAnalyticsConfig = FromSchema<typeof gtmAnalyticsConfigSchema>;
778
- export type GoogleAnalyticsConfig = FromSchema<typeof googleAnalyticsConfigSchema>;
779
- export type CatalogConfig = FromSchema<typeof catalogSchema>;
780
- export type CatalogFilterConfig = FromSchema<typeof catalogFilterSchema>;
781
- export type ScorecardConfig = FromSchema<typeof scorecardConfigSchema>;