Responses object must contain at least one HTTP response code or a default response

Issue ID: validation-response-empty

Description

One or more responses objects in your API are empty. The responses objects must contain at least one HTTP response code key, preferably for a successful operation. Alternatively, you can set the responses object to use the default response you have defined.

For more details, see the OpenAPI Specification.

Example

The following is an example of how this issue could look in your API definition:

{
    "post": {
        "description": "Creates a new pet in the store",
        "operationId": "addPet",
        // ...
        "responses": {
        }
    }
}

Remediation

Make sure that all responses objects have a HTTP response code key defined or the value default.

{
    "post": {
        "description": "Creates a new pet in the store",
        "operationId": "addPet",
        // ...
        "responses": {
            "200": {
                "description": "Expected response to a valid request",
                "schema": {
                    "$ref": "#/definitions/Pets"
                }
            }
            // ...
        }
    }
}