gpt4 book ai didi

java - 我可以在 Swagger 的 @ApiOperation 中回应什么

转载 作者:行者123 更新时间:2023-11-30 08:10:41 25 4
gpt4 key购买 nike

在此代码中,当此方法返回 Response.noContent.build(); 时,我可以使用 Status.class @ApiOperation 吗?

    @DELETE
@Path("/property/{id}")
@ApiOperation(value = "Delete", notes = "Delete a persisted property from data source.", response = Status.class??)
public Response delete(String id){
...
...
return Response.noContent().build();
}

最佳答案

您可以省略 response部分,它将使用 Void.class默认情况下。来自docs :

public abstract Class<?> response

The response type of the operation. In JAX-RS applications, the return type of the method would automatically be used, unless it is javax.ws.rs.core.Response. In that case, the operation return type would default to void as the actual response type cannot be known. (emphasis mine)

Setting this property would override any automatically-derived data type.

If the value used is a class representing a primitive (Integer, Long, ...) the corresponding primitive type will be used.

Default:

java.lang.Void.class

关于java - 我可以在 Swagger 的 @ApiOperation 中回应什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31550325/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com