Description
In OpenAPI 2.0, produces tells clients which body formats an operation can return.
Potential impact
Without a declared format, a client may choose the wrong parser for the response.
Remediation
List supported response formats in the root produces. Override the list on operations that return different formats. Check that each response body matches its Content-Type header.
Examples
The example declares JSON for GET /users.
Before
yaml
swagger: "2.0"
paths:
/users:
get:
responses:
"200":
description: ok
After
yaml
swagger: "2.0"
paths:
/users:
get:
produces:
- application/json
responses:
"200":
description: ok