Update datamodel-code-generator to 0.56.1#534
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughDocs, types, CLI, and parser updated to prefer Pydantic v2: default output model set to Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merging this PR will degrade performance by 18.48%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | test_generate_default_template_benchmark |
37.2 ms | 45.7 ms | -18.48% |
Comparing chore/update-datamodel-code-generator-0-56-1 (13aaf10) with main (342dc40)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #534 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 16 16
Lines 1012 1049 +37
Branches 110 110
=========================================
+ Hits 1012 1049 +37
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
📚 Docs Preview: https://pr-534.fastapi-code-generator.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/data/expected/openapi/coverage/model_options/main.py`:
- Around line 64-67: The GET endpoint show_food_by_id currently declares the
list query parameter as message_texts: Optional[List[str]] = None which FastAPI
treats as a request body; change the signature to message_texts:
Optional[List[str]] = Query(None) and add the Query import from fastapi so
FastAPI recognizes it as an optional list query parameter (update the function
show_food_by_id and imports accordingly).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 73644768-ca9c-4f7d-b0c6-1b8d893b3fe5
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (18)
README.mddocs/cli-reference.mddocs/index.mddocs/llms-full.txtdocs/supported_formats.mdfastapi_code_generator/_types/generate_config_dict.pyfastapi_code_generator/cli.pyfastapi_code_generator/config.pyfastapi_code_generator/parser.pyfastapi_code_generator/prompt_data.pypyproject.tomltests/data/expected/openapi/coverage/model_options/custom_models.pytests/data/expected/openapi/coverage/model_options/main.pytests/data/expected/openapi/default_template/body_and_parameters/models.pytests/data/expected/openapi/default_template/discriminator_in_root_with_properties/models.pytests/data/expected/openapi/default_template/recursion/models.pytests/data/expected/openapi/default_template/shadowed_imports/models.pytests/test_config.py
💤 Files with no reviewable changes (1)
- tests/data/expected/openapi/coverage/model_options/custom_models.py
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@fastapi_code_generator/parser.py`:
- Around line 389-397: Replace raw single-quoted orig_name usages with a
repr-wrapped value to safely escape quotes/backslashes; specifically update the
alias construction in the Query branch (replace alias = f", alias='{orig_name}'"
with alias = f", alias={repr(orig_name)}") and the inline alias in the non-query
branch (replace alias='orig_name' inside the f-string for param_is with
alias={repr(orig_name)}), keeping the existing logic for required/default and
imports_for_fastapi, Query, param_is, default_value, alias and default
variables.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 52e688a7-e03e-4f92-ac88-94b7c086aee1
📒 Files selected for processing (4)
fastapi_code_generator/parser.pytests/data/expected/openapi/coverage/model_options/main.pytests/data/expected/openapi/default_template/body_and_parameters/main.pytests/data/expected/openapi/remote_ref/body_and_parameters/main.py
…l-code-generator-0-56-1
…l-code-generator-0-56-1 # Conflicts: # fastapi_code_generator/prompt_data.py
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/build_prompt_data.py`:
- Around line 128-131: The help text for the "--output" argument is stale
because _render_output can emit Python when the path ends with .py, so update
the parser.add_argument help string (the "--output" argument in
build_prompt_data.py) to describe that the file may be JSON or a Python module
depending on the extension (e.g., ".json" for JSON payload, ".py" for Python),
and optionally mention that format selection is done by _render_output based on
the output filename extension.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0c216db6-be6d-4043-886a-09e70e28e875
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (6)
docs/cli-reference.mddocs/llms-full.txtfastapi_code_generator/prompt_data.pypyproject.tomlscripts/build_prompt_data.pytests/main/test_main.py
✅ Files skipped from review due to trivial changes (1)
- pyproject.toml
🚧 Files skipped from review as they are similar to previous changes (2)
- fastapi_code_generator/prompt_data.py
- docs/llms-full.txt
Summary by CodeRabbit
New Features
--enum-field-as-literalgains anonechoicepydantic_v2.dataclassas an output model option; default output model nowpydantic_v2.BaseModelChores
Behavioral/Generated Output
Documentation
Tests