AmpersandJSONAPIModel is a JSON-API-compatible extension of the AmpersandJS Model.
It achieves this JSON-API compatibility by overriding select methods within ampersand-model and adding appropriate HTTP headers to requests.
npm install ampersand-jsonapi-model
Except as described below, AmpersandJSONAPIModel has the same interface as AmpersandModel and AmpersandState.
To ensure this, AmpersandJSONAPIModel passes all tests for AmpersandModel (version 6.0.2).
The following methods have been overridden:
This adds additional options for returning children
and collections
along
with the standard session
, props
, and derived
options.
This has been augmented to parse JSON-API formatted data: specifically a
format in which model attributes are nested within the structure
{ data: { attributes: {} } }
.
This has been augmented in order to handle the special structure and additional relationship data included in saving to a JSON-API-compatible server.
This has been augmented in order to serialize data into the correct format expected by JSON-API.