swagger-api / swagger-api/swagger-codegen
[Jax-rs-resteasy-eap] Improvement, add an option to not generate the RestApplication class
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Hi,
I have to insert a rest server (generated by swagger, jax-rs-resteasy-eap configuration) in an environment where other jax-rs rests already exist, with a servlet mapping defined in a web.xml file. The RestApplication class (extends javax.ws.rs.core.Application), auto generated by swagger, creates malfunctions in that it doesn't allow the loading of all the RESTs not specified in that class.
Swagger-codegen version
we are using SwaggerHub with openApi 3.0.0 to design our RESTApi.
Suggest a fix/enhancement
To avoid always having to manually remove the RestApplication class, is it possible to insert in the code generator an option to exclude that class from the generated code?
To do this it would be enough to add a boolean that establishes whether the statement on line 102 of the class JavaResteasyEapServerCodegen.java (available at url: github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyEapServerCodegen.java)
is executed.
For example:
if(generateRestApplicationClass){
writeOptional(outputFolder, new SupportingFile("jboss-web.mustache", ("src/main/webapp/WEB-INF"), "jboss-web.xml"));
}
Thanks in advance, Alessandro
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyEapServerCodegen.java and inspect the generation around the referenced line 102. Check how supporting files are selected, then verify generated output with the option enabled and disabled; done means the RestApplication class is omitted when requested without affecting the default output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100