graphql-testx icon indicating copy to clipboard operation
graphql-testx copied to clipboard

Custom resolvers

Open b1zzu opened this issue 5 years ago • 4 comments

Custom resolvers are defenitly a must-have from graphql-testsx, but the way in which we could implement them is still an open question. What we should have is the possibility to define custom queries/mutations/subscriptions or fields in the datamodel and then manually pass the resolver method to the TestxServer. I would also like to make available to the resolver method the DataProvider and CRUDService so that the user could leverage them to build more useful resolvers.

We are looking into different ideas, thoughts, or feedbacks for this issue :tada:

b1zzu avatar Nov 28 '19 09:11 b1zzu

Custom resolvers will be resolver functions attached to some objects When creating runtime we getting a bunch of generated functions so we can simply merge them together:

Object.assign(runtime.resolvers, myCustomResolvers)

Having some helper for that will be big plus

wtrocki avatar Nov 28 '19 09:11 wtrocki

@wtrocki the main idea is to add some helpers, or at least give the custom resolver acess to the database, but we could split this in two separate tasks

b1zzu avatar Nov 28 '19 14:11 b1zzu

@b1zzu Perfect. This is where services will work nicely. Custom resolvers can base on existing services, however, having helper will be really nice (we can add that to graphback runtime

wtrocki avatar Nov 28 '19 14:11 wtrocki

Blocked by: #103

b1zzu avatar Dec 05 '19 12:12 b1zzu