ASTRO企业应用 ASTROPRO-swagger标签使用指南:16、x-enum-class-name

时间:2024-11-13 15:18:50

16、x-enum-class-name

作用

用于标识查询参数对应的枚举类。

标签值类型

String

使用位置

paths.path.operation.parameters.fields.x-enum-value-type

对应的是swagger中已定义的枚举对象名字。

使用示例

Paths:  
  /v1/orders/{order_id}/order-details:
    get:
      tags:
      - "Order"
      summary: "查询OrderDetail"
      description: "Returns OrderDetail"
      operationId: "ListOrderDetails"
      x-is-registered: 'N'
      x-support-sdk: 'N'
      x-mybatis-paging: true
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - name: "status"
        in: "query"
        description: "status"
        required: false
        type: "string"
        x-enum-class-name: "OrderStatus" #此标签只在查询参数中使用
       --------

使用效果:

使用前:

public class ListOrderDetailsQo implements Serializable {
    private static final long serialVersionUID = 1L;
    @JsonProperty("status")
    private Object status = null;

   -------------------
}

使用后:

public class ListOrderDetailsQo implements Serializable {
    private static final long serialVersionUID = 1L;
    @JsonProperty("status")
    private OrderStatus status = null;

   -------------------
}
support.huaweicloud.com/usermanual-astropro/astropro_05_0143.html