-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RecapType.is_nullable should iterate on union types
There was a bug in #423. Null types in a union with `extra_attrs` or other attributes set would result in `False` returned when there was in fact a NullType in the UnionType's `types` list. `__eq__` checks all attributes, so you must iterate over the UnionType's `types` attribute and look for any type with `isinstance(..., NullType) is True`. I updated the logic accordingly. In doing so, I discovered that the JSON converter logic was converting JSON schema fields of `null` type to a UnionType with a single nested NullType type. This seems wrong; I updated the test to validate that `null` JSON fields are returned as `NullType` with a default of `None`.
- Loading branch information
1 parent
22d0e73
commit 00541ac
Showing
4 changed files
with
58 additions
and
14 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
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