View all issuesFebruary 1, 2025
Newsletter Hero Image

Validation Framework

Declarative validation rules for your tables. Define once, enforce everywhere.

In This Issue
Declarative validation rulesCustom validator supportCross-field validationAsync validation

Declarative Validation

Validation is now a first-class citizen in qqq. Define rules once, and they're enforced in the UI, API, and processes.

Built-In Validators

new QFieldMetaData("email", QFieldType.STRING)
  .withValidation(required())
  .withValidation(email())
  .withValidation(maxLength(255))

Cross-Field Validation

Validate relationships between fields:

new QTableMetaData()
  .withValidation(when("status").is("shipped")
    .then("trackingNumber").isRequired())

Custom Validators

Create reusable validation logic:

public class PhoneNumberValidator implements QValidator {
  public ValidationResult validate(String value) {
    // Your logic here
  }
}

Async Validation

Some validations need external calls:

new QFieldMetaData("taxId")
  .withAsyncValidation(new TaxIdVerifier())

The UI shows a spinner while validation completes.

Found this useful? Share it with your team.

q

Get the next issue delivered to your inbox.

Subscribe to Newsletter

You're receiving this because you subscribed to QRunIO updates.
Manage preferences · Privacy policy