How to define mutually exclusive query parameters in Swagger (OpenAPI)?

前端 未结 4 1151
借酒劲吻你
借酒劲吻你 2020-11-30 08:43

I have a series of parameters in Swagger like this

                    \"parameters\": [
                    {
                


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-30 08:56

    Unfortunately this isn't possible in Swagger currently. "required" is just a boolean and there's no way to represent interdependencies between parameters.

    Best you can do is make clear the requirements in the parameter descriptions and also put in a custom 400 Bad Request description along the same lines.

    (There's a bit of discussion at https://github.com/swagger-api/swagger-spec/issues/256 about possible ways of implementing this in the next version of Swagger)

提交回复
热议问题