swagger-api / swagger-api/swagger-ui

Swagger UI expand/collapse for Enum component.

Open
#7,549 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)
  • OS: macOS
  • Browser: chrome
  • Version: Latest
  • Swagger-UI version: 3.52.3
Description

When I use Enum in components schemas. I can expand the TypeEnum object, but there is no button for me to collapse the object.

There is "arrow" button to expand
image

While I can collapse Item, I cannot collapse TypeEnum, I have to refresh the page
image

Example Swagger/OpenAPI definition:

openapi: 3.0.2
info:
  title: FastAPI
  description: ''
  version: 0.1.0
paths:
  /items/:
    get:
      summary: Read Items
      operationId: read_items_items__get
      parameters:
        - required: false
          schema:
            title: Q
            maxLength: 50
            type: string
          name: q
          in: query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response Read Items Items  Get
                type: array
                items:
                  $ref: '#/components/schemas/Item'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HTTPValidationError:
      title: HTTPValidationError
      type: object
      properties:
        detail:
          title: Detail
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    Item:
      title: Item
      required:
        - name
        - price
        - tags
      type: object
      properties:
        name:
          title: Name
          type: string
        description:
          title: Description
          type: string
        price:
          title: Price
          type: number
        tax:
          title: Tax
          type: number
        tags:
          $ref: '#/components/schemas/TypeEnum'
    TypeEnum:
      title: TypeEnum
      enum:
        - predicted
        - measured
      type: string
      description: An enumeration.
    ValidationError:
      title: ValidationError
      required:
        - loc
        - msg
        - type
      type: object
      properties:
        loc:
          title: Location
          type: array
          items:
            type: string
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
Expected behavior

There is a arrow button after expanding to collapse the tab.

Screenshots
Additional context or thoughts

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in Swagger UI 3.52.3 using the supplied OpenAPI definition, focusing on the TypeEnum component under Item. Inspect the Enum component's expanded and collapsed states; done means the expanded TypeEnum has an arrow control that collapses it without refreshing the page.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.