guardrail icon indicating copy to clipboard operation
guardrail copied to clipboard

Support for `content` when describing parameters

Open andrewryno opened this issue 6 years ago • 2 comments

Documented here: https://swagger.io/docs/specification/describing-parameters/ under schema vs content

Example Swagger definition that causes examples to fail with Error: Parameter 'foo' has no schema:

openapi: 3.0.1
info:
  version: 1.0.0
paths:
  /foo:
    get:
      operationId: getFoo
      parameters:
        - in: query
          name: foo
          content:
            application/json:
              schema:
                $ref: '#/components/parameters/Foo'
          required: true
      responses:
        204:
          description: OK
components:
  parameters:
    Foo:
      type: object
      properties:
        bar:
          type: string
        baz:
          type: string

This would allow query strings in the format of:

/foo?foo={"bar":"value","baz":"value"}

and would deserialize that into Foo.

andrewryno avatar May 08 '19 16:05 andrewryno

Woah, awesome!

blast-hardcheese avatar May 11 '19 17:05 blast-hardcheese

I have a similar use case where I'd like to pass JSON query params.

francescopellegrini avatar Apr 30 '20 11:04 francescopellegrini