2

在使用 OpenApi 规范的 swagger 文档中,您可以使用 application/json 将参数中的模式包装到内容中:

parameters:
  - in: query
    name: filter

    # Wrap 'schema' into 'content.<media-type>'
    content:
      application/json:  # <---- media type indicates how to serialize / deserialize the parameter content
        schema:
          type: object
          properties:
            type:
              type: string
            color:
              type: string 

发送这样的对象filter={"type":"t-shirt","color":"blue"}。如何在 swagger-php 中做到这一点?

4

1 回答 1

3

swagger-editor 和 swagger-ui 增加了对http://swagger.io/docs/specification/describing-parameters的支持

swagger-php 库也增加了支持,它将成为 3.0.4 版本的一部分。

于 2020-01-19T09:54:17.863 回答