Swagger-codegen: [Angular][Typescript] Delete with body generates not properly working service

Created on 17 Apr 2019  路  3Comments  路  Source: swagger-api/swagger-codegen

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.

Most helpful comment

We are also seeing this with PUT and POST. The body param is left out, so the third param, the options object, becomes the body.

All 3 comments

We are also seeing this with PUT and POST. The body param is left out, so the third param, the options object, becomes the body.

Please add this important feature, i have the same issue in my API

I have the same issue

Was this page helpful?
0 / 5 - 0 ratings