swagger-api / swagger-api/swagger-codegen
Typescript client misses `body` argument in the POST/PUT/PATCH requests
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 typescript client does not use the body argument when calling http PUT, POST or PATCH.
return this.httpClient.put(
`${this.basePath}/contacts/${encodeURIComponent(String(contactId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
Swagger-codegen version
3.0.4-SNAPSHOT
Swagger declaration file content or url
Command line used for generation
I've used the generate client feature of swagger.io.
Steps to reproduce
Open the generated client, and look in contacts.services.ts
Related issues/PRs
#6649 seems to address this issue, but the PR has been merged a long time ago.
Suggest a fix/enhancement
The client should use the body argument when calling http PUT, POST or PATCH.
return this.httpClient.put(
`${this.basePath}/contacts/${encodeURIComponent(String(contactId))}`,
body,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
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 the generated contacts.services.ts file and the supplied OpenAPI declaration, then trace the TypeScript client generation entry point and its templates. Regenerate the client and verify that POST, PUT, and PATCH calls pass the body argument before the request options, using the shown output as the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100