NAME
JSONAPI::Document::Builder::Compound - Compound Resource Document builder
VERSION
version 2.3
DESCRIPTION
Builds a compound resource document, which is essentially a resource document with all of its relationships and attributes.
relationships
ArrayRef of relationships to include. This is populated by the include
param of a JSON API request.
primary_relationships, nested_relationships
Primary relationships are those belonging directly to row
, while nested relationships is an ArrayRef of HashRefs as follows:
[ { primary_related => [qw/primary relationships for primary_related/] }, { ... } ]
Where primary_related is the relationship for row
, and its associated ArrayRef contains relationships for it.
build_document : HashRef
Builds a HashRef for the primary resource document.
When relationships
is populated, will include a relationships entry in the document, populated with related links and identifiers.
build_relationships : ArrayRef
Builds an ArrayRef containing all given relationships. These relationships are built with their attributes.
build_nested_relationship(Str $primary, Str $relationship, ArrayRef $fields, HashRef $options?) : Array
Uses build_relationship with the rows related resource as the row
argument so the builder can find the relationship.