OpenAPITools / OpenAPITools/openapi-generator

Generate typescript-fetch code without portable-fetch

Open
#1,368 6 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

Does typescript-fetch support generating code without dependent libraries such as portable-fetch?

BaseAPI supports injecting fetch at runtime.
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/typescript-fetch/api.mustache#L49

However, as default, portable-fetch is used and import statement is exist. Therefore, regardless of whether portable-fetch is actually used or not at runtime, we have to install and load it.

Suggest a fix/enhancement

I think it's better to use native fetch as deafult, and if developer wants using polyfill, inject it via APIFactory at runtime.

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 modules/openapi-generator/src/main/resources/typescript-fetch/api.mustache, especially the BaseAPI fetch injection path and its portable-fetch import. Compare the generated typescript-fetch output with the requested native-fetch default and runtime polyfill injection. Done means the generated client no longer requires portable-fetch by default while preserving runtime fetch injection.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, tooling
Issue type
Feature
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.