How to specify alternative response formats with swagger/OpenAPI?
问题 I have a swagger.yaml something like this: swagger: "2.0" paths: /something: get: parameters: - name: format in: query type: string pattern: '^(csv|json|xml)$' responses: 200: schema: type: ? And I want to return different formats (csv, json, xml) depending on the value of the format query parameter (eg. localhost/api/something?format=csv). How can I specify the different response formats in the spec? 回答1: I found a workaround, by providing different endpoints: swagger: "2.0" paths: