Fariba
Fariba

Reputation: 723

What could i put in response in @ApiOperation of Swagger

In this code could i use Status.class @ApiOperation when this method return Response.noContent.build();?

    @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();
    }

Upvotes: 2

Views: 5919

Answers (1)

Vivin Paliath
Vivin Paliath

Reputation: 95488

You can omit the response part and it will use Void.class by default. From the 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

Upvotes: 3

Related Questions