Map OpenAPI Discriminator mapping's values to their real value in enums #3074
Map OpenAPI Discriminator mapping's values to their real value in enums #3074ilovelinux wants to merge 3 commits intokoxudaxi:mainfrom
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR fixes integer discriminator handling in OpenAPI schema generation. When a discriminator property has multiple enum values, the parser now correctly generates integer literals instead of string literals, and refactors the discriminator value resolution logic based on a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
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 15.48%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | test_perf_all_options_enabled |
6 s | 6.8 s | -12.57% |
| ❌ | WallTime | test_perf_deep_nested |
5.6 s | 6.4 s | -12.7% |
| ❌ | WallTime | test_perf_openapi_large |
2.6 s | 3.1 s | -14.69% |
| ❌ | WallTime | test_perf_kubernetes_style_pydantic_v2 |
2.4 s | 2.8 s | -13.66% |
| ❌ | WallTime | test_perf_duplicate_names |
964.4 ms | 1,119.3 ms | -13.84% |
| ❌ | WallTime | test_perf_multiple_files_input |
3.4 s | 3.9 s | -13.31% |
| ❌ | WallTime | test_perf_large_models_pydantic_v2 |
3.3 s | 3.9 s | -15.48% |
| ❌ | WallTime | test_perf_stripe_style_pydantic_v2 |
1.8 s | 2.1 s | -12.91% |
| ❌ | WallTime | test_perf_graphql_style_pydantic_v2 |
751.9 ms | 868.9 ms | -13.46% |
| ❌ | WallTime | test_perf_complex_refs |
2 s | 2.3 s | -12.6% |
| ❌ | WallTime | test_perf_aws_style_openapi_pydantic_v2 |
1.7 s | 2 s | -14.33% |
Comparing ilovelinux:fix/ilovelinux-3073-enum-literal-values (5d8f912) with main (92bdc27)
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❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3074 +/- ##
===========================================
- Coverage 100.00% 99.99% -0.01%
===========================================
Files 87 87
Lines 18306 18313 +7
Branches 2091 2095 +4
===========================================
+ Hits 18306 18312 +6
- Partials 0 1 +1
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:
|
|
This PR is draft because of the following tasks:
|
Context
mappingfield is a key-value dictionary.Ref: https://swagger.io/specification/#options-for-mapping-values-to-schemas
What's changed
mapping's keys are mapped to their real enum values, if availableNotes
Summary by CodeRabbit