[BUG] When trying to generate a kotlin server stub, the imports are not correctly generated
Created by: KasperJanssens
When using the 4.0.0 version of the maven plugin to generate kotlin server code like this :
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.0.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>api/api.yaml</inputSpec>
<generatorName>kotlin-server</generatorName>
<configOptions>
<sourceFolder>src/gen/kotlin/main</sourceFolder>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
The code being generated seems not to compile. The error seems to be Unresolved reference: KtorExperimentalAPI. I can open the generated code and explicitly add the import for this annotation, but because it's generated code that is of course not a good solution. The api.yaml is directly taken from the openapi specs : https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/api-with-examples.yaml.
The generation of the code happens through mvn clean install. I added these dependencies to the pom :
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-gson</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-locations</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-client-apache</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-metrics</artifactId>
<version>1.2.0</version>
</dependency>
I target kotlin version 1.3.31 using the openjdk 11.0.3 on ubuntu linux.