Search code examples
swagger-php

@AO\JsonContent in parameter of get request


In swagger's documentation using OpenApi specification, you can wrap schema in parameter to content with 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 

to send objects like this filter={"type":"t-shirt","color":"blue"}. How to do it in swagger-php?


Solution

  • The swagger-editor and swagger-ui have added support for http://swagger.io/docs/specification/describing-parameters

    The swagger-php library has added support too, it will be part of the 3.0.4 release.