The required fields for a response are ignored for a default response

Issue #212 new
Itanu created an issue

When we put default and non-default responses in a yaml file, the required field in the default response are ignored allowing false positives.
For example, let’s have:

responses:

200:

description: Success

default:

description: Error

content:

application/json:

schema:

type: object

properties:

message:

type: string

required:

- message

This cause problems because whatever is the response of the service, it always passes with any HTTP status code with no content at all.

Comments (1)

  1. Itanu reporter

    In the ResponseValidator class, line 118 we check if there is a common specific type, but if we send an empty response, with therefore no content body but only status code, the method exits and doesn’t continue with the validation. The check on the content body on line 130 is not executed at all if there is no content type.

  2. Log in to comment