Relay'd FieldResolver
Adding relay to a FieldResolver (almost) automatically
In some scenarios we might need finer control on the fetching logic, while still taking advantage of the automatic ObjectTypes creation. AutoRelay offers two decorators for that job : @RelayedField
and @RelayedFieldResolver
And that's it! Again, AutoRelay has taken care under the hood of a few things:
It's created all the necessary GraphQL types for us
It's ensured the
users
query expects Connection Arguments, but conveniently translated them to limit/offset for us.It takes the return of our
findAndCount
calls and automatically transforms it to a RelayConnection
as expected by GraphQL.
In situations where you want your field to appear in the SDL, but do not want to actually create the resolver logic, AutoRelay provides a @RelayedField
decorator that acts the same way as @Field
while still providing a shorthand to creating Collection types.
Last updated
Was this helpful?