swagger-api / swagger-api/swagger-codegen
[JAVA] jaxrs-spec: Remove throws Exception from generated interfaces
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Issue#6659 introduced a horrible design bug by declaring "throws Exception" in the generated api model for jaxrs-spec interfaces. For instance
String foo() throws Exception;
instead of just
String foo();
Forcing users of this api to always catch Exception or declare it, even though proper code never will throw an Exception. The "throws Exception" should never be there.
Swagger-codegen version
2.3.0, 2.3.1
Swagger declaration file content or url
The file involved is:
- JavaJaxRS/spec/apiInterface.mustache
Suggest a fix/enhancement
Remove "throws Exception"
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 with JavaJaxRS/spec/apiInterface.mustache, the file identified in the issue, and inspect how the generated interface method declaration includes the exception clause. Generate a jaxrs-spec interface using the affected Swagger Codegen version and verify that the resulting methods no longer declare throws Exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100