AshJsonApi.Resource.Info (ash_json_api v1.6.0-rc.1)

Copy Markdown View Source

Introspection helpers for AshJsonApi.Resource

Summary

Functions

Returns the argument_names config for the resource: a keyword list, a 2-arity function, or one of the atoms :camelize / :dasherize (resolved to the corresponding function).

Converts an Ash argument atom name to its JSON:API string key, applying any argument_names mapping configured on the resource for the given action.

Returns the field_names config for the resource: a keyword list, a 1-arity function, or one of the atoms :camelize / :dasherize (resolved to the corresponding function).

Converts an Ash atom field name (attribute, calculation, aggregate) to its JSON:API string key, applying any field_names mapping configured on the resource.

Returns a ref transformer function suitable for the :ref_transformer option of Ash.Filter.parse_input/3 and Ash.Query.filter_input/3. The returned function maps user-facing JSON:API field/argument names back to their internal Ash atom names using the resource's field_names and argument_names configuration.

Converts a JSON:API string key to an Ash argument atom name for the given action, applying the reverse of any argument_names mapping. Returns nil if not found.

Converts a JSON:API string key to an Ash argument atom name for the given calculation, applying the reverse of any argument_names mapping. Returns nil if not found.

Converts a JSON:API string key to an Ash atom field name, applying the reverse of any field_names mapping configured on the resource. Returns nil if not found.

Functions

action_names_in_schema(resource)

always_include_linkage(resource)

argument_names(resource)

Returns the argument_names config for the resource: a keyword list, a 2-arity function, or one of the atoms :camelize / :dasherize (resolved to the corresponding function).

argument_to_json_key(resource, action_name, arg_name)

Converts an Ash argument atom name to its JSON:API string key, applying any argument_names mapping configured on the resource for the given action.

base_route(resource)

default_fields(resource)

derive_filter?(resource)

derive_sort?(resource)

field_names(resource)

Returns the field_names config for the resource: a keyword list, a 1-arity function, or one of the atoms :camelize / :dasherize (resolved to the corresponding function).

field_to_json_key(resource, field_name)

Converts an Ash atom field name (attribute, calculation, aggregate) to its JSON:API string key, applying any field_names mapping configured on the resource.

filter_ref_transformer()

Returns a ref transformer function suitable for the :ref_transformer option of Ash.Filter.parse_input/3 and Ash.Query.filter_input/3. The returned function maps user-facing JSON:API field/argument names back to their internal Ash atom names using the resource's field_names and argument_names configuration.

include_nil_values?(resource)

includes(resource)

json_key_to_argument(resource, action_name, json_key)

Converts a JSON:API string key to an Ash argument atom name for the given action, applying the reverse of any argument_names mapping. Returns nil if not found.

json_key_to_calculation_argument(resource, calc_name, json_key)

Converts a JSON:API string key to an Ash argument atom name for the given calculation, applying the reverse of any argument_names mapping. Returns nil if not found.

json_key_to_field(resource, json_key)

Converts a JSON:API string key to an Ash atom field name, applying the reverse of any field_names mapping configured on the resource. Returns nil if not found.

paginated_includes(resource)

primary_key_delimiter(resource)

primary_key_fields(resource)

routes(resource, domain_or_domains \\ [])

type(resource)