Skip to content

[JsonApiSerializer] A way to return requested realtionship without attributes and links #519

@Insolita

Description

@Insolita

Even if we transform data as

   transform($data){
       return ['id' => $data['id']];
  }

the response will contain empty attributes object and link object with self-link
like

 "data" : {
            "type":       "users" ,
            "id":         "55" ,
            "attributes": { } ,
            "links":      {
                "self": "http://127.0.0.1:80/users/55"
            }
        }

There is no way to receive a simple response for request like /articles/1/relationships/author
r like in examples https://jsonapi.org/format/#fetching-relationships

 "data" : {"type":  "users" , "id":   "55" }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions