I'm using swagger 2.0 to define my API. I'm using enums as described in the docs here. I have the following endpoint in my swagger.yml file:
/my-endpoint:
x-swagger-router-controller: my-controller
get:
summary: my test endpoint
parameters:
- name: feeling
in: query
type: string
enum:
- happy
- sad
required: true
produces:
- application/json
responses:
200:
description: OK
I would expect a 400 bad request
to be returned to the client if the feeling
query parameter is not either happy
or sad
, but it accepts any string. Does swagger not validate that the parameter is in the enum?