-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
Fields defined in scala object and trait are not serialized #495
Comments
I added a test case to 2.11 branch and it passes but it does fail in 2.12. I have marked it as ignored in 2.12 branch while it is investigated. |
One workaround is to make the object a 'case object' - that seems to work. Some changes were made in v2.12.0 to try to avoid having jackson-module-scala affect non-Scala classes. It looks like Scala objects that are not case objects are not recognised as being Scala classes. |
Thanks for the quick response @pjfanning. Another note is we noticed ScalaObjectMapper is deprecated without replacement in 2.12.X, what's the future plan for it? |
No plans for ScalaObjectMapper - it will not work in Scala 3. There may eventually be a replacement that uses Scala 3 friendly TypeTags or something similar. |
will be released in v2.12.2 |
@yufangong the test case I added in jackson v2.11 branch works with Scala 2.10, 2.11 and 2.12 but fails with Scala 2.13. With this jackson v2.12, the test case passes with all supported Scala versions (Scala 2.10 support has been dropped) |
In the process of bumping Jackson version from 2.11.2 to 2.12.0, we have noticed this behavior change:
This
ObjectWithoutJsonProperty
on 2.11.2 will be serialized with fields value, but not on 2.12.0.2.11.2 output: {"value":"value1","name":"name1"}
2.12.0 output: {}
We also find out that adding @JsonProperty annotation can write the fields, however, it can be hard for us to detect our customer's usage.
The full reproduce example is located here.
Thank you!
The text was updated successfully, but these errors were encountered: