Validator
Validates events using JSON Schema with two modes: format (structure) and contract (business rules).
Setup
- Integrated
- Bundled
Install the package:
Loading...
Configure in your code:
Loading...
Validation modes
| Mode | Purpose |
|---|---|
format | Validates full WalkerOS.Event structure |
contract | Validates entity/action-specific business rules |
Logger levels
| Level | Output |
|---|---|
ERROR | Validation failures only |
DEBUG | All validation results (pass and fail) |
Configuration
| Property | Type | Description | More |
|---|---|---|---|
format | boolean | Validate full WalkerOS.Event structure. Pre-compiled at init. | |
contract | object | Event-specific validation rules. Entity/action keyed, supports wildcards. |
| Option | Type | Default | Description |
|---|---|---|---|
format | boolean | true | Validate full WalkerOS.Event structure |
contract | Contract | - | Entity/action keyed validation rules |
Behavior
When validation fails
Invalid events are dropped from the pipeline and do not reach destinations. The validator logs detailed error information:
| Validation | Log message | Includes |
|---|---|---|
| Format | Event format invalid | Field-level errors from AJV |
| Contract | Contract validation failed | Rule name + field-level errors |
Example log output:
[ERROR] Event format invalid { errors: "data/name must match pattern \"^\\w+ \\w+$\"" }
[ERROR] Contract validation failed { rule: "product add", errors: "data must have required property 'id'" }
When validation passes
- Format valid: Event continues to contract validation (if configured)
- Contract valid: Logs debug message, event continues to next transformer or destinations
- No matching contract: Event passes through unchanged (validation is opt-in per entity/action)
Pipeline flow
Event → Format check → Contract check → Next transformer/Destination
↓ ↓
Invalid? Invalid?
↓ ↓
Drop + Log Drop + Log
Conditional rules
Apply different schemas based on event data:
Loading...
Wildcard patterns
Match multiple events with wildcards:
Loading...
Next steps
- Create your own - Build custom transformers
💡 Need Professional Support?
Need professional support with your walkerOS implementation? Check out our services.