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

Support null values when parsing optional fields #43

Merged
merged 1 commit into from
Feb 22, 2021

Conversation

joneshf
Copy link
Owner

@joneshf joneshf commented Feb 22, 2021

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. This
is 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.

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`. This
is 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.
@joneshf joneshf merged commit 45de025 into master Feb 22, 2021
@joneshf joneshf deleted the parse-json-null-as-nothing branch February 22, 2021 16:27
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.

None yet

1 participant