此问题不是(Swagger - 指定可选对象属性或多个响应)的重复,因为该OP试图返回200或400.
我有一个GET可选参数; 例如,GET /endpoint?selector=foo.
我想根据参数是否通过返回其架构不同的200,例如:
GET /endpoint -> {200, schema_1}
GET /endpoint?selector=blah -> {200, schema_2}
Run Code Online (Sandbox Code Playgroud)
在yaml中,我尝试了两个200代码,但是观察者将它们压扁,好像我只指定了一个.
有没有办法做到这一点?
编辑:以下似乎相关:https://github.com/OAI/OpenAPI-Specification/issues/270