swagger-api / swagger-api/swagger-codegen

[Angular][Typescript] Delete with body generates not properly working service

Open
#9,381 3 comments 4 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

I'm trying to generate an typescript/angular service with a delete method which has a body param, but the generated services does not use the body param. You can find the generated service's code here and you can see that the body param is not used anywhere.

Swagger-codegen version

2.4.4

Swagger declaration file content or url

If you post the code inline, please wrap it with

swagger: '2.0'
info:
  description: "DeleteBody"
  version: v0.0.1
  title: Multi Delete API
basePath: /
tags:
  - name: 'multi'
schemes:
  - http
paths:
  '/multi/delete':
    delete:
      summary: delete multiple
      description: >-
        Multi delete
      operationId: multiDelete
      schemes:
        - http
      consumes:
        - application/json
      parameters:
        - name: body
          in: body
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: successful operation
Command line used for generation

Generated on https://editor.swagger.io/ with Generate Client -> typescript-angular

My suggestion would be that to use httpClient.request({method}) instead of httpClient.{method} with this solutiondelete accepts a body param.

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 inline Swagger 2.0 declaration and the generated TypeScript/Angular service linked in the issue, focusing on how the DELETE operation handles its body parameter. Compare this with the proposed HttpClient request approach; done means the generated service passes the body for DELETE requests.

Written by the indexing model from the issue text.

Assessment

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