swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
The groovy code generator imports the ArrayList class for array types in models, but does not
import it correctly.
Instead of generating import java.util.ArrayList (or for Groovy nothing at all), the generated code imports the ArrayList class from the models package.
Swagger-codegen version
The error happens for swagger-codegen version 2.2.3. For older versions I did not check.
Swagger declaration file content or url
Command line used for generation
I generate the code with the org.hidetake.swagger.generator gradle plugin:
With the provided gradle task, the ArrayList class is imported as import com.example.messaging.model.ArrayList and with the online generator it is imported as import io.swagger.model.ArrayList
The error seems to only occur for Groovy and not for Java.
Steps to reproduce
Generate the model with the previously posted yaml file for Groovy.
Description
The groovy code generator imports the
ArrayList
class for array types in models, but does not import it correctly.Instead of generating
import java.util.ArrayList
(or for Groovy nothing at all), the generated code imports theArrayList
class from the models package.Swagger-codegen version
The error happens for swagger-codegen version 2.2.3. For older versions I did not check.
Swagger declaration file content or url
Command line used for generation
I generate the code with the
org.hidetake.swagger.generator
gradle plugin:but the error is also reproducible when the code is generated on https://editor.swagger.io/.
With the provided gradle task, the
ArrayList
class is imported asimport com.example.messaging.model.ArrayList
and with the online generator it is imported asimport io.swagger.model.ArrayList
The error seems to only occur for Groovy and not for Java.
Steps to reproduce
Generate the model with the previously posted
yaml
file for Groovy.Related issues/PRs
This issue seems to be related to issue Gradle build error #5046.
Suggest a fix/enhancement
If primitive types were not imported at all for the groovy language, the error would be fixed as no explicit imports are needed for