docusaurus-plugin-openapi-docs 0.0.0-beta.662 → 0.0.0-beta.664

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.
@@ -5,842 +5,13 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
- import clsx from "clsx";
9
-
10
- import { MediaTypeObject, SchemaObject } from "../openapi/types";
11
- import {
12
- createClosingArrayBracket,
13
- createOpeningArrayBracket,
14
- } from "./createArrayBracket";
8
+ import { MediaTypeObject } from "../openapi/types";
15
9
  import { createDescription } from "./createDescription";
16
10
  import { createDetails } from "./createDetails";
17
11
  import { createDetailsSummary } from "./createDetailsSummary";
18
- import { getQualifierMessage, getSchemaName } from "./schema";
12
+ import { createNodes } from "./createSchema";
19
13
  import { create, guard } from "./utils";
20
14
 
21
- const jsonSchemaMergeAllOf = require("json-schema-merge-allof");
22
-
23
- /**
24
- * Returns a merged representation of allOf array of schemas.
25
- */
26
- export function mergeAllOf(allOf: SchemaObject[]) {
27
- const mergedSchemas = jsonSchemaMergeAllOf(allOf, {
28
- resolvers: {
29
- readOnly: function () {
30
- return true;
31
- },
32
- example: function () {
33
- return true;
34
- },
35
- "x-examples": function () {
36
- return true;
37
- },
38
- },
39
- ignoreAdditionalProperties: true,
40
- });
41
-
42
- const required = allOf.reduce((acc, cur) => {
43
- if (Array.isArray(cur.required)) {
44
- const next = [...acc, ...cur.required];
45
- return next;
46
- }
47
- return acc;
48
- }, [] as any);
49
-
50
- return { mergedSchemas, required };
51
- }
52
-
53
- /**
54
- * For handling nested anyOf/oneOf.
55
- */
56
- function createAnyOneOf(schema: SchemaObject): any {
57
- const type = schema.oneOf ? "oneOf" : "anyOf";
58
- return create("div", {
59
- children: [
60
- create("span", {
61
- className: "badge badge--info",
62
- children: type,
63
- }),
64
- create("SchemaTabs", {
65
- children: schema[type]!.map((anyOneSchema, index) => {
66
- const label = anyOneSchema.title
67
- ? anyOneSchema.title
68
- : `MOD${index + 1}`;
69
- const anyOneChildren = [];
70
-
71
- if (anyOneSchema.properties !== undefined) {
72
- anyOneChildren.push(createProperties(anyOneSchema));
73
- delete anyOneSchema.properties;
74
- }
75
-
76
- if (anyOneSchema.allOf !== undefined) {
77
- anyOneChildren.push(createNodes(anyOneSchema));
78
- delete anyOneSchema.allOf;
79
- }
80
-
81
- if (anyOneSchema.items !== undefined) {
82
- anyOneChildren.push(createItems(anyOneSchema));
83
- delete anyOneSchema.items;
84
- }
85
-
86
- if (
87
- anyOneSchema.type === "string" ||
88
- anyOneSchema.type === "number" ||
89
- anyOneSchema.type === "integer" ||
90
- anyOneSchema.type === "boolean"
91
- ) {
92
- anyOneChildren.push(createNodes(anyOneSchema));
93
- }
94
- if (anyOneChildren.length) {
95
- if (schema.type === "array") {
96
- return create("TabItem", {
97
- label: label,
98
- value: `${index}-item-properties`,
99
- children: [
100
- createOpeningArrayBracket(),
101
- anyOneChildren,
102
- createClosingArrayBracket(),
103
- ]
104
- .filter(Boolean)
105
- .flat(),
106
- });
107
- }
108
- return create("TabItem", {
109
- label: label,
110
- value: `${index}-item-properties`,
111
- children: anyOneChildren.filter(Boolean).flat(),
112
- });
113
- }
114
-
115
- return undefined;
116
- }),
117
- }),
118
- ],
119
- });
120
- }
121
-
122
- function createProperties(schema: SchemaObject) {
123
- const discriminator = schema.discriminator;
124
- return Object.entries(schema.properties!).map(([key, val]) => {
125
- return createEdges({
126
- name: key,
127
- schema: val,
128
- required: Array.isArray(schema.required)
129
- ? schema.required.includes(key)
130
- : false,
131
- discriminator,
132
- });
133
- });
134
- }
135
-
136
- function createAdditionalProperties(schema: SchemaObject) {
137
- // TODO?:
138
- // {
139
- // description: 'Integration configuration. See \n' +
140
- // '[Integration Configurations](https://prisma.pan.dev/api/cloud/api-integration-config/).\n',
141
- // example: { webhookUrl: 'https://hooks.slack.com/abcdef' },
142
- // externalDocs: { url: 'https://prisma.pan.dev/api/cloud/api-integration-config' },
143
- // type: 'object'
144
- // }
145
-
146
- // TODO?:
147
- // {
148
- // items: {
149
- // properties: {
150
- // aliasField: [Object],
151
- // displayName: [Object],
152
- // fieldName: [Object],
153
- // maxLength: [Object],
154
- // options: [Object],
155
- // redlockMapping: [Object],
156
- // required: [Object],
157
- // type: [Object],
158
- // typeaheadUri: [Object],
159
- // value: [Object]
160
- // },
161
- // type: 'object'
162
- // },
163
- // type: 'array'
164
- // }
165
- const additionalProperties = schema.additionalProperties;
166
- const type: string | unknown = additionalProperties?.type;
167
- // Handle free-form objects
168
- if (String(additionalProperties) === "true" && schema.type === "object") {
169
- return create("SchemaItem", {
170
- name: "property name*",
171
- required: false,
172
- schemaName: "any",
173
- qualifierMessage: getQualifierMessage(schema.additionalProperties),
174
- schema: schema,
175
- collapsible: false,
176
- discriminator: false,
177
- });
178
- }
179
- if (
180
- (type === "object" || type === "array") &&
181
- (additionalProperties?.properties ||
182
- additionalProperties?.items ||
183
- additionalProperties?.allOf ||
184
- additionalProperties?.additionalProperties ||
185
- additionalProperties?.oneOf ||
186
- additionalProperties?.anyOf)
187
- ) {
188
- const title = additionalProperties.title as string;
189
- const schemaName = getSchemaName(additionalProperties);
190
- const required = schema.required ?? false;
191
- return createDetailsNode(
192
- "property name*",
193
- title ?? schemaName,
194
- additionalProperties,
195
- required,
196
- schema.nullable
197
- );
198
- }
199
-
200
- if (
201
- (schema.additionalProperties?.type as string) === "string" ||
202
- (schema.additionalProperties?.type as string) === "object" ||
203
- (schema.additionalProperties?.type as string) === "boolean" ||
204
- (schema.additionalProperties?.type as string) === "integer" ||
205
- (schema.additionalProperties?.type as string) === "number"
206
- ) {
207
- const additionalProperties =
208
- schema.additionalProperties?.additionalProperties;
209
- if (additionalProperties !== undefined) {
210
- const type = schema.additionalProperties?.additionalProperties?.type;
211
- const schemaName = getSchemaName(
212
- schema.additionalProperties?.additionalProperties!
213
- );
214
- return create("SchemaItem", {
215
- name: "property name*",
216
- required: false,
217
- schemaName: schemaName ?? type,
218
- qualifierMessage:
219
- schema.additionalProperties ??
220
- getQualifierMessage(schema.additionalProperties),
221
- schema: schema,
222
- collapsible: false,
223
- discriminator: false,
224
- });
225
- }
226
- const schemaName = getSchemaName(schema.additionalProperties!);
227
- return create("SchemaItem", {
228
- name: "property name*",
229
- required: false,
230
- schemaName: schemaName,
231
- qualifierMessage: getQualifierMessage(schema),
232
- schema: schema.additionalProperties,
233
- collapsible: false,
234
- discriminator: false,
235
- });
236
- }
237
- return Object.entries(schema.additionalProperties!).map(([key, val]) =>
238
- createEdges({
239
- name: key,
240
- schema: val,
241
- required: Array.isArray(schema.required)
242
- ? schema.required.includes(key)
243
- : false,
244
- })
245
- );
246
- }
247
-
248
- // TODO: figure out how to handle array of objects
249
- function createItems(schema: SchemaObject) {
250
- if (schema.items?.properties !== undefined) {
251
- return [
252
- createOpeningArrayBracket(),
253
- createProperties(schema.items),
254
- createClosingArrayBracket(),
255
- ].flat();
256
- }
257
-
258
- if (schema.items?.additionalProperties !== undefined) {
259
- return [
260
- createOpeningArrayBracket(),
261
- createAdditionalProperties(schema.items),
262
- createClosingArrayBracket(),
263
- ].flat();
264
- }
265
-
266
- if (schema.items?.oneOf !== undefined || schema.items?.anyOf !== undefined) {
267
- return [
268
- createOpeningArrayBracket(),
269
- createAnyOneOf(schema.items!),
270
- createClosingArrayBracket(),
271
- ].flat();
272
- }
273
-
274
- if (schema.items?.allOf !== undefined) {
275
- // TODO: figure out if and how we should pass merged required array
276
- const {
277
- mergedSchemas,
278
- }: { mergedSchemas: SchemaObject; required: string[] } = mergeAllOf(
279
- schema.items?.allOf
280
- );
281
-
282
- // Handles combo anyOf/oneOf + properties
283
- if (
284
- (mergedSchemas.oneOf !== undefined ||
285
- mergedSchemas.anyOf !== undefined) &&
286
- mergedSchemas.properties
287
- ) {
288
- return [
289
- createOpeningArrayBracket(),
290
- createAnyOneOf(mergedSchemas),
291
- createProperties(mergedSchemas),
292
- createClosingArrayBracket(),
293
- ].flat();
294
- }
295
-
296
- // Handles only anyOf/oneOf
297
- if (
298
- mergedSchemas.oneOf !== undefined ||
299
- mergedSchemas.anyOf !== undefined
300
- ) {
301
- return [
302
- createOpeningArrayBracket(),
303
- createAnyOneOf(mergedSchemas),
304
- createClosingArrayBracket(),
305
- ].flat();
306
- }
307
-
308
- // Handles properties
309
- if (mergedSchemas.properties !== undefined) {
310
- return [
311
- createOpeningArrayBracket(),
312
- createProperties(mergedSchemas),
313
- createClosingArrayBracket(),
314
- ].flat();
315
- }
316
- }
317
-
318
- if (
319
- schema.items?.type === "string" ||
320
- schema.items?.type === "number" ||
321
- schema.items?.type === "integer" ||
322
- schema.items?.type === "boolean" ||
323
- schema.items?.type === "object"
324
- ) {
325
- return [
326
- createOpeningArrayBracket(),
327
- createNodes(schema.items),
328
- createClosingArrayBracket(),
329
- ].flat();
330
- }
331
-
332
- // TODO: clean this up or eliminate it?
333
- return [
334
- createOpeningArrayBracket(),
335
- Object.entries(schema.items!).map(([key, val]) =>
336
- createEdges({
337
- name: key,
338
- schema: val,
339
- required: Array.isArray(schema.required)
340
- ? schema.required.includes(key)
341
- : false,
342
- })
343
- ),
344
- createClosingArrayBracket(),
345
- ].flat();
346
- }
347
-
348
- /**
349
- * For handling discriminators that do not map to a same-level property
350
- */
351
- // function createDiscriminator(schema: SchemaObject) {
352
- // const discriminator = schema.discriminator;
353
- // const propertyName = discriminator?.propertyName;
354
- // const propertyType = "string"; // should always be string
355
- // const mapping: any = discriminator?.mapping;
356
-
357
- // // Explicit mapping is required since we can't support implicit
358
- // if (mapping === undefined) {
359
- // return undefined;
360
- // }
361
-
362
- // // Attempt to get the property description we want to display
363
- // // TODO: how to make it predictable when handling allOf
364
- // let propertyDescription;
365
- // const firstMappingSchema = mapping[Object.keys(mapping)[0]];
366
- // if (firstMappingSchema.properties !== undefined) {
367
- // propertyDescription =
368
- // firstMappingSchema.properties![propertyName!].description;
369
- // }
370
- // if (firstMappingSchema.allOf !== undefined) {
371
- // const { mergedSchemas }: { mergedSchemas: SchemaObject } = mergeAllOf(
372
- // firstMappingSchema.allOf
373
- // );
374
- // if (mergedSchemas.properties !== undefined) {
375
- // propertyDescription =
376
- // mergedSchemas.properties[propertyName!]?.description;
377
- // }
378
- // }
379
-
380
- // if (propertyDescription === undefined) {
381
- // if (
382
- // schema.properties !== undefined &&
383
- // schema.properties![propertyName!] !== undefined
384
- // ) {
385
- // propertyDescription = schema.properties![propertyName!].description;
386
- // }
387
- // }
388
-
389
- // return create("div", {
390
- // className: "openapi-discriminator__item",
391
- // children: create("div", {
392
- // children: [
393
- // create("strong", {
394
- // style: { paddingLeft: "1rem" },
395
- // children: propertyName,
396
- // }),
397
- // guard(propertyType, (name) =>
398
- // create("span", {
399
- // style: { opacity: "0.6" },
400
- // children: ` ${propertyType}`,
401
- // })
402
- // ),
403
- // guard(getQualifierMessage(schema.discriminator as any), (message) =>
404
- // create("div", {
405
- // style: {
406
- // paddingLeft: "1rem",
407
- // },
408
- // children: createDescription(message),
409
- // })
410
- // ),
411
- // guard(propertyDescription, (description) =>
412
- // create("div", {
413
- // style: {
414
- // paddingLeft: "1rem",
415
- // },
416
- // children: createDescription(description),
417
- // })
418
- // ),
419
- // create("DiscriminatorTabs", {
420
- // children: Object.keys(mapping!).map((key, index) => {
421
- // if (mapping[key].allOf !== undefined) {
422
- // const { mergedSchemas }: { mergedSchemas: SchemaObject } =
423
- // mergeAllOf(mapping[key].allOf);
424
- // // Cleanup duplicate property from mapping schema
425
- // delete mergedSchemas.properties![propertyName!];
426
- // mapping[key] = mergedSchemas;
427
- // }
428
-
429
- // if (mapping[key].properties !== undefined) {
430
- // // Cleanup duplicate property from mapping schema
431
- // delete mapping[key].properties![propertyName!];
432
- // }
433
-
434
- // const label = key;
435
- // return create("TabItem", {
436
- // label: label,
437
- // value: `${index}-item-discriminator`,
438
- // children: [
439
- // create("div", {
440
- // style: { marginLeft: "-4px" },
441
- // children: createNodes(mapping[key]),
442
- // }),
443
- // ],
444
- // });
445
- // }),
446
- // }),
447
- // ],
448
- // }),
449
- // });
450
- // }
451
-
452
- function createDetailsNode(
453
- name: string,
454
- schemaName: string,
455
- schema: SchemaObject,
456
- required: string[] | boolean,
457
- nullable: boolean | unknown
458
- ): any {
459
- return create("SchemaItem", {
460
- collapsible: true,
461
- className: "schemaItem",
462
- children: [
463
- createDetails({
464
- className: "openapi-markdown__details",
465
- children: [
466
- createDetailsSummary({
467
- children: [
468
- create("span", {
469
- className: "openapi-schema__container",
470
- children: [
471
- create("strong", {
472
- className: clsx("openapi-schema__property", {
473
- "openapi-schema__strikethrough": schema.deprecated,
474
- }),
475
- children: name,
476
- }),
477
- create("span", {
478
- className: "openapi-schema__name",
479
- children: ` ${schemaName}`,
480
- }),
481
- guard(
482
- (Array.isArray(required)
483
- ? required.includes(name)
484
- : required === true) ||
485
- schema.deprecated ||
486
- nullable,
487
- () => [
488
- create("span", {
489
- className: "openapi-schema__divider",
490
- }),
491
- ]
492
- ),
493
- guard(nullable, () => [
494
- create("span", {
495
- className: "openapi-schema__nullable",
496
- children: "nullable",
497
- }),
498
- ]),
499
- guard(
500
- Array.isArray(required)
501
- ? required.includes(name)
502
- : required === true,
503
- () => [
504
- create("span", {
505
- className: "openapi-schema__required",
506
- children: "required",
507
- }),
508
- ]
509
- ),
510
- guard(schema.deprecated, () => [
511
- create("span", {
512
- className: "openapi-schema__deprecated",
513
- children: "deprecated",
514
- }),
515
- ]),
516
- ],
517
- }),
518
- ],
519
- }),
520
- create("div", {
521
- style: { marginLeft: "1rem" },
522
- children: [
523
- guard(getQualifierMessage(schema), (message) =>
524
- create("div", {
525
- style: { marginTop: ".5rem", marginBottom: ".5rem" },
526
- children: createDescription(message),
527
- })
528
- ),
529
- guard(schema.description, (description) =>
530
- create("div", {
531
- style: { marginTop: ".5rem", marginBottom: ".5rem" },
532
- children: createDescription(description),
533
- })
534
- ),
535
- createNodes(schema),
536
- ],
537
- }),
538
- ],
539
- }),
540
- ],
541
- });
542
- }
543
-
544
- /**
545
- * For handling discriminators that map to a same-level property (like 'petType').
546
- * Note: These should only be encountered while iterating through properties.
547
- */
548
- function createPropertyDiscriminator(
549
- name: string,
550
- schemaName: string,
551
- schema: SchemaObject,
552
- discriminator: any,
553
- required: string[] | boolean
554
- ): any {
555
- if (schema === undefined) {
556
- return undefined;
557
- }
558
-
559
- if (discriminator.mapping === undefined) {
560
- return undefined;
561
- }
562
-
563
- return create("div", {
564
- className: "openapi-discriminator__item openapi-schema__list-item",
565
- children: create("div", {
566
- children: [
567
- create("span", {
568
- className: "openapi-schema__container",
569
- children: [
570
- create("strong", {
571
- className: "openapi-discriminator__name openapi-schema__property",
572
- children: name,
573
- }),
574
- guard(schemaName, (name) =>
575
- create("span", {
576
- className: "openapi-schema__name",
577
- children: ` ${schemaName}`,
578
- })
579
- ),
580
- guard(required, () => [
581
- create("span", {
582
- className: "openapi-schema__required",
583
- children: "required",
584
- }),
585
- ]),
586
- ],
587
- }),
588
- guard(getQualifierMessage(discriminator), (message) =>
589
- create("div", {
590
- style: {
591
- paddingLeft: "1rem",
592
- },
593
- children: createDescription(message),
594
- })
595
- ),
596
- guard(schema.description, (description) =>
597
- create("div", {
598
- style: {
599
- paddingLeft: "1rem",
600
- },
601
- children: createDescription(description),
602
- })
603
- ),
604
- create("DiscriminatorTabs", {
605
- className: "openapi-tabs__discriminator",
606
- children: Object.keys(discriminator?.mapping!).map((key, index) => {
607
- const label = key;
608
- return create("TabItem", {
609
- // className: "openapi-tabs__discriminator-item",
610
- label: label,
611
- value: `${index}-item-discriminator`,
612
- children: [createNodes(discriminator?.mapping[key])],
613
- });
614
- }),
615
- }),
616
- ],
617
- }),
618
- });
619
- }
620
-
621
- interface EdgeProps {
622
- name: string;
623
- schema: SchemaObject;
624
- required: string[] | boolean;
625
- discriminator?: any | unknown;
626
- }
627
-
628
- /**
629
- * Creates the edges or "leaves" of a schema tree. Edges can branch into sub-nodes with createDetails().
630
- */
631
- function createEdges({
632
- name,
633
- schema,
634
- required,
635
- discriminator,
636
- }: EdgeProps): any {
637
- const schemaName = getSchemaName(schema);
638
-
639
- if (discriminator !== undefined && discriminator.propertyName === name) {
640
- return createPropertyDiscriminator(
641
- name,
642
- "string",
643
- schema,
644
- discriminator,
645
- required
646
- );
647
- }
648
-
649
- if (schema.oneOf !== undefined || schema.anyOf !== undefined) {
650
- return createDetailsNode(
651
- name,
652
- schemaName,
653
- schema,
654
- required,
655
- schema.nullable
656
- );
657
- }
658
-
659
- if (schema.allOf !== undefined) {
660
- const {
661
- mergedSchemas,
662
- required,
663
- }: { mergedSchemas: SchemaObject; required: string[] | boolean } =
664
- mergeAllOf(schema.allOf);
665
- const mergedSchemaName = getSchemaName(mergedSchemas);
666
-
667
- if (
668
- mergedSchemas.oneOf !== undefined ||
669
- mergedSchemas.anyOf !== undefined
670
- ) {
671
- return createDetailsNode(
672
- name,
673
- mergedSchemaName,
674
- mergedSchemas,
675
- required,
676
- schema.nullable
677
- );
678
- }
679
-
680
- if (mergedSchemas.properties !== undefined) {
681
- return createDetailsNode(
682
- name,
683
- mergedSchemaName,
684
- mergedSchemas,
685
- required,
686
- schema.nullable
687
- );
688
- }
689
-
690
- if (mergedSchemas.additionalProperties !== undefined) {
691
- return createDetailsNode(
692
- name,
693
- mergedSchemaName,
694
- mergedSchemas,
695
- required,
696
- schema.nullable
697
- );
698
- }
699
-
700
- // array of objects
701
- if (mergedSchemas.items?.properties !== undefined) {
702
- return createDetailsNode(
703
- name,
704
- mergedSchemaName,
705
- mergedSchemas,
706
- required,
707
- schema.nullable
708
- );
709
- }
710
-
711
- if (mergedSchemas.readOnly && mergedSchemas.readOnly === true) {
712
- return undefined;
713
- }
714
-
715
- return create("SchemaItem", {
716
- collapsible: false,
717
- name,
718
- required: Array.isArray(required) ? required.includes(name) : required,
719
- schemaName: schemaName,
720
- qualifierMessage: getQualifierMessage(schema),
721
- schema: mergedSchemas,
722
- });
723
- }
724
-
725
- if (schema.properties !== undefined) {
726
- return createDetailsNode(
727
- name,
728
- schemaName,
729
- schema,
730
- required,
731
- schema.nullable
732
- );
733
- }
734
-
735
- if (schema.additionalProperties !== undefined) {
736
- return createDetailsNode(
737
- name,
738
- schemaName,
739
- schema,
740
- required,
741
- schema.nullable
742
- );
743
- }
744
-
745
- // array of objects
746
- if (schema.items?.properties !== undefined) {
747
- return createDetailsNode(
748
- name,
749
- schemaName,
750
- schema,
751
- required,
752
- schema.nullable
753
- );
754
- }
755
-
756
- if (schema.items?.anyOf !== undefined || schema.items?.oneOf !== undefined) {
757
- return createDetailsNode(
758
- name,
759
- schemaName,
760
- schema,
761
- required,
762
- schema.nullable
763
- );
764
- }
765
-
766
- if (schema.readOnly && schema.readOnly === true) {
767
- return undefined;
768
- }
769
-
770
- // primitives and array of non-objects
771
- return create("SchemaItem", {
772
- collapsible: false,
773
- name,
774
- required: Array.isArray(required) ? required.includes(name) : required,
775
- schemaName: schemaName,
776
- qualifierMessage: getQualifierMessage(schema),
777
- schema: schema,
778
- });
779
- }
780
-
781
- /**
782
- * Creates a hierarchical level of a schema tree. Nodes produce edges that can branch into sub-nodes with edges, recursively.
783
- */
784
- function createNodes(schema: SchemaObject): any {
785
- const nodes = [];
786
- // if (schema.discriminator !== undefined) {
787
- // return createDiscriminator(schema);
788
- // }
789
-
790
- if (schema.oneOf !== undefined || schema.anyOf !== undefined) {
791
- nodes.push(createAnyOneOf(schema));
792
- }
793
-
794
- if (schema.allOf !== undefined) {
795
- const { mergedSchemas } = mergeAllOf(schema.allOf);
796
-
797
- // allOf seems to always result in properties
798
- if (mergedSchemas.properties !== undefined) {
799
- nodes.push(createProperties(mergedSchemas));
800
- }
801
- }
802
-
803
- if (schema.properties !== undefined) {
804
- nodes.push(createProperties(schema));
805
- }
806
-
807
- if (schema.additionalProperties !== undefined) {
808
- nodes.push(createAdditionalProperties(schema));
809
- }
810
-
811
- // TODO: figure out how to handle array of objects
812
- if (schema.items !== undefined) {
813
- nodes.push(createItems(schema));
814
- }
815
-
816
- if (nodes.length && nodes.length > 0) {
817
- return nodes.filter(Boolean).flat();
818
- }
819
-
820
- // primitive
821
- if (schema.type !== undefined) {
822
- return create("SchemaItem", {
823
- collapsible: false,
824
- name: schema.type,
825
- required: false,
826
- schemaName: schema.format,
827
- qualifierMessage: getQualifierMessage(schema),
828
- schema: schema,
829
- });
830
- }
831
-
832
- // Unknown node/schema type should return undefined
833
- // So far, haven't seen this hit in testing
834
- return create("SchemaItem", {
835
- collapsible: false,
836
- name: "any",
837
- required: false,
838
- schemaName: schema.format,
839
- qualifierMessage: getQualifierMessage(schema),
840
- schema: schema,
841
- });
842
- }
843
-
844
15
  interface Props {
845
16
  style?: any;
846
17
  title: string;