Skip to content

Query string parameter not rendered when using 'content' property #5023

@akrz

Description

@akrz

Q&A (please complete the following information)

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.1
info:
  title: API Docs
  version: '1.0'
  description: 'Docs'
paths:
  /api/v1/tools/lnft:
    get:
      summary: Calculate LNFT
      tags:
        - Tools
      description: 'description'
      operationId: LNFT
      parameters:
        - in: query
          name: filter
          content:
            application/json:  # <---- media type indicates how to serialize / deserialize the parameter content
              schema:
                type: object
                properties:
                  type:
                    type: string
                  color:
                    type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CalculateLNFT'
            application/xml:
              schema:
                $ref: '#/components/schemas/CalculateLNFT'
                xml:
                  name: data
        '400':
          description: Bad Request -- Validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/xml:
              schema:
                $ref: '#/components/schemas/Error'
                xml:
                  name: data
        '401':
          description: Authorization Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/xml:
              schema:
                $ref: '#/components/schemas/Error'
                xml:
                  name: data
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/xml:
              schema:
                $ref: '#/components/schemas/Error'
                xml:
                  name: data
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP Code
            message:
              type: string
              description: Error Description
    CalculateLNFT:
      type: object
      properties:
        data:
          type: object
          properties:
            results:
              type: object
              properties:
                LNFT:
                  type: float
                  descritpion: Linear feet value
                  example: 7.08
                Trucks:
                  type: integer
                  description: Number of Trucks necessary for load
                  example: 2
                Remarks:
                  type: string
                  description: Remarks
                  example: string
            message:
              type: string
              description: Extra Info
security:
  - bearerAuth: []
servers:
  - url: /framework

Describe the bug you're encountering

Unable to render query string parameter when using 'content' instead of schema. I'm using 'content' because my query string is a json string, as stated in the example.

To reproduce...

Steps to reproduce the behavior:

  1. Use 'content' as stated in https://swagger.io/docs/specification/describing-parameters/
      parameters:
        - in: query
          name: filter
          content:
            application/json:  # <---- media type indicates how to serialize / deserialize the parameter content
              schema:
                type: object
                properties:
                  type:
                    type: string
                  color:
                    type: string

(complete yaml above)
2. See error when rendering in swagger UI: 😱 Could not render ParameterRow, see the console.
3. Console output:
root-injects.js:95 TypeError: Cannot read property 'get' of undefined
at t.value (parameter-row.jsx:145)
at t.render (root-injects.js:93)
at s._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js:796)
at s._renderValidatedComponent (ReactCompositeComponent.js:819)
at s.performInitialMount (ReactCompositeComponent.js:359)
at s.mountComponent (ReactCompositeComponent.js:255)
at Object.mountComponent (ReactReconciler.js:43)
at X.mountChildren (ReactMultiChild.js:234)
at X._createInitialChildren (ReactDOMComponent.js:701)
at X.mountComponent (ReactDOMComponent.js:520)

Expected behavior

Input is rendered

Screenshots

Additional context or thoughts

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions