Surgex.Parser.IncludeParser (Surgex v4.3.0) View Source

Parses the JSON API's include parameter according to the JSON API spec.

Produces a list of includes constrained to the provided relationship paths.

Link to this section Summary

Functions

Flattens the result of the parser (inclusion list) into multiple keys.

Link to this section Functions

Specs

flatten({:ok, Keyword.t()}, String.t()) :: {:ok, Keyword.t()}

Flattens the result of the parser (inclusion list) into multiple keys.

Examples

iex> IncludeParser.flatten({:ok, include: [:user]}, :include)
{:ok, include_user: true}