Skip to content

[BUG]: Parameters with content field are not correctly serialized #10661

@valerii15298

Description

@valerii15298

To reproduce...

Paste this OpenAPI definition into https://editor.swagger.io:

openapi: 3.1.0
info: 
  title:
  version:
paths:
  /test:
    get: 
      parameters: 
        - in: query
          name: pet
          content:
            application/json: 
              schema: 
                type: string
      responses: 
        2XX:
          description:
          content: 
            application/json: 
              schema:
                type: object

Describe the bug you're encountering

When filling the parameter in Swagger UI the produced request looks like this:

curl -X 'GET' \
  'https://editor.swagger.io/test?pet=cat' \
  -H 'accept: application/json'

The parameter pet is not properly serialized.

Expected behavior

Query string should look like this: %22cat%22 which is percent encoded from "cat" since definition of the pet parameter uses content application/json.
And the curl snippet should look like this:

curl -X 'GET' \
  'https://editor.swagger.io/test?pet=%22cat%22' \
  -H 'accept: application/json'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions