Portal Community

The Problem

A payment processing workflow expects:

{ "userId": "user-123", "amount": 99.99, "currency": "USD" }

Instead it receives:

{ "userId": null, "amount": "ninety-nine", "currency": "USD" }

Without input validation:

The Solution

InputValidationGuard validates input against a JSON schema in the Pre phase. If validation fails and strictMode=true, the node never runs — the caller receives a structured error listing exactly which fields are wrong.

{
  "guardRails": {
    "individual": [
      {
        "name": "InputValidationGuard",
        "enabled": true,
        "order": 1,
        "config": {
          "schema": {
            "type": "object",
            "required": ["userId", "amount", "currency"],
            "properties": {
              "userId":   { "type": "string" },
              "amount":   { "type": "number" },
              "currency": { "type": "string" }
            }
          },
          "strictMode": true
        }
      }
    ]
  }
}

What the caller receives

{
  "IsAllowed": false,
  "ErrorMessage": "Input validation failed",
  "Metadata": {
    "validation_errors": [
      "Required field 'userId' is missing or null",
      "Field 'amount': expected 'number', got 'string'"
    ]
  }
}

strictMode vs Warning Mode

ModeResult on failureWhen to use
strictMode: true Blocked — workflow stops; node never runs Production workflows where malformed input must never reach a node
strictMode: false (default) Warning — workflow continues; violation logged Monitoring mode; catch issues without breaking existing flows during rollout

JSON Type Mapping

The guard maps CLR types to JSON schema types:

JSON schema typeAccepted CLR types
"string"string
"number"int, long, double, decimal, float
"boolean"bool
"array"List<object> or any IList
"object"IDictionary

Combining Validation with PII Detection

Input validation and PII detection are complementary guards. Run validation first to ensure the payload structure is correct, then check for PII in the validated input:

"individual": [
  // Step 1: Validate structure
  { "name": "InputValidationGuard", "order": 1,
    "config": { "schema": {...}, "strictMode": true } },

  // Step 2: Check for PII in validated input
  { "name": "PiiDetectionGuard", "order": 2,
    "config": { "sensitivityLevel": "medium" } }
]

This order ensures that if the structure is wrong, the PII scanner never runs on malformed data — avoiding false positives from unexpected field positions.

Zero Code in Nodes With InputValidationGuard, node executors can assume their input is always valid. No if (input.UserId == null) checks needed. The guard enforces the contract at the framework level.