-
Notifications
You must be signed in to change notification settings - Fork 516
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
fix: schema class can set Meta.unknown #1885
fix: schema class can set Meta.unknown #1885
Conversation
Signed-off-by: Daniel Bluhm <[email protected]>
Signed-off-by: Daniel Bluhm <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #1885 +/- ##
==========================================
- Coverage 93.55% 93.53% -0.02%
==========================================
Files 539 539
Lines 34526 34559 +33
==========================================
+ Hits 32300 32326 +26
- Misses 2226 2233 +7 |
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Kudos, SonarCloud Quality Gate passed! |
This PR enables the Schema class of a model to determine the default
unknown
behavior. Without this, if you have a schema where you expect extra values to be present, every timedeserialize
orserialize
is called, you must setunknown=INCLUDE
. Now, in theMeta
class of the Schema,unknown
can be set to some value that will be respected as the default if not overrided by method parameter.While I was at it, I also touched up some of the typing. I'm not fond of using
@overload
but I think it's the best way to address typing a method where a bool flag impacts the return type.