-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Cannot deserialize None
values in a tuple
#628
Comments
I'm currently travelling and when I get back, I have higher priority items to look at. Using tuples for data binding is supported but not encouraged. Could you use a case class? The JSON will look a little different but case classes are the Scala norm for data binding. You could also try testing with a newer version of this lib. There are also numerous alternative libs out there if this one doesn't suit your needs. |
In particular, trying with 2.14.2 (or 2.15.0-rc2) would be easy step to see that problem still occurs. 2.12 is bit old version. |
@pjfanning |
I haven't check the deserialization code yet but serialization seems to work (which is a start) - 1741f14 |
@cowtowncoder I tried this deserialization case and the issue is happening in jackson-databind StringDeserializer. This test case works with scala.Option (this scala class is very similar to java.lang.Optional. But with scala.Option, jackson-module-scala creates a jackson-databind StringDeserializer to handle the deserialization of the underlying value. jackson-databind StringDeserializer blows up when it sees
|
@cowtowncoder I added this check in the jackson-module-scala code (eb55d7a) so that I can catch the fact the JSON value is null before invoking the inner deserializer. |
@pjfanning Contract with In case of POJO properties, for example, Given this, |
None
values in a tuple
Deserializing a tuple that contains
Some
values succeeds.However, a MismatchedInputException will be thrown during deserialization If the tuple contains
None
values.Version
Actual behavior
The test case
"deserialize OptionalTupleHolder that has 'None' values"
fails.Details of MismatchedInputException
Expected behavior
The json
{"tuple":[null,null]}
is deserialized toOptionalTupleHolder((None, None))
without any Exceptions.The text was updated successfully, but these errors were encountered: