---
sidebar:
  hidden: true
title: roboto.domain.triggers.validation
---
## Module Contents

### TriggerValidator

```python
class roboto.domain.triggers.validation.TriggerValidator(
    catalog: roboto.domain.platform_events.PlatformEventCatalog = DEFAULT_PLATFORM_EVENT_CATALOG,
)
```

`from roboto.domain.triggers import TriggerValidator`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/validation.py#L44-L278)

Save-time validation for triggers.

Enforces the cross-field rules that need the event catalog: a condition may only reference namespace roots exposed by *every* event the source fires for, `once_per` must be legal for every subscribed event, an action target's file patterns need a dataset to match against and are themselves required when the firing event's own file is the action's input, and every target template placeholder must resolve to a shared exposed root (or a reserved `envelope.`/`trigger.` context). A schedule fires for exactly one occurrence type, so the same rules apply to it with that occurrence's roots.

Run before persistence so a trigger that could never fire — or could never resolve its templates — fails loudly with an actionable message instead of silently misbehaving at evaluation time.

**Parameters**

- **catalog** (`roboto.domain.platform_events.PlatformEventCatalog`)

#### TriggerValidator.validate()

```python
def validate(
    *,
    fires_on: roboto.domain.triggers.sources.TriggerSource,
    condition: Optional[roboto.query.ConditionType],
    targets: collections.abc.Sequence[roboto.domain.triggers.targets.TriggerTargetSpec],
    managed_by: Optional[roboto.domain.triggers.record.ManagedBy] = None,
) -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/validation.py#L82-L110)

Validate the cross-field rules for one trigger's parts.

**Parameters**

- **fires_on** (`roboto.domain.triggers.sources.TriggerSource`): The trigger's firing source.
- **condition** (`Optional[roboto.query.ConditionType]`): Optional predicate over the firing's namespace.
- **targets** (`collections.abc.Sequence[roboto.domain.triggers.targets.TriggerTargetSpec]`): The trigger's target specs.
- **managed_by** (`Optional[roboto.domain.triggers.record.ManagedBy]`): The trigger's owner, if it is managed. An ingestion rule's trigger accepts only the files the rule's path patterns match, so its per-file targets need no `required_inputs`.

**Raises**

- `ValueError`: The first rule that fails, with a message naming the offending field, root, or event.

**Returns**

- `None`

#### TriggerValidator.validate_record()

```python
def validate_record(record: roboto.domain.triggers.record.TriggerRecord) -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/validation.py#L69-L80)

Validate a full trigger record.

**Parameters**

- **record** (`roboto.domain.triggers.record.TriggerRecord`)

**Raises**

- `ValueError`: Any rule in [`validate()`](/reference/python-sdk/roboto/domain/triggers/validation#roboto.domain.triggers.validation.TriggerValidator.validate) fails.

**Returns**

- `None`
