Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

swagger server doesn't take in account default value #17

Open
PavelPolyakov opened this issue Jan 14, 2016 · 1 comment
Open

swagger server doesn't take in account default value #17

PavelPolyakov opened this issue Jan 14, 2016 · 1 comment

Comments

@PavelPolyakov
Copy link

Hi,

Here is my swagger yaml:

swagger: "2.0"
info:
  title: Customers API
  description: Customers API
  version: "1.0.0"
host: localhost:3000
schemes:
  - http
  - https
basePath: /v1
produces:
  - application/json
paths:
  /customers:
    post:
      description: Creates new customer
      operationId: newCustomer
      parameters:
        - name: request
          in: body
          description: customer
          required: true
          schema:
            $ref: ./data-structures/NewCustomer.yaml
      responses:
        200:
          description: boolean
          schema:
            type: boolean
            default: false
definitions:
  Error:
    properties:
      code:
        type: integer
        format: int32
      message:
        type: string
      fields:
        type: string

Which results to this response:
image

Shouldn't it return false instead?

Regards,

@fmr
Copy link

fmr commented Mar 30, 2016

I came across this issue while looking for a solution - I'm experiencing the same thing. I have used both default and example keys, but it still responds with whatever is in the body of the POST request.

Adding a default or example response for GET requests seem to work.
PUT and POST seems to just echo back what you send to it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants