Redocly / Redocly/redoc

Exapmle for array in query serializes incorrect

Open
#1,731 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

investigation
Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

Describe the bug
The examples for an array in query params renders incorrectly

        - name: status
          in: query
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
              enum: ["PENDING", "IN_PROGRESS", "DELIVERED", "ERROR"]
              example:
               - "PENDING"
               - "IN_PROGRESS"
          description: The kind of consignments that should be returned, if omitted all statuses are returned.

renders
image

Expected behavior
The expected example would be status=PENDING&status=IN_PROGRESS
as per https://swagger.io/docs/specification/serialization/

Additional context
the explicit definition of style and explode should not be needed either since that is the default. I just added them since the default behavior did not work.

was supposedly fixed in https://github.com/Redocly/redoc/pull/917

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

Start by reproducing the array query example from the issue and compare its output with the OpenAPI serialization guidance linked there. Review the changes in pull request 917 and trace the query-parameter serialization entry point. Done means the example renders as status=PENDING&status=IN_PROGRESS, including the default style and explode behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.