小编Özk*_*Can的帖子

如何在@Asynchronous jax-rs bean方法中设置Swagger忽略@Suspended AsyncResponse?

Swagger-Core似乎将@Suspended最终的AsyncResponse asyncResponse成员解释为请求主体参数.这显然不是预期的,也不是这种情况.

我想告诉swagger-core忽略这个参数并将其从api-docs中排除.有任何想法吗?

这就是我的代码:

@Stateless
@Path("/coffee")
@Api(value = "/coffee", description = "The coffee service.")
public class CoffeeService
{
    @Inject
    Event<CoffeeRequest> coffeeRequestListeners;

    @GET
    @ApiOperation(value = "Get Coffee.", notes = "Get tasty coffee.")
    @ApiResponses({
            @ApiResponse(code = 200, message = "OK"),
            @ApiResponse(code = 404, message = "Beans not found."),
            @ApiResponse(code = 500, message = "Something exceptional happend.")})
    @Produces("application/json")
    @Asynchronous
    public void makeCoffee( @Suspended final AsyncResponse asyncResponse,

                             @ApiParam(value = "The coffee type.", required = true)
                             @QueryParam("type")
                             String type)
    {
        coffeeRequestListeners.fire(new CoffeeRequest(type, asyncResponse));
    }
} …
Run Code Online (Sandbox Code Playgroud)

ejb jax-rs swagger

6
推荐指数
2
解决办法
4974
查看次数

标签 统计

ejb ×1

jax-rs ×1

swagger ×1