swagger-api / swagger-api/swagger-codegen

typescript-fetch add factory for exceptions

Open
#8,241 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Similar to the issue https://github.com/swagger-api/swagger-codegen/issues/2724

Support for throwing well typed errors from the typescript-fetch output would make working with api's that return json bodies for exception details easier and cleaner to work with.

Swagger-codegen version

2.3.1

Swagger declaration file content or url

N/A

Command line used for generation

N/A

Steps to reproduce

N/A

Related issues/PRs

https://github.com/swagger-api/swagger-codegen/issues/2724

Suggest a fix/enhancement

The ability to hook in to the error generation perhaps via the Configuration object would be a great help. Default behaviour could stay as implemented but allowing the developer to override and return custom typed exceptions using the response from an api.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the typescript-fetch output and its Configuration object to understand how errors are currently generated. Review the related issue swagger-api/swagger-codegen#2724 for prior context. Done should include an optional hook that can use an API response to return well-typed custom exceptions while preserving the default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.