swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.48k stars 8.96k forks source link

Schema not rendered for query parameter #7696

Open FCsongradi opened 2 years ago

FCsongradi commented 2 years ago

Q&A (please complete the following information)

Describe the bug you're encountering

Swagger-UI is not displaying the schema if it's for a parameter from query, but it displays the description.

To reproduce...

Steps to reproduce the behavior:

  1. Load a yaml with a similar operation in Swagger-UI
    ...
    get:
      tags:
        - array query parameter test
      operationId: arrayQueryParamTest
      summary: Testing array in query parameter not rendered issue.
      parameters:
      - name: arrayTest
        in: query
        description: Array parameter in query
        schema:
          type: array
          items:
            type: string
            maxLength: 25
            description: Test item
            example: Example string item
      responses:
        200:
        ...
  2. Open the corresponding operation
  3. See that only parameter description is visible

Actual behavior

Only parameter description is shown without examples or schema

Expected behavior

I expected the schema to be shown in the parameter description.

callmerockett commented 2 years ago

I'm facing exactly this issue. The lack of a detailed schema for objects in parameters gives poor information about enum types (just show the first option, but no more), for example. There are a related issue to this problem #4581, but i'm not sure about the progress.

FCsongradi commented 2 years ago

Thanks for the reply and for the link. I've checked and there is no solution for this yet. The issue #4581 was created in 2018. Is there any hope that this will be fixed?

DoZiBo1 commented 3 months ago

I am also struggling with the issue, that parameters do not inherit description from a schema. Would this be considered the same issue? I am trying to use schemas for descriptions, but when defining a parameter that refs to a schema, the schema description is not shown as parameter description.

Eger37 commented 1 month ago

Hi, I think I have the same problem. I used https://editor.swagger.io. A part from my json doc in open API 3.1: "/dogs": { "get": { "responses": { "200": {... } } }, "parameters": [ { "name": "filter", "in": "query", "required": false, "content": { "application/json": { "schema": { "type": "object", "title": "_GetCollectionSchema", "properties": { "id": { "type": "number", "title": "Id", "default": null }, "user_id": { "type": "number", "title": "User Id", "default": null }, "name": { "type": "string", "title": "Name", "default": null }, "expires_at": { "type": "string", "title": "Expires At", "default": null, "format": "date-time" }, "created_at": { "type": "string", "title": "Created At", "default": null, "format": "date-time" } } } } } }, image But there is only example of values and isn't schema.