Update datamodel-code-generator requirement - #611
Conversation
|
Warning Review limit reached
More reviews will be available in 22 minutes and 30 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
WalkthroughThe PR adds two remote ChangesRemote
Sequence Diagram(s)sequenceDiagram
participant main
participant generate_code
participant OpenAPIParser
participant OpenAPIModelParser
main->>generate_code: remote-ref options and specify_tags
generate_code->>generate_code: _resolve_remote_reference_options(...)
generate_code->>OpenAPIParser: normalized allow_remote_refs and allow_private_network
OpenAPIParser->>OpenAPIModelParser: allow_remote_refs and allow_private_network
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
|
📚 Docs Preview: https://pr-611.fastapi-code-generator.pages.dev |
Merging this PR will improve performance by 44.7%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | test_generate_default_template_benchmark |
57.1 ms | 39.4 ms | +44.7% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing update-datamodel-code-generator (fd73150) with main (a253d2a)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #611 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 17 17
Lines 1461 1500 +39
Branches 153 158 +5
=========================================
+ Hits 1461 1500 +39
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
fastapi_code_generator/cli.py (1)
79-83: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueOptional: surface the contradictory
--no-allow-remote-refs --allow-private-networkcombination.When
allow_remote_refs=Falseandallow_private_network=True, the function returns(False, True), i.e. private-network access is enabled while remote$reffetching is fully disabled — a no-op/contradictory state. Consider warning (or ignoring--allow-private-network) when remote refs are explicitly disabled, so users get feedback instead of a silently meaningless flag.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@fastapi_code_generator/cli.py` around lines 79 - 83, The allow-remote-refs resolution in the CLI currently returns a contradictory `(False, True)` state when `--no-allow-remote-refs` is combined with `--allow-private-network`. Update the option-handling logic in the function that processes `allow_remote_refs` and `allow_private_network` to either warn the user or ignore `allow_private_network` whenever remote refs are explicitly disabled. Keep the behavior consistent with the existing `match` handling so the result is not a silently meaningless flag combination.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pyproject.toml`:
- Line 31: The dependency constraint for datamodel-code-generator is too low and
still allows versions that do not support the allow_private_network argument
used by the parser. Update the requirement in pyproject.toml for
datamodel-code-generator[http] to start at 0.61 while keeping the existing upper
bound, so the package manager will avoid installing incompatible 0.59.x and
0.60.x releases.
---
Nitpick comments:
In `@fastapi_code_generator/cli.py`:
- Around line 79-83: The allow-remote-refs resolution in the CLI currently
returns a contradictory `(False, True)` state when `--no-allow-remote-refs` is
combined with `--allow-private-network`. Update the option-handling logic in the
function that processes `allow_remote_refs` and `allow_private_network` to
either warn the user or ignore `allow_private_network` whenever remote refs are
explicitly disabled. Keep the behavior consistent with the existing `match`
handling so the result is not a silently meaningless flag combination.
🪄 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: 3216d5dd-5206-45b6-813d-82863ac3e6a9
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (15)
README.mddocs/cli-reference.mddocs/index.mddocs/llms-full.txtfastapi_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/cli_doc/test_cli_doc_coverage.pytests/cli_doc/test_cli_options_sync.pytests/main/test_main.pytests/test_config.pytests/test_parser.py
Breaking Change AnalysisResult: Breaking changes detected Reasoning: This PR contains multiple breaking changes: (1) The parse_responses rewrite fundamentally changes how non-200 success status codes are rendered in generated FastAPI code - changing response_model values, adding explicit status_code parameters, and altering return type annotations. This directly changes the HTTP behavior of regenerated applications (status codes shift from 200 to the correct code like 201). (2) The operation.status_code field is now populated for many more operations, which affects custom Jinja2 templates. (3) The minimum datamodel-code-generator version was bumped from 0.59 to 0.61, dropping support for two minor versions of that dependency. Content for Release NotesCode Generation Changes
Custom Template Update Required
Python or Dependency Support Changes
This analysis was performed by Claude Code Action |
|
🎉 Released in 0.8.0 This PR is now available in the latest release. See the release notes for details. |
Summary by CodeRabbit
New Features
$refhandling, including allowing remote HTTP/HTTPS references and trusted private-network references.Bug Fixes