Skip to content

MapRequestPayload and array type hint #60764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
now-mar opened this issue Jun 11, 2025 · 0 comments
Open

MapRequestPayload and array type hint #60764

now-mar opened this issue Jun 11, 2025 · 0 comments

Comments

@now-mar
Copy link

now-mar commented Jun 11, 2025

Description

I've noticed that MapRequestPayload cannot handle the array type hint.

Request payload:

[{"field": "value1"}, {"field": "value2"}]
public function someAction(
  #[MapRequestPayload]
  /** @param ItemDto[] $items */
  array $items
) {}

This is because the $type parameter passed to Serializer::denormalize() in RequestPayloadValueResolver is taken from ArgumentMetadata and the type there is taken from \ReflectionParameter so no DocBlocks are considered.

I was checking out if I can override the type with a serializer's context options (you can pass that to MapRequestPayload attribute) but it looks like it's not possible.

Example

No response

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

No branches or pull requests

2 participants