Skip to main content
The request node validates incoming request data against a schema. Use it at the start of flows to ensure data meets requirements before processing.

Configuration

{
  "id": "validate_input",
  "type": "request",
  "config": {
    "source": "request.body",
    "schema": {
      "name": "required|string|min:2|max:100",
      "email": "required|email",
      "age": "integer|min:18"
    }
  }
}

Config Fields

FieldTypeRequiredDescription
sourcestringYesContext path to validate (e.g., request.body, request.query)
schemaobjectYesField-to-rules mapping
on_errorobjectNoCustom error handling

on_error Config

FieldTypeDefaultDescription
actionstring"abort""abort" or "continue"
statusnumber400HTTP status code for abort
bodyobject-Custom error response body

Output

On Success

{
  "valid": true,
  "data": {
    "name": "John Doe",
    "email": "[email protected]",
    "age": 25
  }
}

On Failure

{
  "valid": false,
  "errors": [
    {
      "field": "email",
      "rule": "email",
      "message": "The email field must be a valid email address"
    }
  ]
}

Validation Rules

Rules are separated by | (pipe). Some rules accept parameters after : (colon).

Presence Rules

RuleDescription
requiredField must be present and not empty
nullableField can be null
presentField must exist (can be empty)
sometimesOnly validate if field exists

Conditional Required

RuleDescription
required_if:field,valueRequired if another field equals value
required_unless:field,valueRequired unless another field equals value
required_with:fieldRequired if another field is present
required_without:fieldRequired if another field is absent
required_with_all:field1,field2Required if all listed fields present
required_without_all:field1,field2Required if all listed fields absent

Type Rules

RuleDescription
stringMust be a string
integerMust be an integer
numericMust be a number
booleanMust be true or false
arrayMust be an array
objectMust be an object

Size Rules

RuleDescription
min:nMinimum value/length/count
max:nMaximum value/length/count
size:nExact value/length/count
between:min,maxValue/length/count between range

Format Rules

RuleDescription
emailValid email format
urlValid URL format
uuidValid UUID format
ipValid IP address
ipv4Valid IPv4 address
ipv6Valid IPv6 address
jsonValid JSON string
regex:patternMatches regex pattern

Date Rules

RuleDescription
dateValid date format
datetimeValid datetime format
before:dateMust be before date
after:dateMust be after date
before_or_equal:dateMust be before or equal to date
after_or_equal:dateMust be after or equal to date

Comparison Rules

RuleDescription
same:fieldMust match another field
different:fieldMust differ from another field
confirmedMust have matching field_confirmation
gt:fieldGreater than another field
gte:fieldGreater than or equal to another field
lt:fieldLess than another field
lte:fieldLess than or equal to another field

Inclusion Rules

RuleDescription
in:val1,val2,val3Must be one of listed values
not_in:val1,val2,val3Must not be one of listed values

Control Rules

RuleDescription
bailStop validating field on first failure

Examples

User Registration

{
  "id": "validate_registration",
  "type": "request",
  "config": {
    "source": "request.body",
    "schema": {
      "username": "required|string|min:3|max:20",
      "email": "required|email",
      "password": "required|string|min:8",
      "password_confirmation": "required|same:password",
      "age": "required|integer|min:13",
      "terms_accepted": "required|boolean"
    }
  }
}

Product Creation

{
  "id": "validate_product",
  "type": "request",
  "config": {
    "source": "request.body",
    "schema": {
      "name": "required|string|max:200",
      "price": "required|numeric|min:0",
      "category": "required|in:electronics,clothing,food,other",
      "stock": "integer|min:0",
      "sku": "sometimes|string|regex:^[A-Z]{3}-[0-9]{4}$"
    }
  }
}

Array Validation

Use .* wildcard to validate array items:
{
  "id": "validate_order",
  "type": "request",
  "config": {
    "source": "request.body",
    "schema": {
      "items": "required|array|min:1",
      "items.*.product_id": "required|string|uuid",
      "items.*.quantity": "required|integer|min:1|max:100"
    }
  }
}

Optional Fields

{
  "id": "validate_profile_update",
  "type": "request",
  "config": {
    "source": "request.body",
    "schema": {
      "name": "sometimes|string|max:100",
      "bio": "nullable|string|max:500",
      "website": "sometimes|url"
    }
  }
}

Custom Error Response

{
  "id": "validate_with_custom_error",
  "type": "request",
  "config": {
    "source": "request.body",
    "schema": {
      "email": "required|email"
    },
    "on_error": {
      "action": "abort",
      "status": 422,
      "body": {
        "success": false,
        "error": "validation_failed",
        "message": "{{first_error}}",
        "errors": "{{validation_errors}}"
      }
    }
  }
}

Continue on Error

Capture validation errors without aborting:
{
  "id": "soft_validate",
  "type": "request",
  "config": {
    "source": "request.body",
    "schema": {
      "email": "required|email"
    },
    "on_error": {
      "action": "continue"
    }
  }
}
Then check validation result:
{
  "id": "check_validation",
  "type": "condition",
  "config": {
    "conditions": [
      {
        "if": "{{soft_validate.output.valid}} == true",
        "then": ["process_data"]
      }
    ],
    "else": ["handle_invalid"]
  }
}

Error Response Context

In custom error body templates, these variables are available:
VariableDescription
{{validation_errors}}Array of all error objects
{{validation_errors_map}}Map of field to first error message
{{first_error}}First error message
{{error_count}}Total number of errors

Default Error Response

Without custom on_error.body:
{
  "success": false,
  "message": "Validation failed",
  "errors": [
    {
      "field": "email",
      "rule": "email",
      "message": "The email field must be a valid email address"
    }
  ]
}