@spec primary_key(resource_lookup(), atom()) :: [atom()]
Gets the primary key field names by resource module.
Generates a language-agnostic API specification from Ash resources and actions.
Given a list of {resource, action_name} tuples or an OTP app, traverses the
type graph to find all reachable resources and types, producing structured IR
(Elixir structs) that can also be serialized to JSON.
%Operator{}.name is the user-facing symbol that appears in
Ash.Query.filter expressions (e.g. :==, :<, :in). The
%Operator{}.aliases list carries internal/legacy module-derived names
(e.g. :eq, :less_than) for backward-compatible rendering. New code
should prefer name; alias-substitution is for tools that historically
rendered the module-derived spelling.
Builds an action lookup map from the spec, keyed by {resource_module, action_name}.
Returns the resolved %ApplicableCustomExpression{} list for {resource_module, field_name}.
See applicable_filter_operators/2 for behavior.
Returns the resolved %ApplicableFunction{} list for {resource_module, field_name}.
See applicable_filter_operators/2 for behavior.
Returns the resolved %ApplicableOperator{} list for {resource_module, field_name}.
Builds a custom-expression lookup map from the spec, keyed by expression name atom.
Builds a function lookup map from the spec, keyed by function name atom.
Generate an API specification for the given OTP app.
Generates a spec and returns the resource lookup map directly.
Gets an action by resource module and action name from an action lookup.
Gets a field by resource module and field name.
Gets a field or relationship by name, checking fields first.
Gets an identity by resource module and identity name.
Gets a relationship by resource module and relationship name.
Looks up a resource by module. Returns nil if not found.
Looks up a resource by module. Raises if not found.
Looks up a named type's full definition by module. Returns nil if not found.
Looks up a named type's full definition by module. Raises if not found.
Checks if a resource exists in the lookup.
Builds an operator lookup map from the spec, keyed by operator name atom.
Gets the primary key field names by resource module.
Builds a resource lookup map from the spec, keyed by resource module.
The schema version of the manifest's JSON serialization format.
Builds a type lookup map from the spec, keyed by named type module.
@type action_lookup() :: %{required({atom(), atom()}) => Ash.Info.Manifest.Action.t()}
@type resource_lookup() :: %{required(atom()) => Ash.Info.Manifest.Resource.t()}
@type t() :: %Ash.Info.Manifest{ custom: map(), entrypoints: [Ash.Info.Manifest.Entrypoint.t()], filter_capabilities: Ash.Info.Manifest.FilterCapabilities.t() | nil, resources: [Ash.Info.Manifest.Resource.t()], sort_capabilities: Ash.Info.Manifest.SortCapabilities.t() | nil, types: [Ash.Info.Manifest.Type.t()] }
@type type_lookup() :: %{required(atom()) => Ash.Info.Manifest.Type.t()}
@spec action_lookup(t()) :: action_lookup()
Builds an action lookup map from the spec, keyed by {resource_module, action_name}.
@spec applicable_filter_custom_expressions( t(), {atom(), atom()} ) :: [Ash.Info.Manifest.ApplicableCustomExpression.t()]
Returns the resolved %ApplicableCustomExpression{} list for {resource_module, field_name}.
See applicable_filter_operators/2 for behavior.
@spec applicable_filter_functions( t(), {atom(), atom()} ) :: [Ash.Info.Manifest.ApplicableFunction.t()]
Returns the resolved %ApplicableFunction{} list for {resource_module, field_name}.
See applicable_filter_operators/2 for behavior.
@spec applicable_filter_operators( t(), {atom(), atom()} ) :: [Ash.Info.Manifest.ApplicableOperator.t()]
Returns the resolved %ApplicableOperator{} list for {resource_module, field_name}.
Returns [] when the field exists but is not filterable. Raises if the
resource or field is unknown.
@spec custom_expression_lookup(t()) :: %{ required(atom()) => Ash.Info.Manifest.CustomExpression.t() }
Builds a custom-expression lookup map from the spec, keyed by expression name atom.
@spec function_lookup(t()) :: %{required(atom()) => Ash.Info.Manifest.Function.t()}
Builds a function lookup map from the spec, keyed by function name atom.
Generate an API specification for the given OTP app.
:otp_app - The OTP app to scan for Ash domains and resources (required):action_entrypoints - Optional list of {resource_module, action_name} tuples
used as entrypoints for deriving the spec. When omitted, all public actions
across all domains are included.@spec generate_resource_lookup(keyword()) :: {:ok, resource_lookup()} | {:error, term()}
Generates a spec and returns the resource lookup map directly.
@spec get_action(action_lookup(), atom(), atom()) :: Ash.Info.Manifest.Action.t() | nil
Gets an action by resource module and action name from an action lookup.
@spec get_field(resource_lookup(), atom(), atom()) :: Ash.Info.Manifest.Field.t() | nil
Gets a field by resource module and field name.
@spec get_field_or_relationship(resource_lookup(), atom(), atom()) :: Ash.Info.Manifest.Field.t() | Ash.Info.Manifest.Relationship.t() | nil
Gets a field or relationship by name, checking fields first.
Returns %Ash.Info.Manifest.Field{}, %Ash.Info.Manifest.Relationship{}, or nil.
@spec get_identity(resource_lookup(), atom(), atom()) :: %{keys: [atom()]} | nil
Gets an identity by resource module and identity name.
@spec get_relationship(resource_lookup(), atom(), atom()) :: Ash.Info.Manifest.Relationship.t() | nil
Gets a relationship by resource module and relationship name.
@spec get_resource(resource_lookup(), atom()) :: Ash.Info.Manifest.Resource.t() | nil
Looks up a resource by module. Returns nil if not found.
@spec get_resource!(resource_lookup(), atom()) :: Ash.Info.Manifest.Resource.t()
Looks up a resource by module. Raises if not found.
@spec get_type(type_lookup(), atom()) :: Ash.Info.Manifest.Type.t() | nil
Looks up a named type's full definition by module. Returns nil if not found.
@spec get_type!(type_lookup(), atom()) :: Ash.Info.Manifest.Type.t()
Looks up a named type's full definition by module. Raises if not found.
A miss indicates a reachability bug: the type was referenced via :type_ref
somewhere in the type graph but was never registered during spec generation.
Reachability analysis (Ash.Info.Manifest.Generator.Reachability) should have
collected it as a standalone type.
@spec has_resource?(resource_lookup(), atom()) :: boolean()
Checks if a resource exists in the lookup.
@spec operator_lookup(t()) :: %{required(atom()) => Ash.Info.Manifest.Operator.t()}
Builds an operator lookup map from the spec, keyed by operator name atom.
Returns an empty map when filter_capabilities is nil.
@spec primary_key(resource_lookup(), atom()) :: [atom()]
Gets the primary key field names by resource module.
@spec resource_lookup(t()) :: resource_lookup()
Builds a resource lookup map from the spec, keyed by resource module.
@spec schema_version() :: String.t()
The schema version of the manifest's JSON serialization format.
Bumped when the JSON output schema in Ash.Info.Manifest.JsonSerializer
changes in a way downstream tools need to detect.
@spec type_lookup(t()) :: type_lookup()
Builds a type lookup map from the spec, keyed by named type module.
Each entry is the fully-resolved %Ash.Info.Manifest.Type{} for a named type
(Ash.Type.Enum implementations and Ash.Type.NewType subtypes) referenced
somewhere in the reachable type graph.