Schema
Description
Schema type builder.
Import
import { s } from "dreamkit";Definition
import type { BoolType, NumberType, ObjectType, StringType, FileType, ArrayType, Type,} from "dreamkit";
declare const s: { title(value: string): typeof s; object(props: Record<string, Type>): ObjectType; array(type: Type): ArrayType; string(): StringType; number(): NumberType; bool(): BoolType; file(): FileType;};Examples
Validate
import { $route, Input, s } from "dreamkit";import { createSignal } from "solid-js";
const type = s.string().min(3).max(5);
export default $route.path("/").create(() => { const [name, setName] = createSignal(""); return ( <> <Input value={name} onChange={setName} /> <p> {"errors: "} {JSON.stringify(type.validate(name()), null, 2)} </p> </> );});