Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert: Only consider present map elements when converting to object…
… type Optional object attributes give us a new situation to consider here: the source element type might not be compatible with all of the optional attributes of a target object type, but that doesn't matter if the given map doesn't include an element corresponding with the mismatching attributes. This is a bit awkward because we need to first allow the type conversion logic to produce a valid conversion but then catch the attribute mismatch only when applying the conversion function to the value. This is effectively the same sequence of events that happens when converting from string to number or string to bool: we optimistally assume that a conversion will succeed when looking only at types, and then catch the error dynamically once we have a final value to check.
- Loading branch information
1 parent
82eaa67
commit ac3f431
Showing
2 changed files
with
120 additions
and
5 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