-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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]Openapi generator does not generate @XmlAttribute/@XmlElement annotations #5764
Comments
Also just bumped into this. Tried different generators (spring, java-native) to consume an XML-only API, but the generated models are lacking any Without them the generated models are useless for deserialization – of course i can manually fix the missing annotation (which i tested fixes deserialization), but that negates the whole point of automatic model generation for constantly evolving open api's. @bbdouglas & @diyfr can you confirm that this has not been implemented and maybe suggest what would need to be done to enable generation of these properties? |
Turns out: @vmisra2018 – change your pom.xml accordingly: <!-- pass any necessary config options -->
<configOptions>
<dateLibrary>joda</dateLibrary>
<withXml>true</withXml>
</configOptions>
<!-- override the default library to jersey2 -->
<library>resttemplate</library> and Jaxb and JacksonXml annotations will be generated. With the one exception of |
BTW, i believe this may be a duplicate of #3839 |
…cs, maven & gradle plugin (#18568) * Mention that Golang generator also supports XML annotations Looking at src/main/resources/go/model_simple.mustache and src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java the GoLang seems to cater for withXml=true * Fix maven plugin config description for `withXml` * Add basic test for global withXml setting * Use global withXml setting if not configured in ConfigOptions Resolves #3839 and #5764 * Don't generate metadata or other files when only Models are tested * Reformat table for readability * Remove global property `withXml` from generator and docs * Move WITH_XML constant out of system constants block Currently there is only a single reference to this value in the whole codebase (GoClientOptionsProvider). Maybe we should re-think how this file is organised (i.e. provide a clearer split / mapping / understanding what are system properties vs. global properties vs. configOptions and where to put them). * Remove global option `withXml` from Maven plugin (Breaking change) This is a "soft" breaking change: Plugin will no longer execute if user have this option – which is good, b/c it never worked as expected. We may want to hint this in the 8.0 release notes. * Remove global property `withXml` from Gradle plugin (Breaking change) This is a "soft" breaking change: Plugin will no longer execute if user have this option – which is good, b/c it never worked as expected. We may want to hint this in the 8.0 release notes, so they can add it to the `configOptions` map if required, or simply delete it * Update samples to reflect removed `withXml` property * Move `withXml` option into ConfigOptions for Java Microprofile sample * Remove unused local vars and parameters * Avoid repetition using fluent assertions * Remove extraneous debug output
Description
Trying to generate spring resttemplate client which comsumes applicaiton/xml but outputs json. I am expecting models to have @XmlAttribute/@xmlelement annotations but all it genrates is json. I have withXML as true in config of plugin.
openapi-generator version
4.3.1-SNAPSHOT
YAML
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-maven-plugin/examples/swagger.yaml
POM
Steps to reproduce
mvn clean install
The text was updated successfully, but these errors were encountered: