use of io.swagger.v3.oas.annotations.Parameter in project vertx-web by vert-x3.
the class OpenAPI3ValidationTest method testDefaultFloatQueryParameter.
@Test
public void testDefaultFloatQueryParameter() throws Exception {
Operation op = testSpec.getPaths().get("/queryTests/defaultFloat").getGet();
OpenAPI3RequestValidationHandler validationHandler = new OpenAPI3RequestValidationHandlerImpl(op, op.getParameters(), testSpec);
loadHandlers("/queryTests/defaultFloat", HttpMethod.GET, false, validationHandler, (routingContext) -> {
RequestParameters params = routingContext.get("parsedParameters");
RequestParameter requestParameter = params.queryParameter("parameter");
assertTrue(requestParameter.isFloat());
routingContext.response().setStatusMessage(requestParameter.toString()).end();
});
testRequest(HttpMethod.GET, "/queryTests/defaultFloat", 200, "1.0");
}
use of io.swagger.v3.oas.annotations.Parameter in project vertx-web by vert-x3.
the class OpenAPI3ValidationTest method testQueryParameterAnyOf.
@Test
public void testQueryParameterAnyOf() throws Exception {
Operation op = testSpec.getPaths().get("/queryTests/anyOfTest").getGet();
OpenAPI3RequestValidationHandler validationHandler = new OpenAPI3RequestValidationHandlerImpl(op, op.getParameters(), testSpec);
loadHandlers("/queryTests/anyOfTest", HttpMethod.GET, false, validationHandler, (routingContext) -> {
RequestParameters params = routingContext.get("parsedParameters");
routingContext.response().setStatusMessage(params.queryParameter("parameter").getBoolean().toString()).end();
});
testRequest(HttpMethod.GET, "/queryTests/anyOfTest?parameter=true", 200, "true");
}
use of io.swagger.v3.oas.annotations.Parameter in project vertx-web by vert-x3.
the class OpenAPI3ValidationTest method testDefaultDoubleQueryParameter.
@Test
public void testDefaultDoubleQueryParameter() throws Exception {
Operation op = testSpec.getPaths().get("/queryTests/defaultDouble").getGet();
OpenAPI3RequestValidationHandler validationHandler = new OpenAPI3RequestValidationHandlerImpl(op, op.getParameters(), testSpec);
loadHandlers("/queryTests/defaultDouble", HttpMethod.GET, false, validationHandler, (routingContext) -> {
RequestParameters params = routingContext.get("parsedParameters");
RequestParameter requestParameter = params.queryParameter("parameter");
assertTrue(requestParameter.isDouble());
routingContext.response().setStatusMessage(requestParameter.toString()).end();
});
testRequest(HttpMethod.GET, "/queryTests/defaultDouble", 200, "1.0");
}
use of io.swagger.v3.oas.annotations.Parameter in project vertx-web by vert-x3.
the class OpenAPI3ValidationTest method testDefaultIntQueryParameter.
@Test
public void testDefaultIntQueryParameter() throws Exception {
Operation op = testSpec.getPaths().get("/queryTests/defaultInt").getGet();
OpenAPI3RequestValidationHandler validationHandler = new OpenAPI3RequestValidationHandlerImpl(op, op.getParameters(), testSpec);
loadHandlers("/queryTests/defaultInt", HttpMethod.GET, false, validationHandler, (routingContext) -> {
RequestParameters params = routingContext.get("parsedParameters");
RequestParameter requestParameter = params.queryParameter("parameter");
assertTrue(requestParameter.isInteger());
routingContext.response().setStatusMessage(requestParameter.toString()).end();
});
testRequest(HttpMethod.GET, "/queryTests/defaultInt", 200, "1");
}
use of io.swagger.v3.oas.annotations.Parameter in project vertx-web by vert-x3.
the class OpenAPI3ValidationTest method testDefaultStringQueryParameter.
@Test
public void testDefaultStringQueryParameter() throws Exception {
Operation op = testSpec.getPaths().get("/queryTests/defaultString").getGet();
OpenAPI3RequestValidationHandler validationHandler = new OpenAPI3RequestValidationHandlerImpl(op, op.getParameters(), testSpec);
loadHandlers("/queryTests/defaultString", HttpMethod.GET, false, validationHandler, (routingContext) -> {
RequestParameters params = routingContext.get("parsedParameters");
routingContext.response().setStatusMessage(params.queryParameter("parameter").getString()).end();
});
testRequest(HttpMethod.GET, "/queryTests/defaultString", 200, "aString");
}
Aggregations