Hi!
Is it possible to get a list of requested fields? For example, user performs the following query:
{
id
user {
id
firstName
}
}
And I would like to know what fields were requested by user, in FieldResolver for example:
@FieldResolver()
user(
@Root() parent: ParentEntity,
@RequestedFields() fields: string[],
) {
/** if only id is requested, there's no need to execute unnecessary
* request to the database, so I can just return:
* { id: parent.user }
**/
}
Maybe there's a better way to do it, but I couldn't find it yet.
Thanks!
See #10 - for now use @Info() and parse it manually.
Most helpful comment
See #10 - for now use
@Info()and parse it manually.