Extend Request.Method with missed values

Issue #42 resolved
skif07 NA created an issue

We're using swagger-request-validator with rest-assured and facing issues when trying to validate OPTIONS request:

// Rest-assured request 
given().spec(reqSpec)  
// RequestSpecification is used to set base path, headers and swagger filter
                .when().options("/endpoint")
                .then().statusCode(200);

Actually we get

java.lang.IllegalArgumentException: No enum constant com.atlassian.oai.validator.model.Request.Method.OPTIONS
    at java.lang.Enum.valueOf(Enum.java:238)
    at com.atlassian.oai.validator.model.Request$Method.valueOf(Request.java:16)
    at com.atlassian.oai.validator.restassured.RestAssuredRequest.getMethod(RestAssuredRequest.java:40)
    at com.atlassian.oai.validator.SwaggerRequestResponseValidator.validate(SwaggerRequestResponseValidator.java:113)
    at com.atlassian.oai.validator.restassured.SwaggerValidationFilter.filter(SwaggerValidationFilter.java:49)

Would be great to be able to validate request types like OPTIONS and HEAD when they are described in swagger file.

Comments (5)

  1. Sven Döring

    I stumbled upon that, too.

    There is a certain problem validating OPTIONS because the CORS preflight is an OPTIONS request, too.

    Just wanted to mention it.

  2. James Navin

    Yep - good one. I'll try to get time this week to address it.

    Depending on how complex it is I may split out the CORS support to a separate ticket - thanks for highlighting that @sdoeringNew .

  3. Log in to comment