cbvalidation

Validates inbound webhook payloads for configured triggers and required fields.

1|Updated Apr 10, 2026
One-click install
npx skills add https://github.com/ColdBox/skills --skill cbvalidation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cbvalidation
Source: https://github.com/ColdBox/skills/tree/main/modules/cbvalidation
Command: npx skills add https://github.com/ColdBox/skills --skill cbvalidation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents invalid or unsafe request data from reaching business logic by providing a consistent, declarative validation system for ColdBox/BoxLang handlers and APIs.

Core Features & Use Cases

  • Inline and shared constraints: Define per-handler rules or reuse shared constraint files for consistent validation across handlers and modules.
  • Exception and manual flows: Support both validate() with manual error handling and validateOrFail() with ValidationException for REST APIs.
  • Custom validators and integration: Add side-effect-free custom validators, enforce uniqueness via cborm, render errors in views, and return structured 422 JSON responses for API consumers.

Quick Start

Validate the incoming request with validateOrFail using your UserConstraints and catch ValidationException to return a 422 JSON response with field-level error messages.

Frequently Asked Questions about cbvalidation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate REST API payloads in ColdBox handlers and return structured 422 JSON responses?

Validate ColdBox handler input using the validateOrFail() flow to automatically throw a ValidationException, which you catch to return a structured 422 JSON response with field-level error messages for API consumers.

How does constraint validation work for form submissions in BoxLang and ColdBox?

Constraint validation enforces declarative rules on request collections during form submission by applying shared constraint files or inline rules to handler input, ensuring invalid data never reaches business logic.

Can I use custom validators to enforce database field uniqueness with cborm?

Yes, you can add side-effect-free custom validators to enforce unique database checks via cborm integration, allowing you to validate field uniqueness against existing records before processing input.

What is the difference between validate() and validateOrFail() flows for input validation?

The validate() flow allows manual error handling by returning validation results, while validateOrFail() immediately throws a ValidationException, making it ideal for automated REST API rejection with structured 422 responses.

How do I render validation errors safely in ColdBox views?

Validation errors are rendered in views using safe error message encoding, ensuring that field-level error reporting from the constraint validation system displays securely without exposing unsafe request data.

Do I need shared constraint files for consistent input validation across ColdBox modules?

Shared constraint files allow you to reuse declarative validation rules across multiple handlers and modules, ensuring consistent input validation and constraint enforcement throughout your ColdBox application.