Closed
Description
API Platform version(s) affected: 4.1.9
Description
Upgrading to api-platform/core 4.1.9 breaks query parameters with custom constraints that worked with 4.1.8. It looks like it is caused by PR #7134. QueryParameter with custom constraint results in "This value should be of type string." error unless you add the new nativeType parameter.
How to reproduce
#[ApiResource(
operations: [
new GetCollection(
provider: MyProvider::class,
parameters: [
'country' => new QueryParameter(schema: ['type' => 'string'], constraints: [new Country()]),
],
),
],
)]
final readonly class MyResource
{
}
To make it work again, you need to remove constraints -parameter or add nativeType parameter: new Type\BuiltinType(TypeIdentifier::STRING)
.
Possible Solution
Additional Context
Metadata
Metadata
Assignees
Labels
No labels