-
Notifications
You must be signed in to change notification settings - Fork 634
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
Lagom 1.6.5 silently performs only partial deserialization when using custom deserializers #3241
Comments
Hi @lapidus79, at first I thought the issue was related to this line and akka/akka#29797. But even as I tuned the As I debugged your reproducer a bit more, I noticed the error was trigger after parsing
And I don't know what is going on. |
Maybe the issue is related to this: FasterXML/jackson-databind#2904. |
@ignasi35 yes, for some reason the cursor does not seem to move in the same way in 1.6.5. The problem with setting the class with the custom deserializer last is that will work only if you have exactly one such field in the root class. In case you have
=> then things will fall apart Could this issue also affect for example migrations 🤔? The FasterXML/jackson-databind#2904 issue does really look like similar to this. The thing that perplexes me is that I tried to override jackson deps to 2.11.4 in lagom 1.6.4 and it worked. It is possible that is somehow have messed up the override commands and that maybe jackson 2.10.4 was still used?. It would be cool if someone who knows how to override in sbt could verify that it was indeed 2.11.4 used and not 2.10.4. In this way we would at least be sure that the statement below not lead us astray:
|
The problem occurs in Lagom 1.6.4 will use fasterxml JsonNodeDeserializer.java I pushed a new commit to https://github.com/lapidus79/lagom-1-6-5-custom-deserializer-issue that disables the JsonNodeDeserializer.scala when starting the server. After this
It seems that the TreeTraversingParser state is different after calling JsonNodeDeserializer.deserialize(jp: JsonParser, ctxt: DeserializationContext): vs the equivalent fasterxml impl. |
Edit: the reading to JSONNode works as expected, the binding fails. So, yeah, the error is on Play's custom JSONNodeDeserializer |
@lapidus79 I put together a fix but while it's not released there's also a workaround you could use in your code. In
You should use:
|
Brilliant @ignasi35! You are the GOAT 🙇♂️ |
Credit goes to @jrudolph 😅 |
Lagom Version (1.2.x / 1.3.x / etc)
1.6.5
API (Scala / Java / Neither / Both)
Java
Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)
MacOs Catalina 10.15.5
JDK (Oracle 1.8.0_112, OpenJDK 1.8.x, Azul Zing)
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.6+10, mixed mode)
Problem
child
field, which class uses a custom deserializer.child
(i.e. updatedAt and updatedBy fields) being silently deserialized to null valuesReproducible Test Case
There is a fully reproducible test case here https://github.com/lapidus79/lagom-1-6-5-custom-deserializer-issue
To reproduce run
RootEntityStateTest
and test run will fail.After that edit the
project/plugins.sbt
and set lagom version to1.6.4.
. Now reload and run test again and it will pass.Also tried to debug 1.6.4 vs 1.6.5 and there is a a difference which might help:
https://github.com/lapidus79/lagom-1-6-5-custom-deserializer-issue/blob/master/lagom164_breakpoint_in_deser.png
https://github.com/lapidus79/lagom-1-6-5-custom-deserializer-issue/blob/master/lagom165_breakpoint_in_deser.png
https://github.com/lapidus79/lagom-1-6-5-custom-deserializer-issue/blob/master/lagom_164_processing_continues_since_FIELD_NAME.png
https://github.com/lapidus79/lagom-1-6-5-custom-deserializer-issue/blob/master/lagom165_where_processing_stops.png
The text was updated successfully, but these errors were encountered: