Skip to main content

Function: createNonWhitespaceStringSchema()

function createNonWhitespaceStringSchema(args: {
maxLength?: number;
maxLengthMessage?: string;
requiredMessage: string;
}): ZodString;

Defined in: shared/validation/stringSchemas.ts:10

Creates a string schema that rejects whitespace-only values.

Parametersโ€‹

argsโ€‹

maxLength?โ€‹

number

maxLengthMessage?โ€‹

string

requiredMessageโ€‹

string

Returnsโ€‹

ZodString

Remarksโ€‹

Optionally adds a max-length constraint before the non-whitespace check to preserve the existing validation ordering used by field schemas.