Ash.Info.Manifest.Validators (ash v3.25.0)

Copy Markdown View Source

Validation helpers for resources and actions that are exposed via a public-facing API (e.g. AshTypescript RPC, AshJsonApi routes, AshGraphql mutations).

These checks describe rules that hold for any public API surface and are enforced by Ash.Info.Manifest.Generator when building a spec, so every extension that consumes the spec gets the same guarantees.

Summary

Functions

Returns :ok if every attribute in action's accept list is public?: true on resource. Returns {:error, non_public_attrs} otherwise.

Raises Ash.Info.Manifest.Error.NonPublicAccept if action's accept list contains any non-public attributes on resource. Used by Ash.Info.Manifest.Generator to enforce the public-surface invariant when building entrypoints.

Functions

validate_accept_public(resource, action)

@spec validate_accept_public(atom(), map()) :: :ok | {:error, [atom()]}

Returns :ok if every attribute in action's accept list is public?: true on resource. Returns {:error, non_public_attrs} otherwise.

action may be an Ash action struct, an %Ash.Info.Manifest.Action{}, or any map with an :accept key. An empty or absent accept list is :ok.

validate_entrypoint!(resource, action)

@spec validate_entrypoint!(atom(), map()) :: :ok

Raises Ash.Info.Manifest.Error.NonPublicAccept if action's accept list contains any non-public attributes on resource. Used by Ash.Info.Manifest.Generator to enforce the public-surface invariant when building entrypoints.