Search code examples
javaannotationsjax-rsdocumentation-generationresteasy

Adding description to RestEasy's web service parameters?


Is there some way/annotation by which I can add the description to the parameters of a RestEasy web service? I went through the api-doc of the annotations, but found nothing there.

This is in order to add the descriptions so that they are reflected in the REST API documentation which I'll be auto-generating using some tool.

An example web service interface:

@Path("list-all")
@GET
@RBAC(type = { CRUDEnum.READ }, capability = { "PowerUser" })
@ParseContext
@Produces( {
        "application/json",
        "application/xml"})
public net.myapp.services getAllDevices(
        @QueryParam("start") int param0, @QueryParam("limit") int param1);

Solution

  • Found the way for this. There is no REST annotation to add the parameter description.

    The solution for this is to use the typical java-doc annotation.

    e.g.

    /** 
     * @param param0 Paging parameter
     * @param param1 Paging parameter
     * */
    @Path("list-all")
    @GET
    @RBAC(type = { CRUDEnum.READ }, capability = { "PowerUser" })
    @ParseContext
    @Produces( {
            "application/json",
            "application/xml"})
    public net.myapp.services getAllDevices(
            @QueryParam("start") int param0, @QueryParam("limit") int param1);