jsonapi-serializer icon indicating copy to clipboard operation
jsonapi-serializer copied to clipboard

Deserialize How get attributes of relationsship

Open rustam87 opened this issue 5 years ago • 1 comments

i have

"included": [
        {
            "type": "author",
            "id": "321321",
            "attributes": {
                "surname": "Nick",
                "name": "Joesn"
            },
new JSONAPIDeserializer({
  author: {
    valueForRelationship: function (relationship) {
      return {
        id: relationship.id,
     // There i have only id = 321321
    // How get  "surname" and  "name"
      };
    }
  }
})

rustam87 avatar Jun 21 '19 10:06 rustam87

i found

valueForRelationship: function (relationship, included) { return { id: relationship.id, name: included.name }; }

please, add it to doc, because it very important

rustam87 avatar Jun 21 '19 11:06 rustam87