The root cause of the deserialization error remain hidden on API output
API Platform version(s) affected: 4.0.4
Description
If \ApiPlatform\State\Provider\DeserializeProvider::provide() throws an error, I only get the message "An error occurred" alongside the "trace", but it doesn't specify what the actual issue is.
If I catch it here and print it out, it turns out that the message is "Update is not allowed for this operation."
\ApiPlatform\State\Provider\DeserializeProvider
How to reproduce
Throw an exception in \ApiPlatform\State\Provider\DeserializeProvider::provide().
Possible Solution
Add #[Groups(['jsonld', 'jsonproblem', 'jsonapi'])] attribute to ApiResource/Error::getDescription() method.
ApiResource/Error
#[SerializedName('description')]
#[Groups(['jsonld', 'jsonproblem', 'jsonapi'])]
public function getDescription(): string
{
return $this->detail;
}
Result:
description is only for JSON-LD, detail should always be available though.
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.