we're using RESTEasy with jettison provider (not jackson because it doesn't support Atom links, that we really like) and try to create valid API documentation with Swagger. However, jettison generates json with "xmlRootElement", whereas swagger assumes "normal", jackson-like json. Hence, documentation produced is not valid and client generated using swagger client generator doesn't work. Example:
Java class:
@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
....
}
Model generated by Swagger:
{ "id": "string", "fullName": "string"}
Response from server
{ "service": { "id": "xyz", "fullName": "Example full name"}}
Is there any way to make swagger and jettison cooperate? We really don't want to change provider to jackson and lost links.
EDIT
As we didn't found any solution for integrating aforementioned technologies, we decided to migrate from jettison to jackson and implement (partially, tailored to our needs) RESTEasy specification of atom link compatible with jackson by our own. We advice such solution as it's quite easy and other problems of jettison are automatically solved.