Skip to content

Exclude data from relationships (unless included) #357

Open
@ahx

Description

@ahx

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:

"attributes": {
  ...
},
"relationships": {
  "comments": {
    "links": {
      "related": "http://localhost/api/v1/users/1/comments"
    }
},

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions