Validation with assigned response fails for empty body

Issue #38 wontfix
Sören van Dongen created an issue

com.atlassian.oai.validator.restassured.SwaggerValidationFilter$SwaggerValidationException: Validation failed. [ERROR] GET on path '/customers/' defines a response schema but no response body found.

@ApiOperation(value = "Customers")
   @ApiResponses({
      @ApiResponse(code = 200, message = "getCustomer", response = Customer.class),
      @ApiResponse(code = 400, message = "Parsing error", response = ErrorResponse.class),
      @ApiResponse(code = 500, message = "Internal error", response = ErrorResponse.class)
   })
   public Response getCustomer(

I rechecked and empty response body is always allowed, why does the validation fail here?

Comments (3)

  1. Sven Döring

    An empty response body is allowed if and only if the schema for the response is not specified.

    As I'm seeing a response type in your @ApiResponse annotation the schema is specified, so the response body shall not be empty. At least it should contain an empty JSON: "{}"

  2. Log in to comment