我想调整Swagger-UI for Java REST API。 要求:
提前致谢。
@Component @Path("/test") @Api(value = "/test", description = "Demo of how to pass JSON/XML document to the REST services", consumes = MediaType.APPLICATION_JSON + "," + MediaType.APPLICATION_XML, produces = MediaType.APPLICATION_JSON + "," + MediaType.APPLICATION_XML) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) public class TerminologyRest2 { @POST @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Creates a product", notes = "Creates a product and puts it in the catalog.", consumes = MediaType.APPLICATION_JSON + "," + MediaType.APPLICATION_XML, produces = MediaType.APPLICATION_JSON + "," + MediaType.APPLICATION_XML, protocols = "POST", response = Product.class) @ApiResponses(value = { @ApiResponse(code = 400, message = "Malformed definition of new product", response = StatusInfo.class), @ApiResponse(code = 500, message = "Internal server error", response = StatusInfo.class), @ApiResponse(code = 200, message = "Successful catalogization of new product", response = Product.class) }) public Response createProduct(@ApiParam(name = "product", required = true, value = "Define product content") Product product) { try { return Response.status(200).entity(product).build(); } catch (IllegalArgumentException e) { return Response.status(Status.NOT_ACCEPTABLE).entity(e.getMessage()).build(); } } }
目前:
通缉: