Generated object types are defined on the shared builder, so you can extend them rather than only add standalone fields. Use the builder's object-field extension to add computed or related fields to a generated type.
1
2
3
4
5
6
7
8
9
import { builder } from "@lakeql/api/builder"
// Add a computed field to a generated `Order` type
builder.objectField(OrderRef, "displayName", (t) =>
t.string({
resolve: (order) => `#${order.id} — ${order.status}`,
})
)
Extended fields participate in the same schema as the generated ones. They share the scope-auth scopes, the scalars, and the validation plugin. Keep extensions additive. The generated types are regenerated when a table changes, so put your additions in your own modules rather than editing generated files.
For entirely new root fields rather than extensions of existing types, see custom queries and mutations.