OpenAPITools / OpenAPITools/openapi-generator
[REQ] [typescript-fetch] option to not throw ResponseError
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
It would be great to have a boolean doNotThrowOnNon2xx option, since non-2xx responses are often part of normal control flow and may contain useful response bodies, avoiding the need for try/catch everywhere. Additionally, the native fetch API (e.g. in browsers or with undici in Node) does not throw on non-2xx responses, so this behaviour is unexpected and inconsistent with the underlying transport.
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 modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache at lines 126-129 and trace how non-2xx responses become ResponseError instances. Add the boolean option so callers can receive non-2xx responses without an exception, while preserving useful response bodies; verify the generated typescript-fetch client behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100