You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been able to successfully apply middleware for fields, but when I try to apply one to a type resolver, it only applies the middleware to that type's field resolvers, not the type resolver itself.
Is there a way to only have it apply to the type resolver?
For example, given the below resolvers, I'd like to wrap the Contact type resolver, but I can only seem to get it to apply to that type's fields (e.g, name below).
// RESOLVERS{// mock type resolverContact: ()=>{return{name: ()=>{/* field resolver */}}},Query: ()=>{contacts: ()=>{/* field resolver */}}}// MIDDLEWAREapplyMiddleware(schema,{Contact: myMiddleware()})
The text was updated successfully, but these errors were encountered:
jrnail23
changed the title
Question: adding middleware around a type resolver?
Question: adding middleware around a (mock) type resolver?
May 30, 2020
Could you explain in a bit more detail what a type-resolver would do? Maybe you could do some mocking by checking the name of the field? You can get that information from the info argument in the middleware.
I've been able to successfully apply middleware for fields, but when I try to apply one to a type resolver, it only applies the middleware to that type's field resolvers, not the type resolver itself.
Is there a way to only have it apply to the type resolver?
For example, given the below resolvers, I'd like to wrap the
Contact
type resolver, but I can only seem to get it to apply to that type's fields (e.g,name
below).The text was updated successfully, but these errors were encountered: