Go through the constants design panel of ApiHug Api design Copilot

  1. Constant(Enum) design panel
  2. Source code route
ApiHug Constant Manager

Proto Sample

Please refer: apihug-full-demo admin/constant.proto

enum  UserStatusEnum {

  option (hope.swagger.enm) = {
    description: "User management status"
  };

  NORMAL = 0 [(hope.constant.field) = {code: 1,message: "normal", message2: "user normal status"}];
  BLOCKED = 1 [(hope.constant.field) = {code: 2,message: "blocked", message2: "user blocked"}];

}

Java Sample

Please refer: apihug-full-demo UserStatusEnum.java

@Generated("H.O.P.E. Infra Team")
@ProtoFrom(
        value = "com/apihug/demo/user/proto/infra/settings/admin/constant.proto",
        entity = "UserStatusEnum",
        kind = Kind.ENUM
)
public enum UserStatusEnum implements Enumeration<UserStatusEnum> {
    NA(-1, "Default Placeholder Should NEVER be used", "默认占位枚举请勿使用"),
    NORMAL(1, "normal", "user normal status"),
    BLOCKED(2, "blocked", "user blocked");
}

Reference

  1. ApiHug101-Bilibili
  2. ApiHug101-Youtube