Support null values when parsing optional fields #43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We want to be more lenient in what we accept.
Up until now, we've required that the JSON we parse come in a specific
format: optional values don't exist. Unfortunately, things aren't so
consistent in the real world.
Instead of failing if we see an optional field that has a
null
value,we parse it as though the value coming in was
Data.Maybe.Nothing
. Thisis akin to how record-based values work (like
Option.set'
).Since this changes the semantics of parsing, this is a breaking change,
and we should deal with it as such.
With this change, we ought to be able to be used in more places without
causing undue burden.