您如何注释APIModel中的方法

时间:2018-12-17 17:48:28

标签: java swagger

我有一个DTO标注为API模型。此DTO还具有一些有用的功能。我正在尝试注释这些有用的功能。用@ApiOperation@ApiModelProperty进行注释不会使此函数包含在生成的yaml文件中。您如何在DTO中注释此类方法?

@ApiModel(value = "Document information")
public class DocumentDto {

    public enum DocumentType {
        PDF,
        WORD,
        CSV
    }

    ...

    @NotNull
    @ApiModelProperty(required = true, value = "document type", allowableValues = "PDF, WORD, CSV")
    private DocumentType documentType;

    ...

    @JsonIgnore
    @ApiOperation(value = "is this document a PDF?")
    public boolean isPDF() {
        return documentType == DocumentType.PDF;
    }
}

0 个答案:

没有答案
相关问题