Search in sources :

Example 1 with StyleEnum

use of io.swagger.v3.oas.models.headers.Header.StyleEnum in project swagger-parser by swagger-api.

the class OpenAPIDeserializerTest method testStyleInvalid.

@Test
public void testStyleInvalid() {
    String json = "{" + "    \"openapi\": \"3.0.0\"," + "    \"info\": {" + "        \"title\": \"realize\"," + "        \"version\": \"0.0.0\"" + "    }," + "    \"paths\": {" + "        \"/realize/{param}\": {" + "            \"post\": {" + "                \"parameters\": [" + "                    {" + "                        \"name\": \"param\"," + "                        \"in\": \"path\"," + "" + "                        \"style\": \"DERP\"," + "                        \"required\": true," + "" + "                        \"schema\": {" + "                            \"type\": \"string\"," + "                            \"nullable\": false," + "                            \"minLength\": 1" + "                        }" + "                    }" + "                ]," + "                \"responses\": {" + "                    \"200\": {" + "                        \"description\": \"Success\"," + "                        \"content\": {" + "                            \"application/json\": {" + "                                \"schema\": {" + "                                    \"type\": \"object\"" + "                                }" + "                            }" + "                        }" + "                    }" + "                }" + "            }" + "        }" + "    }" + "}";
    OpenAPIV3Parser parser = new OpenAPIV3Parser();
    SwaggerParseResult result = parser.readContents(json, null, null);
    assertTrue(result.getMessages().size() == 1);
    assertEquals(result.getMessages().get(0), "attribute paths.'/realize/{param}'(post).parameters.[param].style is not of type `StyleEnum`");
}
Also used : SwaggerParseResult(io.swagger.v3.parser.core.models.SwaggerParseResult) OpenAPIV3Parser(io.swagger.v3.parser.OpenAPIV3Parser) Test(org.testng.annotations.Test)

Aggregations

OpenAPIV3Parser (io.swagger.v3.parser.OpenAPIV3Parser)1 SwaggerParseResult (io.swagger.v3.parser.core.models.SwaggerParseResult)1 Test (org.testng.annotations.Test)1