Apiker ships two small guards rather than a schema language. Call them in your handler and answer with res_400 when they fail.

1import { isEmail, isRequiredLength, res_400, res_201 } from "apiker";
2
3const register = async ({ body }) => {
4 if (!isEmail(body?.email)) return res_400("Valid email required");
5 if (!isRequiredLength(body?.password, 8, 128)) return res_400("Password must be 8-128 characters");
6
7 // ...create the account
8 return res_201();
9};

isEmail(value)

A pragmatic check: the value has to look like an address and be between 3 and 50 characters. It is a guard against obvious junk, not a substitute for sending a verification email.

isRequiredLength(value, min, max)

Confirms the value is present and its length falls inside the range. min defaults to 5 and max to 20, which are the limits the built-in auth routes use, so pass your own for anything longer.

Validation is never applied automatically to your routes. Only the built-in auth endpoints validate their own input.