ref) in any number of resources, or as the input and output shape of a route. Change the shape in one place and every use follows.
In Studio
Data → Tools → Schemas. New schema asks for a name and a list of fields, edited exactly like table columns (Columns and types): each field has a type, constraints and flags. Names start with a letter and use letters, digits and underscores (Address, Money).
Then in a table’s Columns tab, add a column of type Schema reference and choose the schema under Schema. The column stores an object that must match the shape.
In your app
The column is just an object:ValidationError naming the nested path.
Nested objects without a schema
For a shape you use once, define an Object column with its ownfields instead. Use a schema when you reuse the shape or want it in route inputs.
Schemas in routes
A route can name a request schema and a response schema so its input is validated and its output documented. See Routes.When to use JSON instead
Ajson column accepts anything. Use it for data you don’t control (webhook payloads, user-defined settings). Prefer a schema or object whenever you know the shape: you get validation, documentation and typed clients for free.
Columns and types
Field options.