Virtual
A virtual field represents a value which is computed at read time, rather than stored in the database. See the virtual fields guide for details on how to use virtual fields.
Options:
field(required): The GraphQL field that defines the type, resolver and arguments.ui.query(default:''): Defines what the Admin UI should fetch from this field, it's interpolated into a query like this:
This is only needed when you your field returns a GraphQL type other than a scalar(String and etc.) or an enum or you need to provide arguments to the field.query{item(where:{id:"..."}){field${ui.query}}}
import{ config, createSchema, g, list }from'@keystone-6/core';import{ virtual }from'@keystone-6/core/fields';exportdefaultconfig({lists:{SomeListName:list({fields:{someFieldName:virtual({field: g.field({type: g.String,args:{ something: g.arg({ type: g.Int })},resolve(item, args, context, info){}})}),/* ... */},}),/* ... */},/* ... */});