AshPhoenixGenApi.Verifiers.VerifyActionConfigs
(ash_phoenix_gen_api v1.0.3)
Copy Markdown
View Source
Verifier for the gen_api section of AshPhoenixGenApi.Resource.
This verifier performs compile-time validation of the PhoenixGenApi action configurations defined in an Ash resource's DSL. It checks:
Action existence — Every
actionentity references an Ash action that actually exists on the resource.Request type uniqueness — No two actions in the same resource share the same
request_type(either explicit or auto-derived).Arg consistency — When both
arg_typesandarg_ordersare explicitly provided, their keys must match exactly.Permission arg existence — When
check_permissionis set to{:arg, "arg_name"}, the argument must exist in either the explicitarg_typesor the Ash action's accepted attributes/arguments.MFA validity — When an explicit
mfais provided, the module must be loaded (or the function must exist if the module is loaded).Permission callback validity — When
permission_callbackis provided, it must be a valid MFA tuple{module, function, args}where module and function are atoms and args is a list, ornil.
Error Messages
The verifier raises Spark.Error.DslError with descriptive messages
and the path to the offending configuration, making it easy to locate
and fix issues.