必填字段将被忽略,并且不会生成。
例如,对于属性a
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;
public String getC() { return "kkk";};
}
答案 0 :(得分:2)
似乎您应该切换注释的顺序!
而不是
@ApiModelProperty( value = "bla", required = true )
@XmlElement(name="a")
private String a;
写
@XmlElement(name="a")
@ApiModelProperty( value = "bla", required = true )
private String a;
对我来说似乎是一个错误。希望能在新版本中修复
答案 1 :(得分:0)