# `Reactor.Argument`
[🔗](https://github.com/ash-project/reactor/blob/main/lib/reactor/argument.ex/#L6)

A step argument.

# `options`

```elixir
@type options() :: [description: nil | String.t(), transform: transform()]
```

# `t`

```elixir
@type t() :: %Reactor.Argument{
  description: nil | String.t(),
  name: atom(),
  source: Reactor.Template.t(),
  transform: transform()
}
```

# `transform`

```elixir
@type transform() :: nil | (any() -&gt; any()) | {module(), keyword()} | mfa()
```

# `from_element`

```elixir
@spec from_element(any(), any(), nil | (any() -&gt; any()) | options()) :: t()
```

Build an argument which refers to to an element within a map step with an optional transformation applied.

## Example

    iex> Argument.from_element(:argument_name, &Atom.to_string/1)

# `from_input`

```elixir
@spec from_input(atom(), atom(), nil | (any() -&gt; any()) | options()) :: t()
```

Build an argument which refers to a reactor input with an optional
transformation applied.

## Options

* `:transform` - An optional transformation function which can be used to modify the argument before it is passed to the step. The default value is `nil`.

* `:description` - An optional description for the argument. The default value is `nil`.

## Example

    iex> Argument.from_input(:argument_name, :input_name, transform: &String.to_integer/1)

# `from_result`

```elixir
@spec from_result(atom(), any(), nil | (any() -&gt; any()) | options()) :: t()
```

Build an argument which refers to the result of another step with an optional
transformation applied.

## Example

    iex> Argument.from_result(:argument_name, :step_name, &Atom.to_string/1)

# `from_template`

```elixir
@spec from_template(atom(), Reactor.Template.t(), nil | (any() -&gt; any()) | options()) ::
  t()
```

Build an argument directly from a template.

## Example

    iex> Argument.from_template(:argument_name, Reactor.Dsl.Argument.input(:input_name))

# `from_value`

```elixir
@spec from_value(atom(), any(), nil | (any() -&gt; any()) | options()) :: t()
```

Build an argument which refers to a statically defined value.

## Example

    iex> Argument.from_value(:argument_name, 10)

# `has_sub_path`
*macro* 

Validate that the argument source has a sub_path

# `has_transform`
*macro* 

Validate that the argument has a transform.

# `is_argument`
*macro* 

Validate that the argument is an Argument struct.

# `is_from_element`
*macro* 

Validate that the argument contains an element.

# `is_from_input`
*macro* 

Validate that the argument refers to a reactor input.

# `is_from_result`
*macro* 

Validate that the argument refers to a step result.

# `is_from_value`
*macro* 

Validate that the argument contains a static value.

# `sub_path`

```elixir
@spec sub_path(t(), [any()]) :: t()
```

Set a sub-path on the argument.

## Example

    iex> Argument.from_value(:example, :value)
    ...> |> Argument.sub_path([:nested, :values])

---

*Consult [api-reference.md](api-reference.md) for complete listing*
