aerogear / graphql-testx

A GraphQL server for testing GraphQL applications or libraries based on Graphback
Apache License 2.0
15 stars 5 forks source link

Custom resolvers #80

Open b1zzu opened 4 years ago

b1zzu commented 4 years ago

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:

wtrocki commented 4 years ago

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

b1zzu commented 4 years ago

@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

wtrocki commented 4 years ago

@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

b1zzu commented 4 years ago

Blocked by: #103