代码之家  ›  专栏  ›  技术社区  ›  cph2117

Swagger不验证枚举查询参数

  •  1
  • cph2117  · 技术社区  · 6 年前

    我正在使用swagger 2.0来定义我的API。我正在使用文档中描述的枚举 here

    /my-endpoint:
        x-swagger-router-controller: my-controller
        get:
          summary: my test endpoint
          parameters:
            - name: feeling
              in: query
              type: string
              enum:
                - happy
                - sad
              required: true
          produces:
            - application/json
          responses:
            200:
              description: OK
    

    我希望 400 bad request feeling 查询参数也不是 happy sad

    0 回复  |  直到 6 年前