-
-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(DTO): Support extra="forbid"
model config for PydanticDTO
#3691
Conversation
@peterschutt to keep you in the loop a bit. This isn't really merging configurations, but it's a step in the right direction and at least allows per-model dynamic configs. I think this should help to handle a few of the use cases of config merging already. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3691 +/- ##
=======================================
Coverage 98.28% 98.28%
=======================================
Files 329 329
Lines 14949 14965 +16
Branches 2375 2382 +7
=======================================
+ Hits 14692 14708 +16
Misses 116 116
Partials 141 141 ☔ View full report in Codecov by Sentry. |
84b26cf
to
0c6f60b
Compare
f7b0abd
to
6888c41
Compare
6888c41
to
02b8d44
Compare
Quality Gate passedIssues Measures |
Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3691 |
Sounds great! Thanks for the ping:) |
Set
forbid_unkown_fields=True
forPydanticDTOs
where the Pydantic model has anextra="forbid"
config.get_config_for_model_type
method toAbstractDTO
, that allows to customise the base config defined on the DTO factory for a specific model typeget_config_for_model_type
to setforbid_unkown_fields=True
for Pydantic models that use the `extra="forbid" configDepends on #3690. Don't merge before that one :)