Commit 6cd891e
authored
fix(theme): show dropdown for enum parameters wrapped in allOf (#1301)
Add support for detecting enum values inside allOf schemas when
rendering parameter form inputs and schema documentation. Previously,
enums wrapped in allOf (e.g., for nullable enum refs) would incorrectly
render as text inputs and show "object" type instead of displaying the
actual enum values.
Changes:
- Add getSchemaEnum() helper to ParamOptions for form input detection
- Add getEnumFromSchema() and getTypeFromSchema() helpers to schema.ts
- Update prettyName() to return correct type for allOf with enums
- Update getQualifierMessage() to show enum values from allOf
- Update ParamSelectFormItem to extract enum from allOf
- Update ParamMultiSelectFormItem to extract enum from allOf for arrays
- Add test case in demo/examples/tests/allOf.yaml
- Add servers to allOf.yaml spec for API Explorer testing
- Enable API Explorer for test specs (hideSendButton: false)
Fixes #12331 parent 0f643dd commit 6cd891e
File tree
6 files changed
+165
-17
lines changed- demo
- examples/tests
- packages/docusaurus-theme-openapi-docs/src
- markdown
- theme/ApiExplorer/ParamOptions
- ParamFormItems
6 files changed
+165
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
| 369 | + | |
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
412 | 415 | | |
413 | 416 | | |
414 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 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 | + | |
415 | 478 | | |
416 | 479 | | |
417 | 480 | | |
| |||
613 | 676 | | |
614 | 677 | | |
615 | 678 | | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
620 | 688 | | |
621 | | - | |
622 | | - | |
623 | | - | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
624 | 697 | | |
625 | 698 | | |
626 | 699 | | |
| |||
Lines changed: 53 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
13 | 51 | | |
14 | 52 | | |
15 | 53 | | |
| |||
28 | 66 | | |
29 | 67 | | |
30 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
31 | 75 | | |
32 | 76 | | |
33 | 77 | | |
| |||
92 | 136 | | |
93 | 137 | | |
94 | 138 | | |
95 | | - | |
96 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
97 | 143 | | |
98 | | - | |
| 144 | + | |
99 | 145 | | |
100 | 146 | | |
101 | 147 | | |
| |||
177 | 223 | | |
178 | 224 | | |
179 | 225 | | |
180 | | - | |
181 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
182 | 230 | | |
183 | 231 | | |
184 | 232 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
Lines changed: 27 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
26 | 48 | | |
27 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
28 | 53 | | |
29 | 54 | | |
30 | 55 | | |
31 | 56 | | |
32 | 57 | | |
33 | 58 | | |
34 | 59 | | |
35 | | - | |
| 60 | + | |
36 | 61 | | |
37 | 62 | | |
38 | 63 | | |
| |||
0 commit comments