fix(serializer): empty object as array with supports cache #5100
Merged
Conversation
alanpoulain
reviewed
Oct 27, 2022
alanpoulain
reviewed
Oct 27, 2022
alanpoulain
reviewed
Oct 27, 2022
| if ('' === $operationName && \in_array($operation->getMethod() ?? HttpOperation::METHOD_GET, [HttpOperation::METHOD_GET, HttpOperation::METHOD_OPTIONS, HttpOperation::METHOD_HEAD], true) && ($forceCollection ? $isCollection : !$isCollection)) { | ||
| $method = $operation->getMethod() ?? HttpOperation::METHOD_GET; | ||
| $isGetOperation = HttpOperation::METHOD_GET === $method || HttpOperation::METHOD_OPTIONS === $method || HttpOperation::METHOD_HEAD === $method; | ||
| if ('' === $operationName && $isGetOperation && ($forceCollection ? $isCollection : !$isCollection)) { |
Member
There was a problem hiding this comment.
I'm taking this PR as an opportunity for a long time question I have: is adding an empty string as key in the operationCache a good idea?
Member
Author
There was a problem hiding this comment.
I need to prefix these, but yeah the representation of null as string would be an empty string ?
Member
There was a problem hiding this comment.
I'm not sure to follow: if we ask a null $operationName to this getOperation method, it means we don't know the operation name. It it is cached, the same operation is always returned, even if the other conditions have changed ($isGetOperation, $forceCollection...). It seems dangerous to me.
Member
Author
There was a problem hiding this comment.
Let's fix this in another patch then.
dunglas
reviewed
Oct 27, 2022
soyuka
force-pushed
the
fix/performance-issue
branch
from
November 9, 2022 08:08
300174b to
c0f7114
Compare
soyuka
force-pushed
the
fix/performance-issue
branch
from
November 9, 2022 09:11
c0f7114 to
9667823
Compare
alanpoulain
approved these changes
Nov 11, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
reverts #4999 and re-implement it