You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Hi! Sorry in advance if that issue is a duplicate (didn't find anything like it). What if we add new method in AbstractController to deserialize from json (opposite to AbstractController::json()) ? AbstractController already has lots of methods, but still this opertation seem to be routine one while developing APIs :)
Example
protected function fromJson(string $body, string $to, array $context = [])
{
// check if serializer available
// return deserialized value
}
...
public function createUser(Request $request)
{
$resource = $this->fromJson($request->getContent(), UserResource::class);
}
If OK, I would like to implement it.
WDYT? Thanks!
The text was updated successfully, but these errors were encountered:
#38224 was added recently which allows fetching the JSON content of the response as array. But as far as I know, there's no shortcut for fetching the response content normalized into an instance of a specific class. But I'm not sure if the AbstractController is the right place for that.
Description
Hi! Sorry in advance if that issue is a duplicate (didn't find anything like it). What if we add new method in AbstractController to deserialize from json (opposite to
AbstractController::json()
) ? AbstractController already has lots of methods, but still this opertation seem to be routine one while developing APIs :)Example
If OK, I would like to implement it.
WDYT? Thanks!
The text was updated successfully, but these errors were encountered: