AshJason.Resource

View Source

Ash resource extension for implementing Jason.Encoder protocol.

jason

Configuration for Jason encoder implementation.

Nested DSLs

Options

NameTypeDefaultDocs
picklist(atom) | %{optional(:private?) => boolean, optional(:sensitive?) => boolean, optional(:include) => list(atom), optional(:exclude) => list(atom)}Keys to pick from a record into a result. Accepts an explicit names list or a behaviour configuration map.

jason.merge

merge values

A step to merge fixed values into a result.

Arguments

NameTypeDefaultDocs
valueslist({any, any}) | %{optional(any) => any}Values to merge into a result. Accepts a map or a tuples list.

jason.rename

rename renames

A step to rename keys in a result.

Arguments

NameTypeDefaultDocs
renameslist({any, any}) | %{optional(any) => any} | (any -> any)A mapping for renaming keys in a result. Accepts a map, a tuples list or a function.

jason.order

order sort

A step to reorder keys in a result.

Arguments

NameTypeDefaultDocs
sortboolean | (list(any) -> list(any)) | list(any)An order to apply to keys in json. Accepts a boolean, a sort function or a list of keys in a desired order.

jason.customize

customize fun

A step to arbitrary customize a result.

Arguments

NameTypeDefaultDocs
fun(list({any, any}), map -> list({any, any}))A function to customize a result with. Receives a result and a resource record.