-
Notifications
You must be signed in to change notification settings - Fork 214
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
Add validate_core_schema
function and remove validation from SchemaValidator
and SchemaSerializer
constructors
#982
Conversation
please review |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #982 +/- ##
=======================================
Coverage 93.09% 93.09%
=======================================
Files 106 106
Lines 15830 15832 +2
Branches 26 26
=======================================
+ Hits 14737 14739 +2
Misses 1086 1086
Partials 7 7
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
CodSpeed Performance ReportMerging #982 will degrade performances by 20.54%Comparing Summary
Benchmarks breakdown
|
I'd prefer a method that validates the self-schema, and then remove that from the SchemaValidator and SchemaSerialzier constructors. |
9432e26
to
102c224
Compare
validate_core_schema
function and remove validation from SchemaValidator
and SchemaSerializer
constructors
Made the change proposed above. It's also now clear where in our tests we're passing in schemas that need to be coerced, I'd suggest we minimize that and eventually remove it in followup PRs. Ideally a CoreSchema doesn't need to be validated at all. |
LGTM, I am author so cannot approve. Feel free to approve & merge. |
This currently uses lax mode for validation (i.e. will coerce strings to dates and such) | ||
but may use strict mode in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be nice to add a strict
flag to make this easier later ;)
Change Summary
Related to startup performance. The idea is that
pydantic
will have more control over when the CoreSchema gets validated, e.g. validating it once for bothSchemaValidator
andSchemaSerializer
, deciding not to validate it at all based on an env var, etc.Selected Reviewer: @samuelcolvin