GUBUS VALIDATE

VALIDATE checks data against validation rules and exposes user-friendly error messages. Prevents invalid data from proceeding through workflow.

VALIDATE checks data against validation rules and exposes user-friendly error messages. Prevents invalid data from proceeding through workflow.

💡

Use VALIDATE for data quality enforcement to ensure required fields, data types, and business rules before processing.

When to use VALIDATE:

  • Validate user input from multipanels or workfeeds
  • Enforce required fields
  • Check data types and formats
  • Apply business rule validation
  • Ensure data quality before processing

Key characteristics

  • Built-in validation for multipanel/workfeed patterns
  • Layered validation with HAS_VALUE flow
  • User-friendly error messages via front_to_pivot_model
  • Stops execution on validation failure (mainResult = false)

Rule Structure

Validation rules use these properties:

Property
Description
reference or main_target
Must match multipanel/workfeed reference
required_state
Validation type from CommonConstants.VALID
target_fields
Comma-separated field names to validate
required_values
Values for comparison (IS_IN, HAS_VALUE, etc.)
additional_fields
For HAS_VALUE layered validation
required_additional_state
Secondary validation in HAS_VALUE
required_additional_value_field
Field to compare against
message
Custom error message
stop_validation_here
Stop validating if this rule fails

Validation Types (required_state)

NOT_EMPTY

Ensures fields are not empty, null, or undefined.

{
  "reference": "orderInput",
  "required_state": "not_empty",
  "target_fields": "order_id,customer_name,total"
}

