-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[BUG] using xml:wrapped:false does not generate the correct annotation #2417
Comments
Any news here? :-/ Thanks! |
Hey @thiko . No couldn't find a good workaround here. We were in the lucky spot that we could change the API to return wrapped lists,... but that was not a very satisfying solution and for sure not applicable if you don't own the API,.. even then it's not really a preferable solution. Cheers |
hi @tom-mayer, thanks for your response! |
Unfortunately, I am also facing the same issue with the Open API generator. Is there a planned fix for this? |
Same here, it seems that one of my deserialization does not work properly because of this bug. Looking forward to this fix also. A little googeling shows that swagger codegen has JacksonXmlElementWrapper annotation generation https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/JavaSpring/pojo.mustache#L50 Currently workaround for me was to override two mustache files JavaSpring/model.mustache and JavaSpring/pojo.mustache to add wrapper import and JacksonXmlElementWrapper annotation too these files respectively. |
If you're interested, I can provide a Pull Request that generates the wrapper annotations for the |
Hi, this topic is a bit old but i'm very interested |
I created PR #18392 containing my changes. It's still a draft, because I'd really like to have some tests for that. The branch in my fork is based on the v7.4.0 tag, but it should apply to Any feedback, improvements and additional contributions (tests?) are highly welcome! |
Hey,
in the documentation https://swagger.io/docs/specification/data-models/representing-xml/ here it says that you can represent unwrapped lists in xml with using the xml:wrapped:false in the openapi yaml. I am using the JavaSpring generator. The xml:atttribute:[true|false] and xml:name seem to work fine, generating the correct
@JacksonXmlProperty
values.However using xml:wrapped:false does not change the generated model. Jackson-Xml uses wrapping by default, so if this is set, a
@JacksonXmlElementWrapper(useWrapping = false)
should be rendered over the property to make xmls like that parsable.Looking at the pojo.mustache
@JacksonXmlElementWrapper
is also not in there. Should be around line 27.My question is, is this really a bug / not yet done or do I just miss something.
The text was updated successfully, but these errors were encountered: