Jido.Exec.Validator (Jido Action v2.3.0)

View Source

Provides validation functions for Jido.Exec module.

This module contains validation logic for actions, parameters, and outputs that has been extracted from the main Exec module for better separation of concerns.

Summary

Functions

Validates that the given action module is valid and can be executed.

Validates output from an action using the action's validate_output/1 function if present.

Validates parameters for the given action using the action's validate_params/1 function.

Functions

validate_action(action)

@spec validate_action(module()) :: :ok | {:error, Exception.t()}

Validates that the given action module is valid and can be executed.

Checks that the module can be compiled and has the required run/2 function.

validate_output(action, output, opts)

@spec validate_output(module(), map(), keyword()) ::
  {:ok, map()} | {:error, Exception.t()}

Validates output from an action using the action's validate_output/1 function if present.

If the action doesn't have a validate_output/1 function, validation is skipped.

validate_params(action, params)

@spec validate_params(module(), map()) :: {:ok, map()} | {:error, Exception.t()}

Validates parameters for the given action using the action's validate_params/1 function.

Returns validated parameters on success or an error if validation fails.