In my project, we create REST interfaces using RestEasy and use Swagger to document them. The problem is that this requires a lot of annotations and may look like this:
@ApiOperation(value = "Create a person object", notes = "Create a person object" + "Return the newley created person object", response = Person.class) @ApiResponses({ @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = "Internal server error"), @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = "Unauthorized"), @ApiResponse(code = HttpStatus.SC_PRECONDITION_FAILED, message = "Precondition failed"), @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = "Bad request"), @ApiResponse(code = HttpStatus.SC_UNPROCESSABLE_ENTITY, message = "Unprocessable entity") }) @POST @Path("rest/v1/persons") @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) Person createPerson( @HeaderParam("SecurityToken") String token, @ApiParam(value = "person", defaultValue = "{ \"name\": = \"Bart Simpson\", \"age\": = 9 }") Person person);
Most annotations are more or less the same in all of our methods. Therefore, we copy and paste a lot, and all these annotations make our interfaces completely unreadable, and it's hard to say exactly what these methods do.
So I'm wondering if anyone has an idea on how we can have the same functionality, but somehow hide all of these annotations, or at least some of them.
source share