我们在类似的接口上分离了REST定义:
public inteface Bitacora { ... }
然后实现去:
public class BitacoraResource implements Bitacora { ... }
经过大量的测试,我们看到Swagger仅在定义是类而不是接口的情况下才起作用。
是否有一种解决方法可以使Swagger使用接口而不是类?
@Provider
@Path("/bitacora")
@Api(value = "/bitacora", description = "API")
public class Bitacora {
@GET
@Produces({MediaType.TEXT_XML,MediaType.APPLICATION_JSON})
@Wrapped(element="bitacora")
@GZIP
@ApiOperation(value = "obtiene info",notes = "obtiene info bitacora",consumes="*/*",produces= "*/*")
@ApiResponses(value = { @ApiResponse(code = 200, message = "ok"),@ApiResponse(code = 400, message = "sinlistar"), @ApiResponse(code = 404, message = "error") })
public Collection<Favorito> listar(@HeaderParam("data") String data) {
return null;
}
}