AshGrant.Verifiers.ValidateResolverPresent (AshGrant v0.20.0)

Copy Markdown View Source

Spark DSL verifier that warns at compile time when neither the resource nor its domain defines a resolver.

Why a verifier (warning) and not a transformer (error)?

Reading the domain's DSL from a resource transformer creates a compile-time cycle when the domain also has code_interface entries: the resource needs the domain compiled to read its config, and the domain needs the resource compiled to wire the code_interface. A verifier runs after the module is compiled so it can safely reach into the domain without the cycle.

Spark converts verifier errors to compile warnings (see Spark.Dsl.Verifier and the catch in Spark.Dsl.__verify_spark_dsl__/1), so this check cannot fail the build — the compile warning surfaces during mix compile, and a runtime guard in AshGrant.Check.resolve_permissions/3 raises a clear error if authorization is attempted without a resolver.