-
Notifications
You must be signed in to change notification settings - Fork 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
[JavaSpring] Wrong generation of @JacksonXmlElementWrapper annotation #9845
Comments
Same here - @JacksonXmlElementWrapper annotation is missing using maven code gen plugin version 3.0.14. Thanks! |
Same here - @JacksonXmlElementWrapper annotation is missing using maven code gen plugin version 3.0.19. |
Workaround: We created custom mustache templates in order to override this strange behavior. |
Hello, @thiko, can you provide in order to test your mustache template ? |
Is there any open PR for this. I have an updated version of pojo.moustache to fix this. |
@thiko @volvicoasis @MariaPushkin I have a PR for this now. Would you guys be able to help me push this to master? Would be nice if we could get this in place for folks in need (myself included :) ) |
Suggestions, and discussions are welcome. I am willing to run and post the patched generator against a swagger spec to verify the fix. I used our internal api spec that is probably not suitable for illustrating the intent of the code since that is quiet big in size. |
Description
I generated spring boot server stub for the swaggerfile below with using
<withXml>
config option. Swagger editor generates the following example of respone:and thats what I really want. But my stub return something like that:
Adding
@JacksonXmlElementWrapper(useWrapping = false)
onList<Segment> segments;
field in corresponding model helps to remove first<segments>
tag, but addingwrapped: false
to the swagger file change nothing (think because isXmlWrapped property checked only for true values - pojo.mustache.One other problem here is that codegen cant get xml name attribute for subobjects, definded separately. Thats why I have double
<segments><segments>
instead of<segments><segment>
. Adding xml property after $ref helps, but it is incorrect swagger, so I don`t whant to do that:It seems that problem also can be seen in pojo.mustache, because #items.xmlName search only inside items swagger-property and not in subobjects.
Swagger-codegen version
version 2.4.9
Swagger declaration file content or url
Command line used for generation
Steps to reproduce
The text was updated successfully, but these errors were encountered: