swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

Body parameter not included in request if value is 0

Open slepasteur opened this issue 11 years ago • 2 comments

I defined a request taking a json object as parameter in the body. The json object contains a number value. If this value is 0, the corresponding json is not included in the request.

The following definition:

swagger: "2.0"
info:
  title: title
  version: 1.0.0
host: "localhost:8080"
schemes:
  - http
produces:
  - application/json
paths:
  /test:
    put:
        parameters:
          - name: test
            in: body
            schema:
              $ref: "#/definitions/test"
        responses:
          "200":
            description: Success

definitions:
  test:
    properties:
      value:
        type: number

Generates the body:

{
  "value": 1
}

if value is 1 and

{}

instead of

{
  "value": 0
}

if value is 0.

slepasteur avatar Jun 05 '15 09:06 slepasteur

Any update on this?

dan-kez avatar Sep 07 '16 22:09 dan-kez

Should be fixed in 3.X.

webron avatar Jun 08 '17 23:06 webron