Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpKernel] Add option to map empty data with MapQueryString and MapRequestPayload #52134

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
wants to merge 1 commit into
base: 7.3
Choose a base branch
Loading
from

Conversation

Jeroeny
Copy link
Contributor

@Jeroeny Jeroeny commented Oct 18, 2023

Q A
Branch? 6.4
Bug fix? no
New feature? yes
Deprecations? no
License MIT

It would be nice if the RequestPayloadValueResolver could optionally call the serializer->denormalize method regardless if $request->query, $request->request or $request->getContent() is empty.

Because if a DTO/request has optional arguments combined with some system-provided arguments, the data could be empty while the controller may still require this DTO class.

Also in cases where there are only required arguments, it is beneficial for the user to see which request arguments are needed. The PartialDenormalizationException may show this.

For example:

Where the $userId is provided by a custom normalizer that retrieves it from the Symfony Security User object. If $name isn't passed in the request, the class won't be constructed.

class GetUserQuery {
    __construct(private Uuid $userId, private ?string $name = null) {}
}

…for always attempting denormalization with empty query and request payload
Copy link
Contributor

@Victor-Truhanovich Victor-Truhanovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is excellent, necessary and useful pull request

@Victor-Truhanovich
Copy link
Contributor

@nicolas-grekas May I know when this PR will be accepted and merged?

@xabbuh xabbuh modified the milestones: 7.1, 7.2 May 15, 2024
@fabpot fabpot modified the milestones: 7.2, 7.3 Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.