Add deprecation warning for Pydantic v2 without --use-annotated#2914
Add deprecation warning for Pydantic v2 without --use-annotated#2914
Conversation
|
Warning Rate limit exceeded@koxudaxi has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 12 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR adds a deprecation warning system for Pydantic v2 users who don't explicitly set Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
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-2914.datamodel-code-generator.pages.dev |
CodSpeed Performance ReportMerging #2914 will degrade performance by 15.38%Comparing
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | test_perf_kubernetes_style_pydantic_v2 |
2.2 s | 2.6 s | -15.31% |
| ❌ | WallTime | test_perf_deep_nested |
5.3 s | 6 s | -13.14% |
| ❌ | WallTime | test_perf_graphql_style_pydantic_v2 |
714.1 ms | 828.7 ms | -13.83% |
| ❌ | WallTime | test_perf_large_models_pydantic_v2 |
3.1 s | 3.7 s | -15.38% |
| ❌ | WallTime | test_perf_complex_refs |
1.7 s | 2 s | -14.47% |
| ❌ | WallTime | test_perf_all_options_enabled |
5.8 s | 6.8 s | -13.59% |
| ❌ | WallTime | test_perf_aws_style_openapi_pydantic_v2 |
1.7 s | 1.9 s | -12.78% |
| ❌ | WallTime | test_perf_openapi_large |
2.5 s | 2.9 s | -13.39% |
| ❌ | WallTime | test_perf_multiple_files_input |
3.2 s | 3.7 s | -13.68% |
| ❌ | WallTime | test_perf_duplicate_names |
849.8 ms | 998.9 ms | -14.92% |
| ❌ | WallTime | test_perf_stripe_style_pydantic_v2 |
1.7 s | 2 s | -13.73% |
Footnotes
-
98 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2914 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 93 93
Lines 16841 16865 +24
Branches 1951 1952 +1
=========================================
+ Hits 16841 16865 +24
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:
|
4ecea24 to
6c5b5f9
Compare
Generated by GitHub Actions
Breaking Change AnalysisResult: No breaking changes detected Reasoning: This PR adds a deprecation warning but does not change any actual behavior. The warning is emitted when using Pydantic v2 without explicitly specifying --use-annotated or --no-use-annotated, but the generated code output remains exactly the same. The default value (use_annotated=False) is unchanged - only a warning is added to inform users that the default will change in a future version. The change to use BooleanOptionalAction for --use-annotated is backward compatible since --use-annotated still works as before, and --no-use-annotated is simply a new option that allows users to explicitly opt out. No existing workflows, generated code, templates, or API behavior are affected. This analysis was performed by Claude Code Action |
|
🎉 Released in 0.52.1 This PR is now available in the latest release. See the release notes for details. |
Fixes: #2313
Summary by CodeRabbit
New Features
--use-annotatedflag.--no-use-annotatedCLI option.--use-annotatedCLI option to accept explicit true/false values.Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.