-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Optional.empty()
not excluded if property declared with type Object
#1256
Comments
Please use mailing list for usage question; issue tracker is for reporting bugs. |
As to the question however: perhaps this is a bug; I can't say for sure without having a closer look. Reopening assuming there is something to fix here. Thank you for the report! |
Ok, this is working as designed: declared type MUST give indication that the value would be reference type (like In future we hope to support custom inclusion criteria which would allow construction of more advanced inclusion filters: for now, declared type has to be such that it allows determination of concept of absent. I will keep this issue open, however, to think whether there is a possibility that this could be improved upon in future. Also: I noticed that use of |
Optional.empty()
not excluded if property declared with type Object
Ok: so, fix here is two-fold. First, declared type MUST indicate it's a reference type (
The other part of the fix is to make sure Jackson actually uses type modified by annotation; this was not done but fix will be in 2.8.1. This combination will make tests pass. One thing I do not understand, however, is why |
Jackson version is 2.6.6
Here is the code:
Then I got the output: {"a":null}
The real value of both is the same, why the results are different?
How can I avoid null in such case?
By the way, I tried 'NON_EMPTY'. It can work, but it also ignores zero and empty array. I want to keep them.
The text was updated successfully, but these errors were encountered: