swagger-api / swagger-api/swagger-codegen
[JavaSpring] Add throws Exception to the generated interface and implementation
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
It looks like the latest version no longer adds "throws Exception" to the generated interfaces and controllers. With Spring, this makes global exception handling easier and let's you canonicalize the API responses.
Swagger-codegen version
Latest from master. 4eabc50d24397e8d6f55cc9d66cba81f1694561b
Command line used for generation
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -Djava8=true -l spring -o /tmp/test/
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -Djava8=false -l spring -o /tmp/test/
Related issues/PRs
https://github.com/swagger-api/swagger-codegen/pull/5738
Suggest a fix/enhancement
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
Run the two provided swagger-codegen CLI commands with the Petstore specification and inspect the generated Spring interfaces and controllers for both java8 modes. Compare the output with related PR 5738 and suggested fix PR 8756; done means the generated interface and implementation include throws Exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100