RelationshipInput type
Flexible input type for relationship fields in mutations.
Accepts either:
- Full or projected entity object with a concrete primary key
- Object with only the primary key field(s)
Example
// Option 1: Pass full object (current behavior)
await client.data.Todo.create({
title: 'My Todo',
category: { id: 'cat-123', name: 'Work', color: '#ff0000' },
});
// Option 2: Pass primary-key-only object (new ergonomic shorthand)
await client.data.Todo.create({
title: 'My Todo',
category: { id: 'cat-123' },
});
type RelationshipInput<T> = RelationshipInputBranch<T, T>
Remarks
Writes extract the concrete id or Id to form the foreign key (for example,
category_id). Other supplied fields, including projected related objects,
are ignored. Null relationship writes are not supported.