Skip to main content

Module document

Module document 

Source
Expand description

Helpers for writing VersionChange transforms over JSON:API documents and plain JSON.

Functions§

add_attribute
Adds an attribute where it is missing, such as one a newer version removed.
map_attributes
Applies a callback to the attributes of each resource whose type is listed (or every resource when types is empty). A plain JSON object counts as one resource’s attributes.
remove_attribute
Removes an attribute of the listed resource types.
rename_attribute
Renames an attribute of the listed resource types, and moves error pointers that name it, so /data/attributes/full_name becomes /data/attributes/name and /full_name becomes /name.
rename_key
Renames a key in place, keeping the order of the keys.
types
The resource types in a JSON:API document, in data and included.