Skip to content
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

Merged
merged 10 commits into from
Oct 24, 2022

Conversation

dbluhm
Copy link
Contributor

@dbluhm dbluhm commented Aug 4, 2022

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 time deserialize or serialize is called, you must set unknown=INCLUDE. Now, in the Meta 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.

@dbluhm dbluhm marked this pull request as ready for review August 4, 2022 16:55
@codecov-commenter
Copy link

codecov-commenter commented Aug 9, 2022

Codecov Report

Merging #1885 (d2ea331) into main (a16347d) will decrease coverage by 0.01%.
The diff coverage is 85.10%.

@@            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     

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
8.4% 8.4% Duplication

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@ianco ianco merged commit b243f20 into openwallet-foundation:main Oct 24, 2022
@dbluhm dbluhm deleted the fix/base-model-unknown branch July 7, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants