swagger-api / swagger-api/swagger-codegen
Change superagent for the fetch api?
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Reason for switching
- superagent use xhr instead of fetch and therefor don't work in service worker
- fetch also has streaming support (unlike xhr)
- Deno and Browser have fetch built in so no extra dependency, for node you could import eg node-fetch
- there is a hot topic in bringing in the fetch api or similar functionality into node
- fewer dependencies -> more lightweight
- querystring is legacy
- The URLsearchParam uses a more selective and fine grained approach to selecting encoded characters than that used by the Legacy API.
- querystring.parse is depricated since v11
- URLSearchParams is available in more environments without the need of any dependencies
- querystring will mix the value between string and arrays giving you an inconsistent api
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/swagger-codegen/src/main/resources/Javascript/es6/ApiClient.mustache at lines 2-3 and inspect how the generated client uses superagent and querystring. Compare the required browser, service-worker, Deno, and Node environments with the proposed Fetch and URLSearchParams APIs. Done means the generated JavaScript client no longer depends on the named legacy components while retaining its existing request behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, web-dev
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100