diff --git a/src/main/java/io/swagger/oas/inflector/controllers/OpenAPIOperationController.java b/src/main/java/io/swagger/oas/inflector/controllers/OpenAPIOperationController.java index 46f5348a..097aa8b0 100644 --- a/src/main/java/io/swagger/oas/inflector/controllers/OpenAPIOperationController.java +++ b/src/main/java/io/swagger/oas/inflector/controllers/OpenAPIOperationController.java @@ -379,7 +379,7 @@ public Response apply(ContainerRequestContext ctx) { missingParams.add(e.getError()); } - } else if (operation.getRequestBody().getRequired()) { + } else if (Boolean.TRUE.equals(operation.getRequestBody().getRequired())) { ValidationException e = new ValidationException(); e.message(new ValidationMessage() .message("The input body `" + operation.getRequestBody() + "` is required")); diff --git a/src/test/java/io/swagger/oas/test/integration/RequestTestIT.java b/src/test/java/io/swagger/oas/test/integration/RequestTestIT.java index e2c0b0ae..bc12060e 100644 --- a/src/test/java/io/swagger/oas/test/integration/RequestTestIT.java +++ b/src/test/java/io/swagger/oas/test/integration/RequestTestIT.java @@ -47,6 +47,13 @@ public class RequestTestIT { ApiClient client = new ApiClient(); + @Test + public void verifyUpdatePet() throws Exception { + String path = "/pets"; + String str = client.invokeAPI(path, "POST", new HashMap(), null, new HashMap(), null, "application/json", null, new String[0]); + assertEquals(str, "OK!"); + } + @Test public void verifyValidDateTimeInput() throws Exception { String path = "/withDate/" + new DateTime().toString();