Directly construct a relationship
SchemaError when rawData
does not look like a JSON:API relationship object
The document that contains the relationship
The JSON:API relationship object from which to construct the relationship
The context to use to fetch related documents
Private
Readonly
contextThe context to use to fetch related documents
Private
Readonly
rawThe JSON:API relationship object from which to construct the relationship
Private
Readonly
referringThe document that contains the relationship
One or many ResourceIdentifierObjects defined in the data
member of this relationship
true
if the relationship only contains a meta
member and no data
or links
The one Resource referenced by this relationship.
Resource linkage (the resource identifier found in the data
member of this relationship) has priority.
If there is no resource linkage, the primary resource found in relatedDocument is used.
CardinalityError if there are many resources.
SchemaError if neither a links
nor a data
member is present
Works like the resource method, but prefers the related
link instead of resource linkage.
If no related
link is present or if the link does not work, it falls back to the resource method.
CardinalityError if there are many resources.
SchemaError if neither a links
nor a data
member is present
List of Resources referenced by this relationship (if there are many resources).
Resource linkage (resource identifiers found in the data
member of this relationship) has priority.
If there is no resource linkage, the primary resources found in relatedDocument are used.
CardinalityError if there is only a singular resource.
SchemaError if neither a links
nor a data
member is present
Works like the resources method, but prefers the related
link instead of resource linkage.
If no related
link is present or if the link does not work, it falls back to the resources method.
CardinalityError if there is only a singular resource.
SchemaError if neither a links
nor a data
member is present
Generated using TypeDoc
Defines relations from one Resource to another (included in the document or external) and can resolve them.
This class is normally not used directly. It is used internally in the relatedResource, relatedResources and relatedDocuments accessors and you should use those if you just want to gain access to other resources.
If you need to work with relationships directly (e.g. to obtain meta data about the relationship itself), you can use the relationships accessor.
Remarks
Methods and accessors marked as
memoized
are only executed once per instance (the first time they are called) and return a cached result on subsequent calls.See
https://jsonapi.org/format/1.0/#document-resource-object-relationships