Skip to content

The files and directory structures output into generated-sources by swagger-codegen-maven-plugin are unusable #1737

Description

@rdelaplante

Similar code generator plugins for SOAP, Thrift, WADL, etc. output the sources directly into /target/generated-sources/wsimport/. The contents of this directory is source code and package directories only; nothing else.

When swagger-codegen-maven-plugin is executed, it outputs a complete Maven project directory structure and build files into /target/generated-sources/swagger/. When Maven gets to the compile phase, the source files are not found and the build fails.

What gets generated by swagger-codegen-maven-plugin:

\---target
    +---generated-sources
    |   \---swagger
    |       |   build.gradle
    |       |   gradle.properties
    |       |   pom.xml
    |       |   README.md
    |       |   settings.gradle
    |       |
    |       \---src
    |           \---main
    |               |   AndroidManifest.xml
    |               |
    |               \---java
    |                   \---io
    |                       \---swagger
    |                           \---client
    |                               |   ApiClient.java
    |                               |   ApiException.java
    |                               |   Configuration.java
    |                               |   JSON.java
    |                               |   Pair.java
    |                               |   StringUtil.java
    |                               |
    |                               +---api
    |                               |       PetApi.java
    |                               |       StoreApi.java
    |                               |       UserApi.java
    |                               |
    |                               +---auth
    |                               |       ApiKeyAuth.java
    |                               |       Authentication.java
    |                               |       HttpBasicAuth.java
    |                               |       OAuth.java
    |                               |       OAuthFlow.java
    |                               |
    |                               \---model
    |                                       ApiResponse.java
    |                                       Category.java
    |                                       Order.java
    |                                       Pet.java
    |                                       Tag.java
    |                                       User.java

What it should be generating to be usable:

\---target
    +---generated-sources
    |   \---swagger
    |       \---io
    |           \---swagger
    |               \---client
    |                   |   ApiClient.java
    |                   |   ApiException.java
    |                   |   Configuration.java
    |                   |   JSON.java
    |                   |   Pair.java
    |                   |   StringUtil.java
    |                   |
    |                   +---api
    |                   |       PetApi.java
    |                   |       StoreApi.java
    |                   |       UserApi.java
    |                   |
    |                   +---auth
    |                   |       ApiKeyAuth.java
    |                   |       Authentication.java
    |                   |       HttpBasicAuth.java
    |                   |       OAuth.java
    |                   |       OAuthFlow.java
    |                   |
    |                   \---model
    |                           ApiResponse.java
    |                           Category.java
    |                           Order.java
    |                           Pet.java
    |                           Tag.java
    |                           User.java

When I move and delete files by hand I can get it to compile, package and run successfully.

IMO the swagger-codegen-maven-plugin is unusable in its current form.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions