swagger-api / swagger-api/swagger-codegen

update `typescript-fetch` for modern TS compat

Open
#10,314 0 comments 5 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

#6894 undid the inclusion of isomorphic-fetch and replaced it with portable-fetch (a fork of isomorphic-fetch, but without TypeScript types and with an incremental 3 line commit 3 years ago to support react native via fetch-npm-react-native.js.

Problem is, these declaration files simply don't work on modern typescript.

A better solution is to move to a maintained form of isomorphic-fetch which today is cross-fetch – which also (fortunately) includes types (and gets rid of the declaration file).

Swagger-codegen version

3.0.20

Command line used for generation

java -jar swagger-codegen-cli generate -l typescript-fetch -i foo.json

Related issues/PRs

https://github.com/swagger-api/swagger-codegen/pull/6894

Suggest a fix/enhancement
  1. replace with cross-fetch
  2. remove declaration file

also ought to mention the last person who changed this... @jeff-99

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 with the typescript-fetch generator entry point and the declaration file used by generated clients, then run the documented Java command with a sample OpenAPI input to reproduce the modern TypeScript compatibility problem. Done means generated clients use cross-fetch instead of portable-fetch and no longer include the incompatible declaration file.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.