-
-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overriding groups at runtime does not work, or? #767
Comments
I see now that my quick-fix has some unwanted effects, but clearly it should be possible to also modify groups of the top level node. I haven't tried with child entities. |
hi, can you post some code of the expected result? I mean:
thanks |
Sorry for the delay. I was about to submit some non-working code examples, only to realize they were working... I have not been able to find the root cause of my issue yet, but it is a split between myself misreading the docs, and some strange things going on with willdurand\hateoas bundle. Essentially I was hoping for the group override functionality to also work on the object's own properties, and not just on deeper branches of the graph. I realize the behavior I am looking for can be achieved with custom exclusion strategies, so I will probably go down that route. |
For reference for anyone else experiencing issues with willdurand hateoas, jms serializer and embedded objects: It appears hateoas will serialize embedded objects by themselves, and then add the serialized data to the already serialized parent object. As such, there is no "deeper in the three"-logic to be applied by JMS. The serializer simply applies all its logic on that embedded object. |
I am trying to override the group for some properties at runtime, according to the documentation I can use the name of the property to assign new groups. The docs are not exactly clear on this point, but that is how I interpret it. I am however clearly doing something wrong, cause it doesn't work...
I have had a look at the
GroupsExclusionStrategy
and find it a bit strange. Does overriding groups even work now?I looks to me to be missing some logic at the very top of shouldSkipUsingGroups. I would have added someting like (tested and works):
Parts of the example in the documentation only work because there are no @group annotations assigned, so the prop becomes covered by the
Default
group by this logic.My use case is when combing specific field exclusion with specific views AND embedded entities. i.e., I am providing a default view of
shallow,
and need to show a property that normally would only be visible if&view=deep
was provided as aGET
param. Were it not for the embedded fields I could simply manually set the view todeep
, but that would cause my embedded classes to serialize with thedeep
view as well.I have tested with 1.5, 1.6 and 1.7.
The text was updated successfully, but these errors were encountered: