-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Problem with polymorphic serialization, inclusion type of As.WRAPPER_OBJECT
, extra tag
#178
Comments
Additional note: suppression of |
Ok, yes, I can reproduce that. It is the currently intended behavior and does actually reflect same structure as JSON one; but due to discrepancy between structures (Object in JSON are not indicated by name, since there are no elements/tags) they are expressed as what is not optimal for XML. I agree in that it would be nice to have more compact representation, similar to JAXB, where property name element would be replaced by type id, instead of both being present. But there are 2 main challenges: 1.Databind is format-agnostic (that is, can not have explicit handling for different formats), so there needs to be something in xml format module to translate the output appropriately So, first things first: if change may be done (problem (1)), we could introduce a configuration setting to allow choosing behavior. As to how to implement this, XML format could indicate it has "native" type ids, and if so, would get different call sequence that it could translate appropriately. This is needed to have contextual knowledge of what is type id; otherwise calls are justs "write START_OBJECT" and "write FIELD_NAME", without indication for semantic type of token. With native type ids, there are distinct calls. Due to complexity of the approach, this will not be implemented for 2.7, but if there is time could perhaps worked on for 2.8. |
Looks like we got a "collateral fix" here; will be fixed for 2.7.4. |
Update corrects jacksons JXAB xml compatibility. See FasterXML/jackson-dataformat-xml#178 for details. refs #11207
(note: moved from FasterXML/jackson-module-jaxb-annotations#51 -- see that one for more context)
It looks like serialization includes an additional XML element level which should not be there.
As per original issue, for class like:
produces XML output like
instead of more optimal way that JAXB serialization works:
The text was updated successfully, but these errors were encountered: