Align extra_slots support across pythongen/pydanticgen, per-class enabled#3630
Align extra_slots support across pythongen/pydanticgen, per-class enabled#3630noelmcloughlin wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3630 +/- ##
==========================================
+ Coverage 80.43% 83.84% +3.40%
==========================================
Files 158 158
Lines 19007 19037 +30
Branches 4004 4011 +7
==========================================
+ Hits 15289 15961 +672
+ Misses 2877 2187 -690
- Partials 841 889 +48
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:
|
|
On the pydanticgen part, there's a parallel conversation happening in a other PR re: json schema gen, and I think that the option for the generator to override the schema should be removed (previously it was not overriding the schema because there was no way to control extra slots in the schema). Implementing extra slots also requires handling the expression form where a type is set for https://pydantic.dev/docs/validation/latest/concepts/models/#extra-data |
|
I think the feature might be contained enough to do python and pydanticgen in one PR, but with the addition of handling the expression form, it might balloon a bit. If it becomes unwieldy, In general I would favor splitting it by generator rather than doing boolean form first and then expression form for both, just because I think we should ship the complete feature at a time. Might be worth doing that now and splitting PR before further work done, but up to you. Re: the requested deprecation/pydanticgen part, I don't want to take work off your plate that youve already started, but I was planning on doing it this week anyway, and would be happy to help with that if its proving tricky. If you do the implementation, i can handle doing the deprecation notice for the generator param (unless you are interested in checking out how that works, at which point ofc explore!) Just offering help if its wanted and a bit of guidance so it doesn't feel like I'm asking for huge changes without help, but again not trying to be overbearing or discouraging by taking it from you. |
Summary
Fixes #3629
cls.extra_slots.allowedand emit per-class behavior that matches schema.How was this tested?
Added unit tests
Areas of uncertainty
Checklist
AI Assistance
LLM assisted