Java 为swagger UI文档的每个枚举值添加说明

Java 为swagger UI文档的每个枚举值添加说明,java,swagger-ui,Java,Swagger Ui,如何为swagger UI文档的每个枚举值添加一些描述 我的班级: @ApiModel public enum EnumCarrierSelectionSubstitutionInformation { CARRIER_SELECTION_SUBSTITUTION_INFORMATION_1(1), // CARRIER_SELECTION_SUBSTITUTION_INFORMATION_2(2), // CARRIER_SELECTION_SUBSTITUTION_I

如何为swagger UI文档的每个枚举值添加一些描述

我的班级:

@ApiModel
public enum EnumCarrierSelectionSubstitutionInformation {
    CARRIER_SELECTION_SUBSTITUTION_INFORMATION_1(1), //
    CARRIER_SELECTION_SUBSTITUTION_INFORMATION_2(2), //
    CARRIER_SELECTION_SUBSTITUTION_INFORMATION_3(3), //
    CARRIER_SELECTION_SUBSTITUTION_INFORMATION_4(4), //
    CARRIER_SELECTION_SUBSTITUTION_INFORMATION_5(5), //
    CARRIER_SELECTION_SUBSTITUTION_INFORMATION_6(6), //
    CARRIER_SELECTION_SUBSTITUTION_INFORMATION_7(7);

    private int numVal;

    EnumCarrierSelectionSubstitutionInformation(int numVal) {
        this.numVal = numVal;
    }

    public int getNumVal() {
        return numVal;
    }
}
模型

private EnumCarrierSelectionSubstitutionInformation carrierSelectionSubstitutionInformation;

// getter setter......
我想在
运营商\u选择\u替换\u信息\u 1
中添加一些说明

我试过了

@ApiModelProperty(value = "blabla2")
CARRIER_SELECTION_SUBSTITUTION_INFORMATION_1(1), //
但这是行不通的

大摇大摆的用户界面输出:

carrierSelectionSubstitutionInformation (string, optional) = ['CARRIER_SELECTION_SUBSTITUTION_INFORMATION_1', 'CARRIER_SELECTION_SUBSTITUTION_INFORMATION_2', 'CARRIER_SELECTION_SUBSTITUTION_INFORMATION_3', 'CARRIER_SELECTION_SUBSTITUTION_INFORMATION_4', 'CARRIER_SELECTION_SUBSTITUTION_INFORMATION_5', 'CARRIER_SELECTION_SUBSTITUTION_INFORMATION_6', 'CARRIER_SELECTION_SUBSTITUTION_INFORMATION_7']
string
Enum:   "CARRIER_SELECTION_SUBSTITUTION_INFORMATION_1", "CARRIER_SELECTION_SUBSTITUTION_INFORMATION_2", "CARRIER_SELECTION_SUBSTITUTION_INFORMATION_3", "CARRIER_SELECTION_SUBSTITUTION_INFORMATION_4", "CARRIER_SELECTION_SUBSTITUTION_INFORMATION_5", "CARRIER_SELECTION_SUBSTITUTION_INFORMATION_6", "CARRIER_SELECTION_SUBSTITUTION_INFORMATION_7"

如何做到这一点?

为什么不为枚举使用描述性名称,而不是“承运商\选择\替换\信息\ 7”?一些描述如:“存在预预订承运商,并且承运商不是呼叫方输入的。使用预预订承运商。”例如,值1和“预预订的载波与主叫方输入的载波相同。使用输入载体。“对于值2,…很难(对我来说:s)找到一个描述性的名称。描述是针对Swagger UI的,用于文档…我只是看到我的标题没有暗示Swagger UIHo。这是否回答了Swagger UI文档的问题?
public class Enum {

public enum EnumCarrierSelectionSubstitutionInformation {
    CARRIER_SELECTION_SUBSTITUTION_INFORMATION_1(1,"ONE"), //
    CARRIER_SELECTION_SUBSTITUTION_INFORMATION_2(2,"TWO"),

        private final int value;
        private final String description;

        EnumCarrierSelectionSubstitutionInformation(int value, String desc){
            this.value = value;
            this.description = desc;
        }
        public int value(){
            return this.value;
        }
        public String description(){
            return this.description;
        }
    }

    public static void main(String[] args){
        for (EnumCarrierSelectionSubstitutionInformation elem: EnumCarrierSelectionSubstitutionInformation.values()){
            System.out.println(elem + "value is "+ new Integer(elem.value()) + " desc is " + elem.description());
        }
    }
}