-
Notifications
You must be signed in to change notification settings - Fork 422
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
Exclude data from relationships (unless included) #357
Comments
@ahx How are you handling this at the moment? |
@sumeetattree I am currently not using fast_jsonapi :/ |
@ahx Ah, damn. I just came across this library and this looks amazing on paper. Trying to move away from I am trying to rewrite the serializers without touching the old ones. So the idea is to run What would you recommend? |
Thank you. I'll take a look. |
@dpikt This does work to remove the need to return all IDs even if the relationship is not included, however when including the the relationship, the relationships block remains empty. EG. Here I have passed in include: [:packages]
I believe the spec requires the following, in addition to the "included" block
|
Yeah I noticed that... I was considering opening a new issue for it but I suppose this issue could work as a stand-in. Are you working on a PR for that @raldred? If not I might spin one up. |
I am not, only just arrived here due to coming across the issue. I will have a look into it further, unless you've made a start @dpikt ? |
I'll take a stab at it this week! |
PR opened! |
@dpikt Is there any updates according your PR above? |
As far as I know there hasn't been any action on the PR. The entire library seems to be in stasis at the moment (see #433), if things pick back up hopefully the PR will be included in that. |
Eagerly looking forward for this fix |
PR ported to community fork here: jsonapi-serializer/jsonapi-serializer#10 |
Resolved on community fork. |
This is re-opening #252, because AFAIK fast_jsonapi does not support this in the current version.
In our scenario it is a bit costly to fetch the ids of related resources. So not returning "data" for specific relations by default, but just "links" would great. The goal is to return something like this:
Returning a link (URL) to the related records is possible with fast_jsonapi, but excluding "data" is AFAIK not suppordet and not possible via with sparse fieldsets as mentioned in #252.
jsonapi-serializers does this via
has_many :comments, include_data: true
(false by default).The text was updated successfully, but these errors were encountered: