Swagger的SpringBoot java Collection注释

时间:2016-04-06 13:45:32

标签: rest spring-boot swagger swagger-ui spring-rest

我有注释和生成文档的问题(spring-boot,springfox-swagger2)。

在我的TechnologyDTO中,String Collection的正确注释应该是什么?

swagger是否支持java.util.Collection?

一代人之后我有:

模型架构:

{
    "technologies": {},
    "userGUID": "string"
}

型号:

TechnologyDTO {
    technologies (Collection«string»): User main technology names,
    userGUID (string): User guid
}

Collection«string» {
} 

我的技术道具

public class TechnologyDTO {
    private final String userGUID;
    private final Collection<String> technologies;

    public TechnologyDTO(String userGUID, Collection<String> technologies) {
        this.userGUID = userGUID;
        this.technologies = technologies;
    }

    @ApiModelProperty(notes = "User guid", dataType="string", required = true)
    public String getUserGUID() {
        return userGUID;
    }

    @ApiModelProperty(notes = "User main technology names", required = true)
    public Collection<String> getTechnologies() {
        return technologies;
    }

    public static TechnologyDTO createEmptyDTO() {
        return new TechnologyDTO(null, null);
    }
}

0 个答案:

没有答案