use of io.swagger.v3.oas.annotations.Operation in project vertx-web by vert-x3.
the class OpenAPI3ValidationTest method testAllOfQueryParamWithDefault.
@Test
public void testAllOfQueryParamWithDefault() throws Exception {
Operation op = testSpec.getPaths().get("/queryTests/allOfTest").getGet();
OpenAPI3RequestValidationHandler validationHandler = new OpenAPI3RequestValidationHandlerImpl(op, op.getParameters(), testSpec);
loadHandlers("/queryTests/allOfTest", HttpMethod.GET, false, validationHandler, (routingContext) -> {
RequestParameters params = routingContext.get("parsedParameters");
routingContext.response().setStatusMessage(params.queryParameter("parameter").getObjectValue("a").getInteger().toString() + params.queryParameter("parameter").getObjectValue("b").getBoolean().toString()).end();
});
String a = "5";
String b = "";
String parameter = "parameter=a," + a + ",b," + b;
testRequest(HttpMethod.GET, "/queryTests/allOfTest?" + parameter, 200, a + "false");
}
use of io.swagger.v3.oas.annotations.Operation in project vertx-web by vert-x3.
the class OpenAPI3ValidationTest method testQueryParameterByteFormat.
@Test
public void testQueryParameterByteFormat() throws Exception {
Operation op = testSpec.getPaths().get("/queryTests/byteFormat").getGet();
OpenAPI3RequestValidationHandler validationHandler = new OpenAPI3RequestValidationHandlerImpl(op, op.getParameters(), testSpec);
loadHandlers("/queryTests/byteFormat", HttpMethod.GET, false, validationHandler, (routingContext) -> {
RequestParameters params = routingContext.get("parsedParameters");
routingContext.response().setStatusMessage(params.queryParameter("parameter").getString()).end();
});
testRequest(HttpMethod.GET, "/queryTests/byteFormat?parameter=Zm9vYmFyCg==", 200, "Zm9vYmFyCg==");
}
use of io.swagger.v3.oas.annotations.Operation in project activityinfo by bedatadriven.
the class FormResource method getRecord.
@GET
@NoCache
@Path("record/{recordId}")
@Produces(JSON_CONTENT_TYPE)
@Operation(summary = "Get a single record")
public FormRecord getRecord(@PathParam("recordId") String recordId) {
FormStorage form = assertVisible(formId);
Optional<FormRecord> record = form.get(ResourceId.valueOf(recordId));
if (!record.isPresent()) {
throw new NotFoundException("Record " + recordId + " does not exist.");
}
PermissionsEnforcer enforcer = backend.newPermissionsEnforcer();
if (!enforcer.canView(record.get())) {
throw new NotAuthorizedException();
}
return record.get();
}
Aggregations