core
core copied to clipboard
feat(Serializer): update MissingConstructorArgumentsException message
| Q | A |
|---|---|
| Branch? | main |
| License | MIT |
Accidentally have closed https://github.com/api-platform/core/pull/5649 PR This is its copy.
Have found that if validation attributes are specified on DTOs or if the Valid() constraint is used on not api-resource property (just an entity in example) then Symfony's AbstractNormalizer is used and it has a bit different MissingConstructorArgumentsException exception message that also contains the list of missed arguments.
But in ApiPlatform this exception has another message and it contains only the first one of missed arguments in it.
This way someone, who relies on this message, in example, to convert it to something like validation error in the response, will get different messages.
So I want to suggest to make this message and its parameters consistent with Symfony's one.
The example of the new message:
Cannot create an instance of "App\Entity\Book" from serialized data because its constructor requires the following parameters to be present : "$author", "$name".
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@dunglas 👋
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
up
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
thanks!