Ash.Info.Manifest.Generator.TypeResolver (ash v3.25.0)

Copy Markdown View Source

Resolves Ash types into %Ash.Info.Manifest.Type{} structs.

Handles all Ash type variants: primitives, NewTypes, arrays, enums, unions, embedded resources, structs, maps, keywords, tuples, and custom types.

Summary

Functions

Returns true if the given type is a named type module (Ash.Type.Enum or Ash.Type.NewType).

Resolve an Ash type and its constraints into an %Ash.Info.Manifest.Type{}.

Resolve a named type module into its full definition for spec.types.

Functions

named_type_module?(type)

@spec named_type_module?(term()) :: boolean()

Returns true if the given type is a named type module (Ash.Type.Enum or Ash.Type.NewType).

resolve(type, constraints \\ [])

@spec resolve(term(), term()) :: Ash.Info.Manifest.Type.t()

Resolve an Ash type and its constraints into an %Ash.Info.Manifest.Type{}.

Named type modules (Ash.Type.Enum implementations and Ash.Type.NewType subtypes) are resolved as kind: :type_ref references. Use resolve_definition/1 to get the full type definition for spec.types.

resolve_definition(type_module)

@spec resolve_definition(atom()) :: Ash.Info.Manifest.Type.t()

Resolve a named type module into its full definition for spec.types.

Unlike resolve/2, which emits kind: :type_ref for named type modules, this function expands the top-level type. Nested named type references within the definition still become :type_ref.