我们正在使用RESTEasy和jettison提供程序(不是jackson,因为它不支持我们真正喜欢的Atom链接)并尝试使用Swagger创建有效的API文档 . 然而,jettison生成json与“xmlRootElement”,而swagger假设“正常”, Jackson 样json . 因此,生成的文档无效,使用swagger客户端生成器生成的客户端不起作用 . 例:

Java类:

@Mapped(namespaceMap = @XmlNsMap(jsonName = "atom", namespace =     "http://www.w3.org/2005/Atom"))
    @ApiModel(value = "Service", description = "Service resource representation")
    @XmlRootElement
    @XmlAccessorType(XmlAccessType.NONE)
    public class Service {

    @XmlID
    @XmlAttribute(name = "id")
    @ApiModelProperty(value = "Service's unique id")
    private String id;

    @XmlAttribute(name = "fullName")
    @ApiModelProperty(value = "Service's full name")
    private String fullName;

    @XmlElementRef
    protected RESTServiceDiscovery rest;

    //getters and setters
    ....
    }

Swagger生成的模型:

{  "id": "string",   "fullName": "string"}

服务器响应

{  "service": {  "id": "xyz", "fullName": "Example full name"}}

有没有办法让招摇和抛弃合作?我们真的不想将提供者更改为 Jackson 并丢失链接 .

EDIT

由于我们没有找到任何集成上述技术的解决方案,我们决定从jettison迁移到jackson并实现(部分地,根据我们的需求量身定制)RESTEasy specification of atom link与我们自己的jackson兼容 . 我们建议这样的解决方案,因为它很容易,并且其他抛弃问题会自动解决 .