docusaurus-plugin-openapi-docs 0.0.0-751 → 0.0.0-756
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.
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ Key Features:
|
|
|
42
42
|
| Docusaurus OpenAPI Docs | Docusaurus |
|
|
43
43
|
| ----------------------- | --------------- |
|
|
44
44
|
| 3.0.1 (current) | `3.0.1 - 3.4.0` |
|
|
45
|
-
| 2.2.
|
|
45
|
+
| 2.2.1 (legacy) | `2.4.1 - 2.4.3` |
|
|
46
46
|
| 1.7.3 (legacy) | `2.0.1 - 2.2.0` |
|
|
47
47
|
|
|
48
48
|
## Bootstrapping from Template (new Docusaurus site)
|
|
@@ -61,6 +61,7 @@ function createAnyOneOf(schema) {
|
|
|
61
61
|
(0, utils_1.create)("span", {
|
|
62
62
|
className: "badge badge--info",
|
|
63
63
|
children: type,
|
|
64
|
+
style: { marginBottom: "1rem" },
|
|
64
65
|
}),
|
|
65
66
|
(0, utils_1.create)("SchemaTabs", {
|
|
66
67
|
children: schema[type].map((anyOneSchema, index) => {
|
|
@@ -68,6 +69,12 @@ function createAnyOneOf(schema) {
|
|
|
68
69
|
? anyOneSchema.title
|
|
69
70
|
: `MOD${index + 1}`;
|
|
70
71
|
const anyOneChildren = [];
|
|
72
|
+
if (anyOneSchema.type === "object" &&
|
|
73
|
+
!anyOneSchema.properties &&
|
|
74
|
+
!anyOneSchema.allOf &&
|
|
75
|
+
!anyOneSchema.items) {
|
|
76
|
+
anyOneChildren.push(createNodes(anyOneSchema, SCHEMA_TYPE));
|
|
77
|
+
}
|
|
71
78
|
if (anyOneSchema.properties !== undefined) {
|
|
72
79
|
anyOneChildren.push(createProperties(anyOneSchema));
|
|
73
80
|
delete anyOneSchema.properties;
|
|
@@ -352,63 +359,79 @@ function createDetailsNode(name, schemaName, schema, required, nullable) {
|
|
|
352
359
|
/**
|
|
353
360
|
* For handling anyOf/oneOf properties.
|
|
354
361
|
*/
|
|
355
|
-
function createAnyOneOfProperty(
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
362
|
+
// function createAnyOneOfProperty(
|
|
363
|
+
// name: string,
|
|
364
|
+
// schemaName: string,
|
|
365
|
+
// schema: SchemaObject,
|
|
366
|
+
// required: string[] | boolean,
|
|
367
|
+
// nullable: boolean | unknown
|
|
368
|
+
// ): any {
|
|
369
|
+
// return create("SchemaItem", {
|
|
370
|
+
// collapsible: true,
|
|
371
|
+
// className: "schemaItem",
|
|
372
|
+
// children: [
|
|
373
|
+
// createDetails({
|
|
374
|
+
// className: "openapi-markdown__details",
|
|
375
|
+
// children: [
|
|
376
|
+
// createDetailsSummary({
|
|
377
|
+
// children: [
|
|
378
|
+
// create("strong", { children: name }),
|
|
379
|
+
// create("span", {
|
|
380
|
+
// style: { opacity: "0.6" },
|
|
381
|
+
// children: ` ${schemaName}`,
|
|
382
|
+
// }),
|
|
383
|
+
// guard(
|
|
384
|
+
// (schema.nullable && schema.nullable === true) ||
|
|
385
|
+
// (nullable && nullable === true),
|
|
386
|
+
// () => [
|
|
387
|
+
// create("strong", {
|
|
388
|
+
// style: {
|
|
389
|
+
// fontSize: "var(--ifm-code-font-size)",
|
|
390
|
+
// color: "var(--openapi-nullable)",
|
|
391
|
+
// },
|
|
392
|
+
// children: " nullable",
|
|
393
|
+
// }),
|
|
394
|
+
// ]
|
|
395
|
+
// ),
|
|
396
|
+
// guard(
|
|
397
|
+
// Array.isArray(required)
|
|
398
|
+
// ? required.includes(name)
|
|
399
|
+
// : required === true,
|
|
400
|
+
// () => [
|
|
401
|
+
// create("strong", {
|
|
402
|
+
// style: {
|
|
403
|
+
// fontSize: "var(--ifm-code-font-size)",
|
|
404
|
+
// color: "var(--openapi-required)",
|
|
405
|
+
// },
|
|
406
|
+
// children: " required",
|
|
407
|
+
// }),
|
|
408
|
+
// ]
|
|
409
|
+
// ),
|
|
410
|
+
// ],
|
|
411
|
+
// }),
|
|
412
|
+
// create("div", {
|
|
413
|
+
// style: { marginLeft: "1rem" },
|
|
414
|
+
// children: [
|
|
415
|
+
// guard(getQualifierMessage(schema), (message) =>
|
|
416
|
+
// create("div", {
|
|
417
|
+
// style: { marginTop: ".5rem", marginBottom: ".5rem" },
|
|
418
|
+
// children: createDescription(message),
|
|
419
|
+
// })
|
|
420
|
+
// ),
|
|
421
|
+
// guard(schema.description, (description) =>
|
|
422
|
+
// create("div", {
|
|
423
|
+
// style: { marginTop: ".5rem", marginBottom: ".5rem" },
|
|
424
|
+
// children: createDescription(description),
|
|
425
|
+
// })
|
|
426
|
+
// ),
|
|
427
|
+
// ],
|
|
428
|
+
// }),
|
|
429
|
+
// createAnyOneOf(schema),
|
|
430
|
+
// ],
|
|
431
|
+
// }),
|
|
432
|
+
// ],
|
|
433
|
+
// });
|
|
434
|
+
// }
|
|
412
435
|
/**
|
|
413
436
|
* For handling discriminators that map to a same-level property (like 'petType').
|
|
414
437
|
* Note: These should only be encountered while iterating through properties.
|
|
@@ -491,7 +514,7 @@ function createEdges({ name, schema, required, discriminator, }) {
|
|
|
491
514
|
return createPropertyDiscriminator(name, "string", schema, discriminator, required);
|
|
492
515
|
}
|
|
493
516
|
if (schema.oneOf !== undefined || schema.anyOf !== undefined) {
|
|
494
|
-
return
|
|
517
|
+
return createDetailsNode(name, schemaName, schema, required, schema.nullable);
|
|
495
518
|
}
|
|
496
519
|
if (schema.allOf !== undefined) {
|
|
497
520
|
const { mergedSchemas } = mergeAllOf(schema.allOf);
|
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-756",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=14"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "989b9c8bec0d62a820287b93d3e4d8bc84a5a944"
|
|
66
66
|
}
|
|
@@ -12,7 +12,9 @@ Array [
|
|
|
12
12
|
</summary>
|
|
13
13
|
<div style={{ marginLeft: \\"1rem\\" }}>
|
|
14
14
|
<div>
|
|
15
|
-
<span className={\\"badge badge--info\\"}>
|
|
15
|
+
<span className={\\"badge badge--info\\"} style={{ marginBottom: \\"1rem\\" }}>
|
|
16
|
+
oneOf
|
|
17
|
+
</span>
|
|
16
18
|
<SchemaTabs>
|
|
17
19
|
<TabItem label={\\"MOD1\\"} value={\\"0-item-properties\\"}>
|
|
18
20
|
<SchemaItem
|
|
@@ -226,67 +228,72 @@ Array [
|
|
|
226
228
|
"<SchemaItem collapsible={true} className={\\"schemaItem\\"}>
|
|
227
229
|
<details style={{}} className={\\"openapi-markdown__details\\"}>
|
|
228
230
|
<summary style={{}}>
|
|
229
|
-
<
|
|
230
|
-
|
|
231
|
+
<span className={\\"openapi-schema__container\\"}>
|
|
232
|
+
<strong className={\\"openapi-schema__property\\"}>oneOfProperty</strong>
|
|
233
|
+
<span className={\\"openapi-schema__name\\"}>object</span>
|
|
234
|
+
</span>
|
|
231
235
|
</summary>
|
|
232
|
-
<div style={{ marginLeft: \\"1rem\\" }}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
236
|
+
<div style={{ marginLeft: \\"1rem\\" }}>
|
|
237
|
+
<div>
|
|
238
|
+
<span className={\\"badge badge--info\\"} style={{ marginBottom: \\"1rem\\" }}>
|
|
239
|
+
oneOf
|
|
240
|
+
</span>
|
|
241
|
+
<SchemaTabs>
|
|
242
|
+
<TabItem label={\\"MOD1\\"} value={\\"0-item-properties\\"}>
|
|
243
|
+
<SchemaItem
|
|
244
|
+
collapsible={false}
|
|
245
|
+
name={\\"noseLength\\"}
|
|
246
|
+
required={true}
|
|
247
|
+
schemaName={\\"number\\"}
|
|
248
|
+
qualifierMessage={undefined}
|
|
249
|
+
schema={{ type: \\"number\\" }}
|
|
250
|
+
></SchemaItem>
|
|
251
|
+
</TabItem>
|
|
252
|
+
<TabItem label={\\"MOD2\\"} value={\\"1-item-properties\\"}>
|
|
253
|
+
<li>
|
|
254
|
+
<div
|
|
255
|
+
style={{
|
|
256
|
+
fontSize: \\"var(--ifm-code-font-size)\\",
|
|
257
|
+
opacity: \\"0.6\\",
|
|
258
|
+
marginLeft: \\"-.5rem\\",
|
|
259
|
+
paddingBottom: \\".5rem\\",
|
|
260
|
+
}}
|
|
261
|
+
>
|
|
262
|
+
Array [
|
|
263
|
+
</div>
|
|
264
|
+
</li>
|
|
265
|
+
<div style={{ marginTop: \\".5rem\\", marginBottom: \\".5rem\\" }}>
|
|
266
|
+
string
|
|
267
|
+
</div>
|
|
268
|
+
<li>
|
|
269
|
+
<div
|
|
270
|
+
style={{
|
|
271
|
+
fontSize: \\"var(--ifm-code-font-size)\\",
|
|
272
|
+
opacity: \\"0.6\\",
|
|
273
|
+
marginLeft: \\"-.5rem\\",
|
|
274
|
+
}}
|
|
275
|
+
>
|
|
276
|
+
]
|
|
277
|
+
</div>
|
|
278
|
+
</li>
|
|
279
|
+
</TabItem>
|
|
280
|
+
<TabItem label={\\"MOD3\\"} value={\\"2-item-properties\\"}>
|
|
281
|
+
<div style={{ marginTop: \\".5rem\\", marginBottom: \\".5rem\\" }}>
|
|
282
|
+
boolean
|
|
257
283
|
</div>
|
|
258
|
-
</
|
|
259
|
-
<
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
<li>
|
|
263
|
-
<div
|
|
264
|
-
style={{
|
|
265
|
-
fontSize: \\"var(--ifm-code-font-size)\\",
|
|
266
|
-
opacity: \\"0.6\\",
|
|
267
|
-
marginLeft: \\"-.5rem\\",
|
|
268
|
-
}}
|
|
269
|
-
>
|
|
270
|
-
]
|
|
284
|
+
</TabItem>
|
|
285
|
+
<TabItem label={\\"MOD4\\"} value={\\"3-item-properties\\"}>
|
|
286
|
+
<div style={{ marginTop: \\".5rem\\", marginBottom: \\".5rem\\" }}>
|
|
287
|
+
number
|
|
271
288
|
</div>
|
|
272
|
-
</
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
</
|
|
278
|
-
</
|
|
279
|
-
|
|
280
|
-
<div style={{ marginTop: \\".5rem\\", marginBottom: \\".5rem\\" }}>
|
|
281
|
-
number
|
|
282
|
-
</div>
|
|
283
|
-
</TabItem>
|
|
284
|
-
<TabItem label={\\"MOD5\\"} value={\\"4-item-properties\\"}>
|
|
285
|
-
<div style={{ marginTop: \\".5rem\\", marginBottom: \\".5rem\\" }}>
|
|
286
|
-
string
|
|
287
|
-
</div>
|
|
288
|
-
</TabItem>
|
|
289
|
-
</SchemaTabs>
|
|
289
|
+
</TabItem>
|
|
290
|
+
<TabItem label={\\"MOD5\\"} value={\\"4-item-properties\\"}>
|
|
291
|
+
<div style={{ marginTop: \\".5rem\\", marginBottom: \\".5rem\\" }}>
|
|
292
|
+
string
|
|
293
|
+
</div>
|
|
294
|
+
</TabItem>
|
|
295
|
+
</SchemaTabs>
|
|
296
|
+
</div>
|
|
290
297
|
</div>
|
|
291
298
|
</details>
|
|
292
299
|
</SchemaItem>;
|
|
@@ -66,6 +66,7 @@ function createAnyOneOf(schema: SchemaObject): any {
|
|
|
66
66
|
create("span", {
|
|
67
67
|
className: "badge badge--info",
|
|
68
68
|
children: type,
|
|
69
|
+
style: { marginBottom: "1rem" },
|
|
69
70
|
}),
|
|
70
71
|
create("SchemaTabs", {
|
|
71
72
|
children: schema[type]!.map((anyOneSchema, index) => {
|
|
@@ -74,6 +75,15 @@ function createAnyOneOf(schema: SchemaObject): any {
|
|
|
74
75
|
: `MOD${index + 1}`;
|
|
75
76
|
const anyOneChildren = [];
|
|
76
77
|
|
|
78
|
+
if (
|
|
79
|
+
anyOneSchema.type === "object" &&
|
|
80
|
+
!anyOneSchema.properties &&
|
|
81
|
+
!anyOneSchema.allOf &&
|
|
82
|
+
!anyOneSchema.items
|
|
83
|
+
) {
|
|
84
|
+
anyOneChildren.push(createNodes(anyOneSchema, SCHEMA_TYPE));
|
|
85
|
+
}
|
|
86
|
+
|
|
77
87
|
if (anyOneSchema.properties !== undefined) {
|
|
78
88
|
anyOneChildren.push(createProperties(anyOneSchema));
|
|
79
89
|
delete anyOneSchema.properties;
|
|
@@ -415,79 +425,79 @@ function createDetailsNode(
|
|
|
415
425
|
/**
|
|
416
426
|
* For handling anyOf/oneOf properties.
|
|
417
427
|
*/
|
|
418
|
-
function createAnyOneOfProperty(
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
): any {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
}
|
|
428
|
+
// function createAnyOneOfProperty(
|
|
429
|
+
// name: string,
|
|
430
|
+
// schemaName: string,
|
|
431
|
+
// schema: SchemaObject,
|
|
432
|
+
// required: string[] | boolean,
|
|
433
|
+
// nullable: boolean | unknown
|
|
434
|
+
// ): any {
|
|
435
|
+
// return create("SchemaItem", {
|
|
436
|
+
// collapsible: true,
|
|
437
|
+
// className: "schemaItem",
|
|
438
|
+
// children: [
|
|
439
|
+
// createDetails({
|
|
440
|
+
// className: "openapi-markdown__details",
|
|
441
|
+
// children: [
|
|
442
|
+
// createDetailsSummary({
|
|
443
|
+
// children: [
|
|
444
|
+
// create("strong", { children: name }),
|
|
445
|
+
// create("span", {
|
|
446
|
+
// style: { opacity: "0.6" },
|
|
447
|
+
// children: ` ${schemaName}`,
|
|
448
|
+
// }),
|
|
449
|
+
// guard(
|
|
450
|
+
// (schema.nullable && schema.nullable === true) ||
|
|
451
|
+
// (nullable && nullable === true),
|
|
452
|
+
// () => [
|
|
453
|
+
// create("strong", {
|
|
454
|
+
// style: {
|
|
455
|
+
// fontSize: "var(--ifm-code-font-size)",
|
|
456
|
+
// color: "var(--openapi-nullable)",
|
|
457
|
+
// },
|
|
458
|
+
// children: " nullable",
|
|
459
|
+
// }),
|
|
460
|
+
// ]
|
|
461
|
+
// ),
|
|
462
|
+
// guard(
|
|
463
|
+
// Array.isArray(required)
|
|
464
|
+
// ? required.includes(name)
|
|
465
|
+
// : required === true,
|
|
466
|
+
// () => [
|
|
467
|
+
// create("strong", {
|
|
468
|
+
// style: {
|
|
469
|
+
// fontSize: "var(--ifm-code-font-size)",
|
|
470
|
+
// color: "var(--openapi-required)",
|
|
471
|
+
// },
|
|
472
|
+
// children: " required",
|
|
473
|
+
// }),
|
|
474
|
+
// ]
|
|
475
|
+
// ),
|
|
476
|
+
// ],
|
|
477
|
+
// }),
|
|
478
|
+
// create("div", {
|
|
479
|
+
// style: { marginLeft: "1rem" },
|
|
480
|
+
// children: [
|
|
481
|
+
// guard(getQualifierMessage(schema), (message) =>
|
|
482
|
+
// create("div", {
|
|
483
|
+
// style: { marginTop: ".5rem", marginBottom: ".5rem" },
|
|
484
|
+
// children: createDescription(message),
|
|
485
|
+
// })
|
|
486
|
+
// ),
|
|
487
|
+
// guard(schema.description, (description) =>
|
|
488
|
+
// create("div", {
|
|
489
|
+
// style: { marginTop: ".5rem", marginBottom: ".5rem" },
|
|
490
|
+
// children: createDescription(description),
|
|
491
|
+
// })
|
|
492
|
+
// ),
|
|
493
|
+
// ],
|
|
494
|
+
// }),
|
|
495
|
+
// createAnyOneOf(schema),
|
|
496
|
+
// ],
|
|
497
|
+
// }),
|
|
498
|
+
// ],
|
|
499
|
+
// });
|
|
500
|
+
// }
|
|
491
501
|
|
|
492
502
|
/**
|
|
493
503
|
* For handling discriminators that map to a same-level property (like 'petType').
|
|
@@ -606,7 +616,7 @@ function createEdges({
|
|
|
606
616
|
}
|
|
607
617
|
|
|
608
618
|
if (schema.oneOf !== undefined || schema.anyOf !== undefined) {
|
|
609
|
-
return
|
|
619
|
+
return createDetailsNode(
|
|
610
620
|
name,
|
|
611
621
|
schemaName,
|
|
612
622
|
schema,
|