It would be useful to allow a configuration object to be passed to .fetch() to indicate whether to opt-in to/-out of including related records in the json:api response. I see this as having one of two options:
related: true: include all relationships used in the model.
related: propName: include only the relationship mapped in the model property name specified.
related: [ propName1, propName2 ]: include only the relationships mapped in the model properties found in the array.
Additionally, an option to only include the attributes mapped in the model properties would be useful to cut down on server response size.
In both cases, it would be superb to set these options on a per-Model or even global manner with a fallback behavior that puts the closest indication first (.fetch() param first, then Model options, then global config). Pending #1, of course.
It would be useful to allow a configuration object to be passed to
.fetch()
to indicate whether to opt-in to/-out of including related records in thejson:api
response. I see this as having one of two options:related: true
: include all relationships used in the model.related: propName
: include only the relationship mapped in the model property name specified.related: [ propName1, propName2 ]
: include only the relationships mapped in the model properties found in the array.Additionally, an option to only include the attributes mapped in the model properties would be useful to cut down on server response size.
In both cases, it would be superb to set these options on a per-
Model
or even global manner with a fallback behavior that puts the closest indication first (.fetch()
param first, thenModel
options, then global config). Pending #1, of course.