Swagger-editor: Body parameter not included in request if value is 0

Created on 5 Jun 2015  路  2Comments  路  Source: swagger-api/swagger-editor

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.

dependencies bug

Most helpful comment

Any update on this?

All 2 comments

Any update on this?

Should be fixed in 3.X.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ljerka picture ljerka  路  5Comments

jemerald picture jemerald  路  4Comments

fchebbo picture fchebbo  路  5Comments

variable picture variable  路  4Comments

SteveNewhouse picture SteveNewhouse  路  5Comments