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
During the runtime of a request on my app, I noticed that my ContextBuilder::createFromRequest was called 2 times to create the normalization context :
How to reproduce
Create a ContextBuilder or check out ContextBuilder's built-in
Possible Solution
I was wondering if we can in the SerializeProcessor, check whether the request attribute _api_normalization_context is already computed or not, to avoid a second call.
Normally the context calculation shouldn't change in the same runtime, but I may be missing something.
Additional Context
This may be intentional, in which case, another solution might be considered to leave the possibility of recomputing/caching or not the normalization context at the operation level or elsewhere to leave the choice to the user if a recomputing is necessary
The text was updated successfully, but these errors were encountered:
Oh yes, thanks, i had in mind the read option on the operation but had forgotten about it.
The legacy system with listeners does the same thing. I'll do a PR soon for both 😉
API Platform version(s) affected: 3.4
Description
During the runtime of a request on my app, I noticed that my ContextBuilder::createFromRequest was called 2 times to create the normalization context :
core/src/State/Provider/ReadProvider.php
Line 71 in fcd9a07
core/src/State/Processor/SerializeProcessor.php
Line 55 in fcd9a07
How to reproduce
Create a ContextBuilder or check out ContextBuilder's built-in
Possible Solution
I was wondering if we can in the SerializeProcessor, check whether the request attribute
_api_normalization_context
is already computed or not, to avoid a second call.Normally the context calculation shouldn't change in the same runtime, but I may be missing something.
Additional Context
This may be intentional, in which case, another solution might be considered to leave the possibility of recomputing/caching or not the normalization context at the operation level or elsewhere to leave the choice to the user if a recomputing is necessary
The text was updated successfully, but these errors were encountered: