-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Add support for distinguishing explicit and implicit null in ArgBuilders #929
Conversation
@@ -39,6 +43,30 @@ object Scala2SpecificSpec extends DefaultRunnableSpec { | |||
"""{"events":[{"organizationId":7,"title":"Frida Kahlo exhibition"}],"painters":[{"name":"Claude Monet","movement":"Impressionism"}]}""" | |||
) | |||
) | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the test is same for Scala 2 and Scala 3, you can simply add it in the scala
folder, no need to duplicate it. These files are just for Scala2 or Scala3 specific features (like Scala 3 enums).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason I though it had to be there for it to run for each version - I'll move the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
This PR adds support for distinguishing between explicit null, where a
null
was sent to an input, from implicit null, where no value was provided for an input field. It uses an approach inspired by zio-json'sJsonDecoder
, adding a newbuildMissing
method toArgBuilder
that by default callsbuild
withNullValue
. The new method is called when a field is missing. This change should be backwards compatible, with no change in behavior for existingArgBuilder
instances.New
ArgBuilder
instances can override thebuildMissing
method to customize their behavior when a value is missing and provide different behavior from whennull
is supplied.