swagger-api/swagger-codegen

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

Open

#1.737 aberto em 17 de dez. de 2015

Ver no GitHub
 (17 comments) (14 reactions) (0 assignees)HTML (5.474 forks)batch import
General: SuggestionSwagger Codegen Maven Pluginhelp wanted

Métricas do repositório

Stars
 (12.701 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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.

Guia do colaborador