A schema field definition for a nested object type.
The fields property is itself an ObjectSchema, enabling arbitrarily deep nesting.
fields
const schema = { geo: { type: "object", fields: { lat: { type: "number" }, lng: { type: "number" } } }} as const satisfies ObjectSchema; Copy
const schema = { geo: { type: "object", fields: { lat: { type: "number" }, lng: { type: "number" } } }} as const satisfies ObjectSchema;
The nested ObjectSchema describing the object's shape.
Optional
When true, the field accepts null and becomes optional.
true
null
Must be "object" to indicate a nested object field.
"object"
A schema field definition for a nested object type.
The
fieldsproperty is itself an ObjectSchema, enabling arbitrarily deep nesting.Example