Skip to content

Patch releases 4.4.3 / 5.0.2 change the OpenAPI document of array query parameters (#8600), duplicating key[] into key[][] #8634

Closed

Description

@Valmonzo

API Platform version(s) affected: 4.4.3 and 5.0.2 (api-platform/openapi), compared with 4.4.2 and 5.0.1

Description

#8600 (fixing #8421) changed how OpenApiFactory documents a filterless QueryParameter whose schema is type: array: when castToArray is not set, it now documents the parameter twice, as key and as key[] (the latter with style: deepObject, explode: true).

This shipped in patch releases and changes the generated OpenAPI document of any application with such a parameter:

  1. Every filterless array parameter gains a second documented parameter (ids → ids + ids[]).
  2. When the key already ends with [] (a common way to document the ids[]=1&ids[]=2 form the server parses), the added parameter is key[][], which the server never accepts (status[] → status[] + status[][]).

The 4.4.3 changelog lists #8600 under "Bug fixes", with no warning. The 5.0.2 changelog explains that #8598 was reverted from 4.4 because "a schema change must not ship in a patch release". #8600 is a schema change of the same kind.

How to reproduce

#[ApiResource(
    operations: [
        new GetCollection(
            uriTemplate: '/repro',
            parameters: [
                'status[]' => new QueryParameter(
                    schema: ['type' => 'array', 'items' => ['type' => 'string']],
                    required: false,
                ),
                'ids' => new QueryParameter(
                    schema: ['type' => 'array', 'items' => ['type' => 'string']],
                    required: false,
                ),
            ],
        ),
    ],
)]
final class ReproResource
{
    public ?string $id = null;
}

bin/console api:openapi:export, parameters of GET /api/repro (name, style):

api-platform/openapi Documented parameters
4.4.2, 5.0.1 status[] (form), ids (form)
4.4.3, 5.0.2 status[] (form), status[][] (deepObject), ids (form), ids[] (deepObject)

In our application the 4.4.3 bump adds 421 parameters across 16 operations. The runtime behaviour is unchanged, but:

  • generated clients change: Orval 8.39 adds a 'status[][]'? property next to 'status[]'? on every params type;
  • a CI check comparing the committed OpenAPI document with a fresh export fails on a routine Dependabot patch bump.

Possible Solution

$canSplitToArray = null === $linkParameter
    && 'query' === $in
    && 'array' === ($parameterSchema['type'] ?? null)
    && !str_ends_with($key, '[]');

Additional Context

Workaround: set castToArray: false on these parameters. The document then lists the key as written only (status[]). It has no runtime effect: in 4.4.3 and 5.0.2, ParameterParserTrait and ParameterValidationConstraints only act on castToArray: true.

Removing the brackets from the keys and setting castToArray: true also documents key[] only, but it changes runtime behaviour: a scalar value (status=lost) is then cast to an array and accepted, where it was rejected with a 422 before.

Activity

  1. added a commit that references this issue on Oct 5, 2026
    56c0be2
  2. soyuka commented on Oct 5, 2026

    @soyuka
    Member

    oups sorry about this! Please stay on 4.4.2 while we revert this and thanks for the heads up! I'll investigate this further (its hard to fix #8421 :/)

  3. added a commit that references this issue on Oct 6, 2026
    88fab3b
  4. soyuka commented on Oct 13, 2026

    @soyuka
    Member

    #8600 got reverted in #8637, it shipped in v4.4.4 and v5.0.3 so the OpenAPI document is back to key[]. Only a possible key[][] guard on 5.x remains, we'll track that separately if needed. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions