-
Notifications
You must be signed in to change notification settings - Fork 507
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
fix: Nested objects are empty in some cases when using serialization groups #1746
Comments
Hello, It is hard to tell with all the nestJs decorator in place :) If you could write these results I think we can figure out what might cause the problem :) Do you know the exact options that the instanceToPlain will be called with? |
Hello, and thanks for your answer ! I did those tests, here are the results :
I tried to display the user object before serializing it, and it indeed has the workspaces with the correct ids
I did, and if I remove all the groups from the
Yes, it contains only the group(s) specified in the |
Thank you for the checks. Could you please try to use the same groups, but only use 'Expose()' with no groups on the Workspace.id. My guess is that the type does not forward the group correctly for nested objects. |
I tried it just now, if I only use |
Is it an acceptable solution for your use case? |
Hello again and sorry for answering this late 🙏 It will do for now but may I ask you to keep me informed if this bug is taken care of ? 😄 In any case, thank you for your help ! |
I'm facing this issue too, thank you for reporting it 👍 |
Description
disclaimer : I'm using NestJS but I don't think the issue is related
When trying to serialize an object using
instanceToPlain
with serialization groups and a nested object, sometimes the nested object is emptyand in the controller :
I skipped a lot of code for the example
Expected behavior
I would expect my User object to be serialized like this :
Actual behavior
The nested objects are empty :
The text was updated successfully, but these errors were encountered: