It seems to Swaggerignore annotations JAXBsuch as@XmlTransient
In addition, Swagger also seems to parse getters, ignoring @XmlAccessorType(XmlAccessType.FIELD)
Is there a way to specify Swaggerfor evaluating annotations JAXB?
UPDATE
code example
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@ApiModel( value = "aaa")
public class A implements IA
{
@ApiModelProperty( value = "bla", required = true )
@XmlElement(name="a")
private String a;
@XmlTransient
private B b;
private A() {}
@XmlTransient
public boolean isC() { return true;};
}
The IA interface does not contain annotations. and no getters to field b that could interfere.
Generated by JAON:
"A": {
"id": "A",
"description": "aaa",
"properties": {
"c": {
"type": "boolean"
}
}
}
As you can see, Swagger ignores the fields and @XMLAccesorType(as Webron noted in his answer), but also ignores the JAXB ( @XmlTransient) annotation in the isC()getter function
source
share