-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
#[MapRequestPayload] Returns full ViolationsList if object cannot be created due to a single missing value (re-open) #53075
Comments
@HypeMC The result looks like this:
so yeah, it only validates the correct one, but the message is still wrong in my opinion. The hint should be displayed as the message. But it is better than before, thanks a lot :) |
@Havrin The message being incorrect is a hole different issue, see #52879. A similar thing should be done for symfony/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php Lines 380 to 386 in c468b5f
|
perfect, than I would say your fix is enough and in combination with the other issue, the user experience will be way better. Thanks! |
…(HypeMC) This PR was merged into the 6.3 branch. Discussion ---------- [HttpKernel] Don't validate partially denormalized object | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #53075 | License | MIT When one or more required constructor arguments are missing, the object is instantiated with `newInstanceWithoutConstructor()`: https://github.com/symfony/symfony/blob/0af28a02dbfabef351de8a739dee65830ed0271a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php#L415-L421 Since this means that all properties are empty, validating the entire object is unnecessary. This PR suggests avoiding the call to the validator when violations have already been identified through the `PartialDenormalizationException`. Commits ------- f9a0126 [HttpKernel] Don't validate partially denormalized object
Symfony version(s) affected
6.4
Description
Hey! I re create #50759 since a comment did not re-open it. Unfortunately, this is not fixed in the latest 6.4 Update.
How to reproduce
Updated the Project https://github.com/Havrin/symfony-payload-bug to 6.4 and tested again against
http://localhost/api/payload
with payload:Result (first object is a
var_dump
inisde the exception subscriber):The first Violation of Type
unknown
holds the correct message:"Failed to create object because the class misses the \"email\" property."
which should be returned instead of every assert/validation.Possible Solution
No response
Additional Context
Apologize if re creating a new ticket was not the right move. Feel free to close this and re open the other one.
The text was updated successfully, but these errors were encountered: