我有PET和CATEGORY课程。 PET有一个类别对象。但是,当我运行应用程序时,我没有在Swagger UI文档中看到Category类的字段 我不使用弹簧而且不想使用弹簧。我不确定缺少什么?
@ApiModel(value = "A pet is a person's best friend" )
public class Pet {
private long id;
private Category category;
public long getId() {
return id;
}
@ApiModelProperty(value = "ID", required=true)
public void setId(long id) {
this.id = id;
}
public Category getCategory() {
return category;
}
@ApiModelProperty(value = "CAT", required=true)
public void setCategory(Category category) {
this.category = category;
}
AND CLASS CATEGORY as
@ApiModel(value = "Category")
public class Category {
private long id;
private String name;
@ApiModelProperty(value = "ID", required=true)
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
OUTPUT SWAGGER UI文档
{
"id": 0,
"category": {}
}
MISSING
id缺失
"category": {
"id": 0
}