swagger-api / swagger-api/swagger-codegen

Typescript client misses `body` argument in the POST/PUT/PATCH requests

Open
#9,037 1 comment 3 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 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

See https://editor.swagger.io/?url=https://raw.githubusercontent.com/frankgrupe/contactgroupapi/SWAGGERHUB/openapi.yaml.

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.