Skip to main content
Every object below is importable from the top-level typewall package unless a more specific import path is noted. The canonical builder entry point is from typewall import w (the alias tw is equivalent).

Builder entry point

Common builder methods include w.str(), w.int(), w.float(), w.bool(), w.object(), w.list(), w.dict(), w.tuple(), w.union(), w.literal(), and w.enum(). Each returns an immutable Schema; constraint and processing methods (such as .min(), .max(), .default(), .optional(), .refine(), .transform()) return new schemas rather than mutating the original.

Core contracts

Schema.parse() is strict and non-coercing: it raises ValidationError on invalid input. safe_parse() returns a ParseResult instead of raising.

Errors

Primitive schemas

Structured schemas

Composition schemas

Typing integration

Export adapter

FastAPI integration

Requires the fastapi extra (pip install typewall[fastapi]).

Version