swagger-api / swagger-api/swagger-codegen

[Typescript-node] should support more custom request options

Open
#9,242 1 comment 2 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

The generated client for typescript-node uses request. Each api method has an optional options param for custom request options, but it's only used for customizing request headers. There are a lot other request options that are useful, in my case timeout. We should use more than just the headers passed in to make the request.

Swagger-codegen version

2.4.2

Suggest a fix/enhancement

This is where the request options are set:
https://github.com/swagger-api/swagger-codegen/blob/master/samples/client/petstore/typescript-node/npm/api.ts#L593

The passed in options is only used for custom headers:
https://github.com/swagger-api/swagger-codegen/blob/master/samples/client/petstore/typescript-node/npm/api.ts#L589

It should be able to pass in other request options.

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 in samples/client/petstore/typescript-node/npm/api.ts around lines 589-593, where the optional options parameter is reduced to custom headers before the request is made. Read the linked request options documentation and trace the generated API method. Done means options such as timeout, not only headers, can reach the request call; add or run the relevant client checks if available.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.