Error: [Row]: 5 Поле [Order #] пусте! Заповніть пліз!

IS_NUMBER

Validates field is a number type (not string, not NaN).

{
  "reference": "orderInput",
  "required_state": "is_number",
  "target_fields": "total,quantity"
}

Error: Рядок: 3 Поле: Total Amount не є числом, присутні літери або крапка, як розділовий знак!

IS_INTEGER

Validates field is an integer (whole number).

{
  "reference": "orderInput",
  "required_state": "is_integer",
  "target_fields": "quantity"
}

Error: Поле: Quantity зі значенням 5.5 не є цілим числом!

IS_NATURAL_NUMBER

Validates field is a natural number (positive integer > 0).

{
  "reference": "orderInput",
  "required_state": "is_natural_number",
  "target_fields": "quantity"
}

Error: Поле: Quantity зі значенням -5 не є натуральним числом!

IS_POSITIVE

Validates field is a positive number (> 0).

{
  "reference": "orderInput",
  "required_state": "is_positive",
  "target_fields": "total"
}

Error: Рядок: 7 Поле: Total Amount не є додатнім числом! Fix it!

IS_TRUE

Validates field is boolean true (checkbox checked).

{
  "reference": "orderInput",
  "required_state": "is_true",
  "target_fields": "terms_accepted"
}

Error: Рядок: 2 Флажок для поля: [Terms Accepted] не натиснутий, а мусить.

IS_IN

Validates field value is in allowed list.

{
  "reference": "orderInput",
  "required_state": "is_in",
  "target_fields": "status",
  "required_values": "pending,in_progress,done"
}

Error: Рядок: 4 Field: [Status] is not in: [pending,in_progress,done]!

IS_EQUAL

Validates field equals specific value or another field.

{
  "reference": "orderInput",
  "required_state": "is_equal",
  "target_fields": "confirmation",
  "required_values": "confirmed"
}

Or compare two fields:

{
  "reference": "orderInput",
  "required_state": "is_equal",
  "target_fields": "password",
  "additional_fields": "password_confirm"
}

Error: Value [unconfirmed] should be equal to [confirmed]

NOT_EQUALS

Validates field does NOT equal specific value.

{
  "reference": "orderInput",
  "required_state": "not_equals",
  "target_fields": "status",
  "required_values": "deleted"
}

Error: Поле [Status] не може дорівнювати [deleted] для дії orderInput

NUMBER_EQUALS

Validates two numeric fields are equal.

{
  "reference": "orderInput",
  "required_state": "number_equals",
  "target_fields": "total",
  "additional_fields": "calculated_total"
}

Error: Поле [Total] зі значенням 100 не дорівнює [Calculated Total] зі значенням 105!

NOT_MORE_THAN

Validates one field is not greater than another.

{
  "reference": "paymentInput",
  "required_state": "not_more_than",
  "target_fields": "payment_amount",
  "required_values": "remaining_balance"
}

Error: [Row]: 3 Поле: [Payment Amount] більше ніж [Remaining Balance]! Перевищення заборонене!

DATE_NOT_EARLIER

Validates first date is not earlier than second date.

{
  "reference": "orderInput",
  "required_state": "date_not_earlier",
  "target_fields": "delivery_date",
  "required_values": "order_date"
}

Error: Рядок: 5 Поле: Delivery Date не може бути раніше за поле: Order Date! Fix it!

STARTS_WITH

Validates field value starts with specific string.

{
  "reference": "orderInput",
  "required_state": "starts_with",
  "target_fields": "order_id",
  "required_values": "ORD-"
}

Error: Поле [Order #] не починається з [ORD-]!

INCLUDES

Validates field contains specific substring.

{
  "reference": "orderInput",
  "required_state": "includes",
  "target_fields": "description",
  "required_values": "urgent"
}

Error: Поле: Description не містить в собі значення: urgent! Приведи до ладу!!

HAS_STRICT_LENGTH

Validates field has exact length.

{
  "reference": "orderInput",
  "required_state": "has_strict_length",
  "target_fields": "product_code",
  "required_values": "8"
}

Error: Поле: Product Code не відповідає фіксованому розміру: [8]! Приведи до ладу!!

MATCHES_DATE_TIME_PATTERN

Validates date/time format against pattern.

{
  "reference": "orderInput",
  "required_state": "matches_date_time_pattern",
  "target_fields": "created_at",
  "required_values": "dd.MM.yyyy HH:mm:ss"
}

Pattern placeholders:

  • dd - day (2 digits)
  • MM - month (2 digits)
  • yyyy - year (4 digits)
  • HH - hours (2 digits)
  • mm - minutes (2 digits)
  • ss - seconds (2 digits)

Error: Рядок: 2 Поле: [15.13.2025] не відповідає формату дати: [dd.MM.yyyy HH:mm:ss]!

NOT_GOOGLE_MISTAKE

Checks if field contains Google Sheets formula error (#N/A).

{
  "reference": "orderInput",
  "required_state": "not_google_mistake",
  "target_fields": "calculated_total"
}

Error: Рядок: 3 Поле: calculated_total містить помилки гугл формул! Треба розібратися чому і виправити!!


Layered Validation (HAS_VALUE)

HAS_VALUE enables conditional validation: “if field has specific value, then validate other fields.”

Syntax

{
  "reference": "paymentInput",
  "required_state": "has_value",
  "target_fields": "payment_type",
  "required_values": "partial,any",
  "required_additional_state": "not_empty",
  "additional_fields": "partial_amount"
}

Logic: If payment_type is “partial” or “any”, then validate partial_amount is NOT_EMPTY.

Supported Layered Validations

When required_state = has_value, you can use these for required_additional_state:

  • NOT_EMPTY - additional fields must not be empty
  • NOT_MORE_THAN - additional field must not exceed another field
  • IS_NUMBER - additional fields must be numbers
  • NOT_EQUALS - additional field must not equal value
  • NUMBER_EQUALS - additional fields must equal numerically
  • HAS_VALUE - nested layered validation

Example: Conditional Payment Validation

[
  {
    "reference": "paymentInput",
    "required_state": "has_value",
    "target_fields": "payment_type",
    "required_values": "partial",
    "required_additional_state": "not_empty",
    "additional_fields": "partial_amount"
  },
  {
    "reference": "paymentInput", 
    "required_state": "has_value",
    "target_fields": "payment_type",
    "required_values": "partial",
    "required_additional_state": "not_more_than",
    "additional_fields": "partial_amount",
    "required_additional_value_field": "total_amount"
  }
]

Logic:

  1. If payment_type = “partial”, then partial_amount must have a value
  2. If payment_type = “partial”, then partial_amount must not exceed total_amount

Common Use Cases

Use Case 1: Required Fields

{
  "reference": "orderInput",
  "required_state": "not_empty",
  "target_fields": "order_id,customer_name,total,delivery_date"
}

Use Case 2: Type Validation

[
  {
    "reference": "orderInput",
    "required_state": "is_number",
    "target_fields": "total,quantity"
  },
  {
    "reference": "orderInput",
    "required_state": "is_natural_number",
    "target_fields": "quantity"
  }
]

Use Case 3: Status Validation

{
  "reference": "orderInput",
  "required_state": "is_in",
  "target_fields": "status",
  "required_values": "pending,in_progress,done,canceled"
}

Use Case 4: Date Range Validation

[
  {
    "reference": "orderInput",
    "required_state": "not_empty",
    "target_fields": "delivery_date"
  },
  {
    "reference": "orderInput",
    "required_state": "date_not_earlier",
    "target_fields": "delivery_date",
    "required_values": "order_date"
  }
]

Use Case 5: Conditional Payment Validation

[
  {
    "reference": "orderInput",
    "required_state": "has_value",
    "target_fields": "payment_type",
    "required_values": "order_payment",
    "required_additional_state": "not_more_than",
    "additional_fields": "payment_sum",
    "required_additional_value_field": "rest_to_pay",
    "message": "Payment sum cannot exceed remaining balance!"
  }
]

Error Message Composition

GUBUS uses front_to_pivot_model for user-friendly error messages.

Multipanel Configuration:

{
  "reference": "orderInput",
  "front_to_pivot_model": {
    "order_id": "Order #",
    "customer_name": "Customer Name", 
    "total": "Total Amount"
  }
}
  • Technical field name: order_id
  • User-friendly name: Order #

Multipanel Integration

Enable Validation

Set provide_validation flag:

{
  "reference": "orderInput",
  "provide_validation": true,
  "front_to_pivot_model": {
    "order_id": "Order #",
    "customer_name": "Customer Name",
    "total": "Total Amount"
  }
}

Validation Flow

User enters data → READ multipanel → VALIDATE → If fail: stop & show error → If pass: continue

When validation fails:

  • SchemaContext.mainResult = false
  • Execution stops
  • Error messages exposed to user
  • Multipanel NOT cleaned

Best Practices

Do’s ✅

  • ✅ Set provide_validation=true for user input panels
  • ✅ Use layered validation (HAS_VALUE) for conditional checks
  • ✅ Configure front_to_pivot_model with user-friendly labels
  • ✅ Validate early (READ stage)
  • ✅ Use custom message for business-specific errors

Don’ts ❌

  • ❌ Don’t use technical field names in front_to_pivot_model
  • ❌ Don’t forget to test validation scenarios
  • ❌ Don’t skip type validation before range validation

Summary

VALIDATE is GUBUS’s data quality enforcement for:

  • ✅ Ensuring required fields are present
  • ✅ Checking data types (number, integer, natural number)
  • ✅ Enforcing value constraints (IS_IN, IS_EQUAL, NOT_MORE_THAN)
  • ✅ Validating formats (dates, lengths, patterns)
  • ✅ Conditional validation (HAS_VALUE layered flow)
  • ✅ Providing user-friendly error feedback

When to use:

  • User input validation (multipanels, workfeeds)
  • Data quality checks
  • Business rule enforcement

When NOT to use:

  • Data transformation (use TRANSFORM)
  • Data filtering (use FILTER)

Next Steps

👉 GUBUS SCHEMA → - Learn how schemas orchestrate workflows 👉 GUBUS WORKFEED → - Learn about permanent data storage 👉 ← Back to Getting Started - Return to the main documentation