-
-
Notifications
You must be signed in to change notification settings - Fork 944
Open
Description
API Platform version(s) affected: 4.2.6
Description
After an upgrade to api-platform/core 4.2.6 our openapi query parameter definitions don't work as expected anymore
We get a validation error with style=form
How to reproduce
parameters: [
'tags' => new QueryParameter(
key: 'tags',
schema: [
'type' => 'array',
'items' => [
'type' => 'string',
'uniqueItems' => true,
'enum' => ['A', 'B', 'C'],
],
],
openApi: new Parameter(
'tags',
'query',
description: 'Only return activities with the given comma-seperated tag(s)',
required: false,
style: 'form',
explode: false,
example: 'A,B
),
nativeType: new BuiltinType(TypeIdentifier::ARRAY),
),
],
This is called with ?tags=A,B and throws this exception:
request.DEBUG: Uncaught PHP Exception ApiPlatform\Validator\Exception\ValidationException: "tags: This value should be of type array." at ParameterValidatorProvider.php line 98 {"exception":"[object] (ApiPlatform\\Validator\\Exception\\ValidationException(code: 0): tags: This value should be of type array. at .../vendor/api-platform/core/src/Symfony/Validator/State/ParameterValidatorProvider.php:98)
Possible Solution
Is there a way to get style=form serialization?
Metadata
Metadata
Assignees
Labels
No labels