docusaurus-plugin-openapi-docs 0.0.0-418 → 0.0.0-419
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.
|
@@ -192,7 +192,8 @@ function createItems(schema) {
|
|
|
192
192
|
return createAnyOneOf(schema.items);
|
|
193
193
|
}
|
|
194
194
|
if (((_e = schema.items) === null || _e === void 0 ? void 0 : _e.allOf) !== undefined) {
|
|
195
|
-
|
|
195
|
+
// TODO: figure out if and how we should pass merged required array
|
|
196
|
+
const { mergedSchemas, } = mergeAllOf((_f = schema.items) === null || _f === void 0 ? void 0 : _f.allOf);
|
|
196
197
|
// Handles combo anyOf/oneOf + properties
|
|
197
198
|
if ((mergedSchemas.oneOf !== undefined ||
|
|
198
199
|
mergedSchemas.anyOf !== undefined) &&
|
|
@@ -331,7 +332,7 @@ function createDetailsNode(name, schemaName, schema, required) {
|
|
|
331
332
|
style: { opacity: "0.6" },
|
|
332
333
|
children: ` ${schemaName}`,
|
|
333
334
|
}),
|
|
334
|
-
(0, utils_1.guard)(required, () => [
|
|
335
|
+
(0, utils_1.guard)(schema.required && schema.required === true, () => [
|
|
335
336
|
(0, utils_1.create)("strong", {
|
|
336
337
|
style: {
|
|
337
338
|
fontSize: "var(--ifm-code-font-size)",
|
|
@@ -427,6 +428,7 @@ function createPropertyDiscriminator(name, schemaName, schema, discriminator, re
|
|
|
427
428
|
function createEdges({ name, schema, required, discriminator, }) {
|
|
428
429
|
var _a, _b;
|
|
429
430
|
const schemaName = (0, schema_1.getSchemaName)(schema);
|
|
431
|
+
// if (name === "id") console.log(name, schema, required);
|
|
430
432
|
if (discriminator !== undefined && discriminator.propertyName === name) {
|
|
431
433
|
return createPropertyDiscriminator(name, "string", schema, discriminator, required);
|
|
432
434
|
}
|
|
@@ -453,7 +455,7 @@ function createEdges({ name, schema, required, discriminator, }) {
|
|
|
453
455
|
return (0, utils_1.create)("SchemaItem", {
|
|
454
456
|
collapsible: false,
|
|
455
457
|
name,
|
|
456
|
-
required,
|
|
458
|
+
required: Array.isArray(required) ? required.includes(name) : required,
|
|
457
459
|
schemaDescription: mergedSchemas.description,
|
|
458
460
|
schemaName: schemaName,
|
|
459
461
|
qualifierMessage: (0, schema_1.getQualifierMessage)(schema),
|
|
@@ -474,7 +476,7 @@ function createEdges({ name, schema, required, discriminator, }) {
|
|
|
474
476
|
return (0, utils_1.create)("SchemaItem", {
|
|
475
477
|
collapsible: false,
|
|
476
478
|
name,
|
|
477
|
-
required,
|
|
479
|
+
required: Array.isArray(required) ? required.includes(name) : required,
|
|
478
480
|
schemaDescription: schema.description,
|
|
479
481
|
schemaName: schemaName,
|
|
480
482
|
qualifierMessage: (0, schema_1.getQualifierMessage)(schema),
|
|
@@ -573,7 +575,7 @@ function createSchemaDetails({ title, body, ...rest }) {
|
|
|
573
575
|
style: { opacity: "0.6" },
|
|
574
576
|
children: ` array`,
|
|
575
577
|
})),
|
|
576
|
-
(0, utils_1.guard)(body.required, () => [
|
|
578
|
+
(0, utils_1.guard)(body.required && body.required === true, () => [
|
|
577
579
|
(0, utils_1.create)("strong", {
|
|
578
580
|
style: {
|
|
579
581
|
fontSize: "var(--ifm-code-font-size)",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-plugin-openapi-docs",
|
|
3
3
|
"description": "OpenAPI plugin for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-419",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=14"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "c5df2d9c69e2d3881b329ba3586cbc3853ba553b"
|
|
71
71
|
}
|
|
@@ -227,8 +227,12 @@ function createItems(schema: SchemaObject) {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
if (schema.items?.allOf !== undefined) {
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
// TODO: figure out if and how we should pass merged required array
|
|
231
|
+
const {
|
|
232
|
+
mergedSchemas,
|
|
233
|
+
}: { mergedSchemas: SchemaObject; required: string[] } = mergeAllOf(
|
|
234
|
+
schema.items?.allOf
|
|
235
|
+
);
|
|
232
236
|
|
|
233
237
|
// Handles combo anyOf/oneOf + properties
|
|
234
238
|
if (
|
|
@@ -387,7 +391,7 @@ function createDetailsNode(
|
|
|
387
391
|
name: string,
|
|
388
392
|
schemaName: string,
|
|
389
393
|
schema: SchemaObject,
|
|
390
|
-
required:
|
|
394
|
+
required: string[] | boolean
|
|
391
395
|
): any {
|
|
392
396
|
return create("SchemaItem", {
|
|
393
397
|
collapsible: true,
|
|
@@ -402,7 +406,7 @@ function createDetailsNode(
|
|
|
402
406
|
style: { opacity: "0.6" },
|
|
403
407
|
children: ` ${schemaName}`,
|
|
404
408
|
}),
|
|
405
|
-
guard(required, () => [
|
|
409
|
+
guard(schema.required && schema.required === true, () => [
|
|
406
410
|
create("strong", {
|
|
407
411
|
style: {
|
|
408
412
|
fontSize: "var(--ifm-code-font-size)",
|
|
@@ -446,7 +450,7 @@ function createPropertyDiscriminator(
|
|
|
446
450
|
schemaName: string,
|
|
447
451
|
schema: SchemaObject,
|
|
448
452
|
discriminator: any,
|
|
449
|
-
required:
|
|
453
|
+
required: string[] | boolean
|
|
450
454
|
): any {
|
|
451
455
|
if (schema === undefined) {
|
|
452
456
|
return undefined;
|
|
@@ -515,7 +519,7 @@ function createPropertyDiscriminator(
|
|
|
515
519
|
interface EdgeProps {
|
|
516
520
|
name: string;
|
|
517
521
|
schema: SchemaObject;
|
|
518
|
-
required: boolean;
|
|
522
|
+
required: string[] | boolean;
|
|
519
523
|
discriminator?: any | unknown;
|
|
520
524
|
}
|
|
521
525
|
|
|
@@ -530,6 +534,8 @@ function createEdges({
|
|
|
530
534
|
}: EdgeProps): any {
|
|
531
535
|
const schemaName = getSchemaName(schema);
|
|
532
536
|
|
|
537
|
+
// if (name === "id") console.log(name, schema, required);
|
|
538
|
+
|
|
533
539
|
if (discriminator !== undefined && discriminator.propertyName === name) {
|
|
534
540
|
return createPropertyDiscriminator(
|
|
535
541
|
name,
|
|
@@ -548,9 +554,8 @@ function createEdges({
|
|
|
548
554
|
const {
|
|
549
555
|
mergedSchemas,
|
|
550
556
|
required,
|
|
551
|
-
}: { mergedSchemas: SchemaObject; required:
|
|
552
|
-
schema.allOf
|
|
553
|
-
);
|
|
557
|
+
}: { mergedSchemas: SchemaObject; required: string[] | boolean } =
|
|
558
|
+
mergeAllOf(schema.allOf);
|
|
554
559
|
const mergedSchemaName = getSchemaName(mergedSchemas);
|
|
555
560
|
|
|
556
561
|
if (
|
|
@@ -576,7 +581,7 @@ function createEdges({
|
|
|
576
581
|
return create("SchemaItem", {
|
|
577
582
|
collapsible: false,
|
|
578
583
|
name,
|
|
579
|
-
required,
|
|
584
|
+
required: Array.isArray(required) ? required.includes(name) : required,
|
|
580
585
|
schemaDescription: mergedSchemas.description,
|
|
581
586
|
schemaName: schemaName,
|
|
582
587
|
qualifierMessage: getQualifierMessage(schema),
|
|
@@ -601,7 +606,7 @@ function createEdges({
|
|
|
601
606
|
return create("SchemaItem", {
|
|
602
607
|
collapsible: false,
|
|
603
608
|
name,
|
|
604
|
-
required,
|
|
609
|
+
required: Array.isArray(required) ? required.includes(name) : required,
|
|
605
610
|
schemaDescription: schema.description,
|
|
606
611
|
schemaName: schemaName,
|
|
607
612
|
qualifierMessage: getQualifierMessage(schema),
|
|
@@ -685,7 +690,7 @@ interface Props {
|
|
|
685
690
|
[key: string]: MediaTypeObject;
|
|
686
691
|
};
|
|
687
692
|
description?: string;
|
|
688
|
-
required?: boolean;
|
|
693
|
+
required?: string[] | boolean;
|
|
689
694
|
};
|
|
690
695
|
}
|
|
691
696
|
|
|
@@ -734,7 +739,7 @@ export function createSchemaDetails({ title, body, ...rest }: Props) {
|
|
|
734
739
|
children: ` array`,
|
|
735
740
|
})
|
|
736
741
|
),
|
|
737
|
-
guard(body.required, () => [
|
|
742
|
+
guard(body.required && body.required === true, () => [
|
|
738
743
|
create("strong", {
|
|
739
744
|
style: {
|
|
740
745
|
fontSize: "var(--ifm-code-font-size)",
|