core
core copied to clipboard
fix: fix boolean parameters type detection
| Q | A |
|---|---|
| Branch? | 4.1 |
| Tickets | N/A |
| License | MIT |
| Doc PR | N/A |
Considering the following configuration:
new GetCollection(
// ...
parameters: [
'archivedOnly' => new QueryParameter(
key: 'archivedOnly',
schema: ['type' => 'boolean'],
required: true,
openApi: new Model\Parameter(
name: 'archivedOnly',
in: 'query',
required: true,
),
),
],
),
The current code only supports array or string types, then fallback to an array of strings (cf. ParameterResourceMetadataCollectionFactory line 160), which seems then considered to an iterable by the validator (All validator is applied, which expects an array as value), leading to the following error:
Symfony\Component\HttpClient\Exception\ClientException: An error occurred
archivedOnly: This value should be of type iterable.
Supporting boolean type here fixes this issue.