Data schemas

A data schema describes the expected structure of an object: fields, types, constraints. It is used to validate inputs, type the output, and document the API. Libraries like Zod let you declare it in code and infer the TypeScript type from it.

Example

const Utilisateur = z.object({ nom: z.string().min(1), age: z.number().int() });

Related concepts

The whole glossary