-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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] Missing import statement in ApiClient.java for JsonNullableModule when using generator 'java' and library 'resttemplate' with option 'withXml' enabled #7209
Comments
Can you please try the latest master instead to see if it's still an issue? |
@wing328 I tried with 5.0.0-SNAPSHOT (modified 14 Aug 2020), the |
Thanks for the confirmation. May I know if you've time to contribute a fix? I can show you some good starting points. |
I'm experiencing the same issue also with 5.1.1 plugin version...can you please provide a fix? |
I investigated further, bug is in Apiclient.mustache template, JsonNullableModule import is driven by threetenbp... so, if you are using (as I do) a different dateLibrary implementation import statement will be skipped... |
the import statement is generated for me (import org.openapitools.jackson.nullable.JsonNullableModule) but the cinmpiler does not recognise openapitools.. |
Bug Report Checklist
Description
When adding the
withXml : "true"
option in order for thejava
generator (with the 'resttemplate' library) to include@XmlRootElement
,@JacksonXmlRootElement
annotations necessary to name the root element in the XML request body, the generatedApiClient.java
class fails to compile giving the following error.ApiClient.java:648: error: cannot find symbol xmlMapper.registerModule(new JsonNullableModule()); ^ symbol: class JsonNullableModule location: class ApiClient
Looking at the imported classes in
ApiClient.java
, there is no import statement for that class, and it has to be added manually whenever the client code is regenerated.Without
withXml : "true"
the generated source does compile but the class name is used for root elements instead of the declaredname
in the spec.Using the Gradle plugin with the following config:
openapi-generator version
Tested with 4.3.0, 4.3.1, and 5.0.0-beta
OpenAPI declaration file content or url
I cannot share the spec file since it is confidential, the file passes validation, and is fairly standard.
The file contains type declarations, with an
xml
name
property.Generation Details
Using Gradle with
org.openapitools:openapi-generator-gradle-plugin:4.3.1
(or any of the versions mentioned above)gradle myGenerateTask
Then compile the generated sources.
Steps to reproduce
configOption
withXml
enabled.ApiClient.java
and search forJsonNullableModule
, you'll notice that it is used without animport
statement.Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered: