Add missing import in swagger code gen java file

405 views
Skip to first unread message

Suman Dey

unread,
Jul 29, 2020, 1:28:19 AM7/29/20
to mustache.java
I have a yaml file for swagger and java code generated from the yaml through maven build.
Now there is issue with nested enum class, @JsonValue & @JsonCreator not imported correctly in the java file after code genration.

Here is my package-import.mustache

{{#imports}}
 import io.swagger.annotations.XXXX.*;
{{/imports}}


Maven build: pom.xml

<execution>
   
<id>etim-product-execution</id>
   
<goals>
       
<goal>generate</goal>
   
</goals>
   
<configuration>
       
<inputSpec>${project.basedir}/src/main/config/etim/Product-Data-v1.1-Specifications.yml</inputSpec>
       
<language>jaxrs-spec</language>
       
<templateDirectory>${project.basedir}/src/main/resources/custom-template</templateDirectory>
       
<configOptions>
           
<apiPackage>com.myapp.ssl.service.frontend.product.api</apiPackage>
           
<modelPackage>com.myapp.ssl.service.frontend.product.model</modelPackage>
           
<interfaceOnly>true</interfaceOnly>
           
<returnResponse>true</returnResponse>
           
<sourceFolder>java</sourceFolder>
           
<generatePom>false</generatePom>
           
<java8>true</java8>
       
</configOptions>
       
<configHelp></configHelp>
   
</configuration>
</execution>


I want to add the import line to all java classes which is under that package.

Thanks in advance for the help.

Reply all
Reply to author
Forward
0 new messages