Interface ObjectFieldDef

A schema field definition for a nested object type.

The fields property is itself an ObjectSchema, enabling arbitrarily deep nesting.

Object fields are never nullable. DynamoDB cannot update nested document paths (e.g. address.geo.lat) if an intermediate object does not exist, which causes: ValidationException: The document path provided in the update expression is invalid for update. To avoid this, object-type fields always exist as at least an empty object {}. Non-object fields within the object may still be nullable.

Objects within arrays are not subject to this limitation because arrays use full replacement on update rather than document path expressions.

const schema = {
geo: {
type: "object",
fields: {
lat: { type: "number" },
lng: { type: "number" },
notes: { type: "string", nullable: true }
}
}
} as const satisfies ObjectSchema;
interface ObjectFieldDef {
    fields: ObjectSchema;
    type: "object";
}

Properties

Properties

fields: ObjectSchema

The nested ObjectSchema describing the object's shape.

type: "object"

Must be "object" to indicate a nested object field.