Search in sources :

Example 1 with UserReq

use of com.bob.vertx.webapi.param.req.UserReq in project vertx-swagger by bobxwang.

the class UserVerticle method updateUserById.

@BBRouter(path = "/user/:id", httpMethod = HttpMethod.PUT)
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "用户标识", required = true, dataType = "integer", paramType = "path"), @ApiImplicitParam(name = "query", value = "用户体", dataType = "com.bob.vertx.webapi.param.req.UserReq", paramType = "body") })
@ApiOperation(value = "更新一个用户", response = UserRes.class)
@ApiResponses({ @ApiResponse(message = "response_annotation1", code = 200, response = UserRes.class) })
private void updateUserById(RoutingContext ctx) {
    UserReq userReq = Json.decodeValue(ctx.getBody(), UserReq.class);
    UserRes userRes = new UserRes();
    userRes.setId(Integer.valueOf(ctx.request().getParam("id")));
    userRes.setName(userReq.getName() + " updated");
    ctx.response().putHeader("content-type", "application/json;charset=UTF-8").end(Json.encodePrettily(userRes));
}
Also used : UserReq(com.bob.vertx.webapi.param.req.UserReq) UserRes(com.bob.vertx.webapi.param.res.UserRes) BBRouter(com.bob.vertx.swagger.BBRouter)

Aggregations

BBRouter (com.bob.vertx.swagger.BBRouter)1 UserReq (com.bob.vertx.webapi.param.req.UserReq)1 UserRes (com.bob.vertx.webapi.param.res.UserRes)1