| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
This PR fixes the handling of optional request bodies in the OpenAPI Python client generator. Previously, optional bodies were incorrectly treated as required, causing them to always be included in requests. The fix ensures that optional bodies (where requestBody.required is false or missing) are properly typed with Unset, default to UNSET, and are only included in requests when explicitly provided.
Key Changes:
Copilot reviewed 32 out of 32 changed files in this pull request and generated 6 comments.
Show a summary per file| File | Description |
|---|---|
| openapi_python_client/parser/bodies.py | Passes the actual body.required value instead of hardcoding True |
| openapi_python_client/parser/properties/union.py | Adds deduplication logic to remove duplicate types from unions and uses Iterator for better memory efficiency |
| openapi_python_client/templates/property_templates/*.py.jinja | Adds skip_unset parameter to transform macros to conditionally skip UNSET initialization |
| openapi_python_client/templates/endpoint_macros.py.jinja | Updates body handling to check if bodies are optional and conditionally include them in requests |
| openapi_python_client/templates/endpoint_module.py.jinja | Uses no_optional=True for isinstance checks with multiple bodies |
| end_to_end_tests/golden-record/* | Updated golden records showing correct handling of optional bodies with Unset types |
| end_to_end_tests/baseline_openapi_. | Added test cases for optional bodies and duplicate union types |
| tests/test_parser/test_properties/test_union.py | Updated test to verify different property types in unions |
| .changeset/fix_optional_bodies.md | Documents the fix for optional bodies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Reopening #1357