Skip to content

Repeated-key array query parameters (form, explode:true) collapse to last value #141

@benjamineckstein

Description

@benjamineckstein

Problem

The default serialization for an array query parameter, style: form + explode: true, sends repeated keys (?id=1&id=2&id=3). Under PHP's native query parsing, repeated keys WITHOUT the [] suffix collapse to a single (last) value ($request->query('id') returns 3, not [1,2,3]). The non-exploded delimited form is handled (#132 splits on the declared delimiter), but the exploded repeated-key form is not reassembled, so array elements are silently lost.

Impact

A spec-conformant client sending ?id=1&id=2&id=3 (the OpenAPI default for an array query param) has all but the last element dropped before validation and before the handler sees it. The generated array rules then validate a single scalar. Silent data loss + a correctness gap on the single most common array-query encoding.

What correct support looks like

Current behavior (recorded in fidelity report)

The form + explode: true repeated-key array query encoding is recorded in openapi-laravel.unsupported.json (the drift-checked fidelity report) as collapsing to the last value. Related closed issues: #63 (query params), #132 (delimited / explode: false arrays).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpost-1.0Explicitly deferred past 1.0.0

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions