-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support deserializing missing fields that have defaults (#9)
Adds support in `deserialize` for missing fields that are defined with default values. If a `NamedTuple` or `@dataclass` deriving type's field is set with a default value (i.e. `seconds: int = 10`), then, it is ok for a raw value passed in to `deserialize` to not have this field. Upon encountering this situation, the field's default value will be used. The existing prior behavior was to raise a `MissingRequired` exception. This was confusing as it was technically an incorrect error to raise. New test cases validate this default-respecting behavior during deserialization. Version `0.4.0`
- Loading branch information
1 parent
5d0f77d
commit 8becdab
Showing
5 changed files
with
174 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
3.8.3 | ||
3.8.5 | ||
3.7.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "pywise" | ||
version = "0.3.2" | ||
version = "0.4.0" | ||
description = "Robust serialization support for NamedTuple & @dataclass data types." | ||
authors = ["Malcolm Greaves <[email protected]>"] | ||
homepage = "https://github.com/malcolmgreaves/pywise" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters