swagger-server
swagger-server copied to clipboard
swagger server doesn't take in account default value
trafficstars
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:

Shouldn't it return false instead?
Regards,
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.