swagger-api / swagger-api/swagger-codegen
[Go] Generated client code doesn't return specified error objects for non-2xx response codes
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Currently the generated code (DefaultApi) does return an error code if a non-2xx HTTP condition occurs (ie an error), but it ignores what the swagger says it should produce. E.g. if the swagger states that a 404 returns a petNotFoundError object, currently the Go code generator ignores this fact.
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 by examining the generated Go client’s DefaultApi handling of non-2xx responses and how the Go code generator uses the Swagger response definitions. Reproduce the 404 case with a petNotFoundError response; done means the generated client returns the error object specified by the Swagger definition instead of only a generic error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100