Commit 60c27be
authored
Fix Python (e.g. FastApi) example generation (#23537)
* Fix FastAPI example generation
* Address reviewer feedback: check plural examples in getSchemaExample
- Fall back to first entry of `examples` array when `example` is absent,
fixing schema example extraction for OAS 3.1 specs.
- Add unit tests for plural and singular example precedence via
TestableFastAPICodegen helper subclass.
- Add nickname property with examples array to test fixture.
* fix(python-fastapi): keep trailing comma on same line as parameter
Remove trailing newline from endpoint_argument_definition.mustache so
the comma after each parameter stays inline rather than appearing on a
new line.
Regenerate python-fastapi petstore sample.
* Update samples1 parent 1e60f43 commit 60c27be
26 files changed
Lines changed: 2634 additions & 96 deletions
File tree
- modules/openapi-generator/src
- main
- java/org/openapitools/codegen/languages
- resources/python-fastapi
- test
- java/org/openapitools/codegen/python
- resources/3_0/python-fastapi
- samples
- client/echo_api
- python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models
- python/openapi_client/models
- openapi3/client/petstore
- python-aiohttp/petstore_api/models
- python-httpx/petstore_api/models
- python-lazyImports/petstore_api/models
- python/petstore_api/models
- server/petstore/python-fastapi/src/openapi_server/models
Lines changed: 93 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
635 | 636 | | |
636 | 637 | | |
637 | 638 | | |
| 639 | + | |
638 | 640 | | |
639 | 641 | | |
640 | 642 | | |
641 | 643 | | |
| 644 | + | |
642 | 645 | | |
643 | 646 | | |
644 | 647 | | |
| 648 | + | |
645 | 649 | | |
646 | 650 | | |
647 | 651 | | |
648 | 652 | | |
649 | 653 | | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
650 | 739 | | |
651 | 740 | | |
652 | 741 | | |
| |||
2171 | 2260 | | |
2172 | 2261 | | |
2173 | 2262 | | |
2174 | | - | |
2175 | | - | |
2176 | | - | |
2177 | | - | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
2178 | 2267 | | |
2179 | 2268 | | |
2180 | 2269 | | |
| |||
2247 | 2336 | | |
2248 | 2337 | | |
2249 | 2338 | | |
2250 | | - | |
2251 | | - | |
2252 | | - | |
2253 | | - | |
2254 | | - | |
2255 | 2339 | | |
2256 | 2340 | | |
2257 | 2341 | | |
| |||
0 commit comments