Documentation / @ember-data/json-api / request / serializePatch
ts
function serializePatch(cache, identifier): object;
Defined in: -private/serialize.ts:126
Serializes changes to a resource for use with PATCH requests.
Only attributes which are changed are serialized. Only relationships which are changed are serialized.
Collection relationships serialize the collection as a whole.
If you would like to serialize updates to a collection more granularly (for instance, as operations) request the diff from the store and serialize as desired:
ts
const relationshipDiffMap = cache.changedRelationships(identifier);
Parameters
cache
identifier
Returns
object
An object with a data
property containing the serialized resource patch
data
ts
data: JsonApiResourcePatch;