View Source JSONAPI.Serializer (jsonapi v1.8.3)
Serialize a map of data into a properly formatted JSON API response object
Summary
Functions
Given the relationship config entry provided by a JSONAPI.View, produce the extrapolated config tuple containing
Takes a view, data and a optional plug connection and returns a fully JSONAPI Serialized document. This assumes you are using the JSONAPI.View and have data in maps or structs.
Types
@type document() :: map()
Functions
build_relationships(conn, arg, relationship_name, rel_data, rel_view, acc, options)
View Source@spec encode_relationships(Plug.Conn.t(), document(), tuple(), list()) :: tuple()
Given the relationship config entry provided by a JSONAPI.View, produce the extrapolated config tuple containing:
- The name of the relationship to be used when serializing
- The key in the data the relationship is found under
- The relationship resource's JSONAPI.View module
- A boolean for whether the relationship is included by default or not
@spec serialize( JSONAPI.View.t(), JSONAPI.View.data(), Plug.Conn.t() | nil, JSONAPI.View.meta() | nil, JSONAPI.View.options() ) :: document()
Takes a view, data and a optional plug connection and returns a fully JSONAPI Serialized document. This assumes you are using the JSONAPI.View and have data in maps or structs.
Please refer to JSONAPI.View
for more information. If you are in interested in relationships
and includes you may also want to reference the JSONAPI.QueryParser
.