Skip to content

Schema.string

Description

Validates that the provided value is a string. Supports enforcing minimum and maximum length constraints.

Usage

ts
import * as Schema from "@bytelab.studio/schemify";

const schema = Schema.string();

schema.validate("hello");
schema.validate("");

Options

OptionsTypeDefaultDescription
minLengthnumberundefinedMinimum length of the string.
maxLengthnumberundefinedMaximum length of the string.

Definition

ts
export interface StringOptions extends RawOptions {
    minLength?: number;
    maxLength?: number;
}

Hierarchy