Ash.Info.Manifest.Generator.Reachability (ash v3.25.1)

Copy Markdown View Source

Discovers all reachable resources and standalone types by traversing the type graph starting from a set of root resources.

Returns results in depth-first discovery order: dependencies appear before the resources that reference them. This ordering is important for consumers that need to declare types before they are referenced (e.g., Zod schema generation).

Handles cycle detection via a visited set to prevent infinite recursion.

Summary

Functions

Find all resources and standalone types reachable from the given resource modules.

Functions

find_reachable(resource_entries, opts \\ [])

@spec find_reachable(
  [atom() | {atom(), [atom()]}],
  keyword()
) :: {[atom()], [atom()]}

Find all resources and standalone types reachable from the given resource modules.

Accepts either:

  • A list of resource modules (traverses all fields, relationships, and public action arguments)
  • A list of {resource_module, [action_name]} tuples (only traverses arguments of specified actions)

Visibility Options

  • :include_private_attributes? - Traverse private attributes (default: false)
  • :include_private_calculations? - Traverse private calculations (default: false)
  • :include_private_aggregates? - Traverse private aggregates (default: false)
  • :include_private_relationships? - Traverse private relationships (default: false)
  • :include_private_arguments? - Traverse private action arguments (default: false)
  • :include_private_actions? - Traverse private actions (default: false). Private actions are skipped during reachability even when their names are explicitly listed, so types referenced only from them don't end up in the manifest.

Returns {reachable_resources, standalone_types} where both are lists of modules in depth-first discovery order (dependencies before dependents).