Annotations · 3.1.0

Validators & Verifiers

A comment guides the model; a declaration on the field is what the engine enforces. Every check runs before a value is set, without the chat model: a refused value is never saved, and the user gets one plain sentence — the declared message, else the check's own.


Named validators

A general format, checked on the value itself. Each takes an optional message.

AnnotationThe value must be
@Confiqure.Emailan email address
@Confiqure.NAPhoneNumbera North American phone number: 10 digits, or 11 with a leading 1
@Confiqure.UKPhoneNumbera UK phone number: the national form starting with 0, or the international form starting with +44
@Confiqure.WorldPhoneNumbera phone number in international form: an optional +, then 7 to 15 digits
@Confiqure.USZipCodea US ZIP code: 5 digits, or ZIP+4 (12345-6789)

Spaces, dashes, dots and parentheses are allowed in phone numbers. Ranges and sizes (@Min, @Max, @Size) are not enforced by confiqure: write them in the field's comment, and the model follows them.

Confiqure checks

Run by confiqure, with no call to you: @Confiqure.Verify(ValidatorKind.…).

  • ADDRESS checks a postal address and saves its corrected form at once. The engine recognises the parts by these field names: street or addressLine1 or line1, addressLine2, city, state or region, postalCode or zip, country; a String field takes the whole address as one line.
  • PRODUCT_CODE accepts a GTIN-8, -12, -13 or -14 with a valid check digit (UPC-A, EAN-13 and ISBN-13 are GTINs), an ISBN-10 with a valid check digit (X allowed last), or an ASIN (B0 followed by 8 letters or digits). Spaces and dashes are ignored.
WarehouseSettings.java
@Confiqure.Setting(end = "/warehouse-settings")
public class WarehouseSettings {
    @Confiqure.Email
    private String contactEmail;

    @Confiqure.USZipCode(message = "Give a 5-digit ZIP code.")
    private String warehouseZip;

    @Confiqure.Verify(Confiqure.ValidatorKind.ADDRESS)
    private Address shipFrom;

    @Confiqure.Verify(Confiqure.ValidatorKind.PRODUCT_CODE)
    private String barcode;
}

Your own checks

A check only your application can make — a code exists in your catalog, an account is open — is a tool class implementing one of two interfaces.

InterfaceAttach withIt answers
ConfiqureValidator<T>@Confiqure.ValidatedBy(X.class)ok, or not ok with a message — a format check
ConfiqureVerifier<T>@Confiqure.VerifiedBy(Y.class)ok, not ok with a message, or a corrected value, which is saved instead and stated
CatalogCheck.java
@Confiqure.Tool
@RestController
public class CatalogCheck implements ConfiqureVerifier<String> {
    @PostMapping("/checks/catalog")
    public Confiqure.Verdict<String> verify(@RequestBody Confiqure.Check<String> check) {
        String code = check.getValue().strip().toUpperCase();
        if (!catalog.exists(code)) return Confiqure.Verdict.notOk("No product has the code " + code + ".");
        return code.equals(check.getValue()) ? Confiqure.Verdict.ok() : Confiqure.Verdict.corrected(code);
    }
}

// on a field of any object or request class
@Confiqure.VerifiedBy(CatalogCheck.class)
private String productCode;
  • The engine POSTs {field, value, confiqureKey?} to the mapped validate / verify — confiqureKey is the record's key when the record exists — and reads back {ok, message?, value?}. Build the answer with Verdict.ok(), notOk(message) or corrected(value).
  • A validator answers Verdict<Void>, so it cannot correct a value; that is a verifier. The compiler checks that the class you attach is the right kind.
  • @Confiqure.VerifiedBy on a request class checks the whole request once every field is set, before the operation is called: value is the request object, field the class's simple name. Not ok makes no call.

confiqure push (CLI 1.1.0) stops, naming the file and line, when the engine could not call your check:

  • the value is not a class literal;
  • the class is not a @Confiqure.Tool class in the push, or two tool classes share its name;
  • its @Confiqure.Tool(name) differs from its class name;
  • validate / verify is missing, @Confiqure.Browser or @Confiqure.Async — a check answers at once from your server.

Versions

These need ai.confiqure:confiqure-annotation-java 3.1.0 and @confiqure/cli 1.1.0. Coming from CLI 0.5, move your classes to the 3.0 vocabulary first; tool classes then ship with every push.

Next:

Last updated October 2026 · annotation 3.1.0