-
-
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
declaringClass
of "enum-as-POJO" not removed for ObjectMapper
with a naming strategy
#2365
Comments
declaringClass
of "enum-as-POJO" not removed for ObjectMapper
with a naming strategy
Interesting. Thank you for reporting this (and apologies for slow follow-up) -- sounds like a bug indeed! I'll verify that suggested fix works: I suspect it should in some form: does for this property, but changing public method to change lookup might break other handling. But either addition of secondary lookup or (if need be) adding new method should work. |
Interestingly enough, I can reproduce this on 2.10 branch (including 2.10.2) but NOT on 2.11. |
Thanks |
Ok. At this point I think I will not try fixing it for 2.10.x partly since it is resolved for 2.11, and partly since I suspect there is non-trivial risk for regression for 2.10.x. And mostly I guess as I really hope to get 2.11.0 released relatively soon (early Feb 2019). |
OK, thanks , I'll try when it will release . |
Happens in 2.9.9.
When you change ObjectMapper to use a different naming strategy, i.e:
When serialising/using writeToString(Object value) for an object such as:
"declaring_class" will be added to the JSON payload.
Normally this is removed at:
com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java:1139
but because incom.fasterxml.jackson.databind.introspect.BasicBeanDescription#removeProperty
(It's only usage as far as I can see) we aren't using InternalName, declaringClass is not removed. Potential fix here is to change prop.getName() to prop.getInternalName(), a quick test of that seemed to work in my case.The text was updated successfully, but these errors were encountered: