I have a path /a/b/c and the POST method supports several different mime types.
How do I encode this in Swagger 2.0? If I use just one path/operation,
I can list multiple mime-types under the consumes: block, but
I can only specify one parameter with in: body and corresponding schema
/a/b/c:
post:
consumes:
- mime-type-1
- mime-type-2
parameters:
- name: body
in: body
required: true
schema:
$ref: ICanNameOneTypeHere
If I list the post method twice, each with the mime-type and corresponding
in: body parameter and schema, the swagger-ui only shows
the first of the two methods. I suppose this is because
the JSON path object for /a/b/c cannot have two different objects named "post".
How can I achieve what I want? Do I need to use a disciminator ?
Are there any examples of that? Note that these are discrete types,
not different subtypes of a common base type. The API uses the
Content-Type header to handle these two different POST requests.
Can I define a schema that is really defined as one of several?
schema-1 | schema-2 | schema-3
if so, how do I associate the different schemas with their
corresponding mime-types?
This same question applies to supporting XML and JSON
request bodies to the same path/method.