在使用 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 中做到这一点?
swagger-editor 和 swagger-ui 添加了对 http://swagger.io/docs/specification/describing-parameters
的支持swagger-php库也增加了支持,它将成为3.0.4版本的一部分。