我可以在 Swagger 的 @ApiOperation 中回应什么
What could i put in response in @ApiOperation of Swagger
在这段代码中,当此方法 return 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
在这段代码中,当此方法 return 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 tovoid
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