Closed kkrauth closed 8 years ago
Hi, we can't possibly support every configuration for a server that people want. So my suggestion is that you create your own templates to do what you want, since that's a supported way to use codegen.
@kkrauth
Have you tried the Jaxrs CxF generator?
You can experiment with this by going to http://editor.swagger.io/#/ , open the "Generate Server" menu, and click "Jaxrs CxF".
It only generates resource interfaces and POJO models. No pom.xml, etc.
@kkrauth
Here's how to play around with it from the command line:
mkdir /tmp/jaxrs-cxf;
cd /tmp/jaxrs-cxf;
mvn -q org.apache.maven.plugins:maven-dependency-plugin:2.8:get -DrepoUrl=https://oss.sonatype.org/content/repositories/snapshots -Dartifact=io.swagger:swagger-codegen-cli:2.1.6-SNAPSHOT -Ddest=swagger-codegen-cli.jar;
java -jar swagger-codegen-cli.jar generate -l jaxrs-cxf -i http://petstore.swagger.io/v2/swagger.json -o output;
Result of above:
output/
└── gen
└── java
└── io
└── swagger
├── api
│ ├── PetApi.java
│ ├── StoreApi.java
│ └── UserApi.java
└── model
├── ApiResponse.java
├── Category.java
├── Order.java
├── Pet.java
├── Tag.java
└── User.java
@who That looks perfect! Glad to see it's coming in the new version, I'll play around with it. Thanks.
@who maybe because i am using newer version, it is generated pom.xml and apiImpl LOL And some api description is not generated.
But it is good though, AS it is generating interface instead of class.
Generating an entire server (provider) project goes too far when lots of applications only require a list of JAX-RS interfaces and a model so that they can expose services according to a contract defined in the swagger file. There should be a server template that only generates interfaces and a model.