Skip to content
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

relationships remains empty when using sparse fieldsets (fields in query) #439

Open
everlast240 opened this issue Aug 12, 2019 · 2 comments

Comments

@everlast240
Copy link

When include is used to include related documents (compound document) and you also have sparse fieldsets (you filter returned attributes with the fields parameter), the relationships attribute of the root resource remains empty.
This is rather confusing because this way you have no way how to link the root resources (if multiple) to their corresponding included related resources..
I've identified the issue to come from here:
https://github.com/Netflix/fast_jsonapi/blob/master/lib/fast_jsonapi/serialization_core.rb#L54
It works as expected if that line is commented out...
Now I see a related issue: #304 - according to which there is a way to trick / work around this:

you must specify associations in the fields option if you want fast_jsonapi to populate the relationships hash appropriately

But I'm not sure if this is the JSONAPI v1 compliant way ...

So, if this is not considered a bug, maybe some documentation improvements should make this clear.

@everlast240
Copy link
Author

See also: a363c90b#commitcomment-34658281

@kapilnarula
Copy link

It seems Netflix has abandoned this project. The community created a new fork to continue supporting this project. Please refer https://github.com/fast-jsonapi/fast_jsonapi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants