# Condition Classes

It is possible to define any number and type of new condition classes with specialized configurations. Rierino is shipped with a number of default classes.

## ElementValueCondition

This class(*com.rierino.handler.saga.condition.ElementValueCondition*) returns the value of a specific payload element to be used as a condition value.

| Parameter | Definition                      | Example             |
| --------- | ------------------------------- | ------------------- |
| element   | Json path of the element to use | parameters.language |

## ErrorCodeCondition

This class(*com.rierino.handler.saga.condition.ErrorCodeCondition*) returns the value of event error code (or '-' if null) to be used as a condition value.

## ErrorHttpCondition

This class(*com.rierino.handler.saga.condition.ErrorHttpCondition*) returns the http status code of event error (or '-' if null) to be used as a condition value.

## EventStatusCondition

This class(*com.rierino.handler.saga.condition.EventStatusCondition*) returns the status name of event result (or '-' if null) to be used as a condition value.

## HasElementCondition

This class(*com.rierino.handler.saga.condition.HasElementCondition*) returns "true" or "false" based on whether a specific payload element exists or not.

| Parameter | Definition                      | Example     |
| --------- | ------------------------------- | ----------- |
| element   | Json path of the element to use | customer.id |

## JMESCondition

This class(*com.rierino.handler.saga.condition.JMESCondition*) returns a text value based on evaluation of a JMESPath pattern.

| Parameter      | Definition                                                                            | Example              |
| -------------- | ------------------------------------------------------------------------------------- | -------------------- |
| pattern        | JMESPath pattern to apply                                                             | language=='enUS'     |
| patternElement | Json path to payload element which defines JMESPath pattern to apply                  | parameters.condition |
| store          | Whether JMESPath expression should be cached for future executions (defaults to true) | false                |
| inputElement   | Json path of the payload to run pattern on                                            | parameters           |

{% embed url="<https://jmespath.org>" %}
JMESPath Page
{% endembed %}

## JsonSchemaCondition

This class(*com.rierino.handler.saga.condition.JsonSchemaCondition*) evaluates event payload against a Json schema constraints and returns "success" or "fail".

| Parameter | Definition                           | Example           |
| --------- | ------------------------------------ | ----------------- |
| schema    | String representation of Json schema | {"type":"string"} |

{% embed url="<https://json-schema.org>" %}
Json Schema Page
{% endembed %}

## RegexCondition

This class(*com.rierino.handler.saga.condition.RegexCondition*) evaluates event payload against a regex expression and returns "true" or "false".

| Parameter | Definition                           | Example            |
| --------- | ------------------------------------ | ------------------ |
| element   | Json path of the element to evaluate | customer.data.name |
| regex     | Regex expression to evaluate         | \[a-zA-Z]+         |

## SuccessCondition

This class(*com.rierino.handler.saga.condition.SuccessCondition*) returns "success" or "fail" based on whether the previous saga step had an error or not.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rierino.com/devops/api-event-and-process-flows/configuring-saga-steps/condition-step/condition-classes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
