AshR2RML.Introspection.Manifest (AshR2RML v26.8.29)

Copy Markdown View Source

Thin, real wrapper around Ash.Info.manifest/1 (Ash >= 3.25) for tooling and ggen-pack generation that needs a resource/field/relationship lookup keyed by module, rather than re-deriving that shape via ad hoc Ash.Resource.Info.* calls.

AshR2RML.Compiler's mapping-IR pipeline (AshR2RML.Introspection, AshR2RML.Alignment, etc.) is untouched by this module -- it keeps its existing direct Ash.Resource.Info introspection, which is per-resource and does not need a whole-application manifest. This module exists for the separate, additive use case of application-wide tooling (docs generation, ggen pack scaffolding, debugging) that wants a single resource-lookup map across every domain/resource reachable from an :ash_domains application config, or from an explicit action-entrypoint list when no :ash_domains config is present (e.g. a library's own test app, or a one-off script).

Refuses with a typed AshR2RML.Refusal (:REFUSED_MANIFEST_GENERATION) rather than propagating Ash.Info.Manifest.generate/1's raw {:error, term()} shape, consistent with the rest of AshR2RML's refusal vocabulary.

Summary

Functions

Looks up a single resource's manifest entry by module, given an already-built resource_lookup/0 map.

Generates a manifest for otp_app (or the given :action_entrypoints, which bypass the :ash_domains application-config lookup entirely) and returns it wrapped in {:ok, %Ash.Info.Manifest{}}.

Generates a manifest and returns its resource_lookup/1 map directly (module => %Ash.Info.Manifest.Resource{}).

Types

resource_lookup()

@type resource_lookup() :: Ash.Info.Manifest.resource_lookup()

Functions

fetch_resource(lookup, resource_module)

@spec fetch_resource(resource_lookup(), module()) ::
  Ash.Info.Manifest.Resource.t() | nil

Looks up a single resource's manifest entry by module, given an already-built resource_lookup/0 map.

Returns nil when the resource is not reachable from the manifest that produced lookup (e.g. it belongs to a different :ash_domains config, or was excluded by an :action_entrypoints filter).

generate(opts)

@spec generate(keyword()) ::
  {:ok, Ash.Info.Manifest.t()} | {:error, AshR2RML.Refusal.t()}

Generates a manifest for otp_app (or the given :action_entrypoints, which bypass the :ash_domains application-config lookup entirely) and returns it wrapped in {:ok, %Ash.Info.Manifest{}}.

Options

  • :otp_app - required. The OTP app to scan for Ash domains/resources.
  • :action_entrypoints - optional [{resource_module, action_name}] list. When given, only those actions (and the resources/types they reach) are included, regardless of :ash_domains config.

resource_lookup(opts)

@spec resource_lookup(keyword()) ::
  {:ok, resource_lookup()} | {:error, AshR2RML.Refusal.t()}

Generates a manifest and returns its resource_lookup/1 map directly (module => %Ash.Info.Manifest.Resource{}).