#2833·redoc

Default value for array query parameter with explode:true (default) and 2+ items is rendered incorrectly (regression from #1806 fix)

Author: sboisseCreated Aug 25, 2026Updated Sep 15, 2026
LabelsType: Bug

Describe the bug

When a query parameter is an array with a default containing 2 or more items, and the parameter uses the default OpenAPI serialization (style: form, explode: true — i.e. no style/explode fields set at all, which is the spec default for query params), the rendered "Default:" value is mangled. It shows the first item concatenated with a dangling &paramName= fragment instead of a clean list.

Expected behavior

The "Default:" field should show something like ["Cat", "Dog"] or Cat, Dog — matching how example values for the same shape are displayed.

Minimal reproducible OpenAPI snippet(if possible)

yaml
paths:
  /species:
    get:
      parameters:
        - name: animals
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
              enum: ["Cat", "Dog", "Bird", "Fish", "Elephant"]
            default: ["Cat", "Dog"]
          description: Animal species.
      responses:
        "200":
          description: OK

Screenshots

Image

Root cause

In src/components/Fields/FieldDetails.tsx:

javascript
const defaultValue =
  isObject(schema.default) && field.in
    ? getSerializedValue(field, schema.default).replace(`${field.name}=`, '')
    : schema.default;
  • isObject() (from src/utils/helpers.ts) is typeof item === 'object', which is true for arrays, so any array-type parameter default takes this branch.
  • getSerializedValueserializeParameterValueserializeQueryParameter serializes the default using the parameter's style/explode the same way it would appear on the wire. For the default explode: true, a 2-item array serializes to report_types=EFT&report_types=Credit Card (two report_types= occurrences).
  • .replace(${field.name}=, '') is a plain string replace, which only removes the first occurrence, not all of them (.replaceAll would be needed). This leaves the second &report_types= fragment in the displayed value.

This is a regression introduced by the fix for #1806 (PR #2186). That fix's own repro used explode: false with a comma-joined default, which serializes to a single name=val1,val2,val3 string (only one occurrence of name=), so the single-occurrence .replace() happened to fully strip it in that case. It was never tested against the explode: true + 2-or-more-items case, which is actually the more common case since it's the OpenAPI default for query array parameters (no explicit style/explode needed to trigger it).

Suggested fix

Replace the single-occurrence .replace(...) with .replaceAll(...), or better, avoid stripping via string manipulation entirely and instead render the parsed array default directly (e.g. join with the same separator/format used for example arrays) rather than round-tripping through wire-serialization + string-stripping.

Environment

  • ReDoc version: latest (redoc@latest via jsdelivr) — bug also present on main branch
  • OpenAPI version: 3.0 / 3.1 (style/explode defaults are shared across both)