I’ve got an SDL file with an Interface in it, and a few types that implement the interface. The query returns an array of the interface type.
Interface types requre a __resolveType resolver. Based on @peterp’s answer here I’ve tried adding a resolver both in the SDL file itself, as well as in the service, but in both cases I’m getting a warning stating Type "Tag" is missing a "__resolveType" resolver. What is the correct location and way to add this resolver?
Thanks!
For reference, here are the approaches I’ve tried, but the warning is still thrown:
It looks like maybe the warning happens because the resolvers are not included when makeExecutableSchema is called (here), so __resolveType is not yet defined. But later when addResolveFunctionsToSchema is called it gets merged I think.
I guess this is getting into the weeds, but is there a way to suppress that warning (e.g. by setting requireResolversForResolveType to false)? Or is that just hiding a problem?
Yes, it’s working since the __resolveType resolver gets merged in during the later step, after the warning has already been thrown. It was probably working all along but the warning made me assume it wasn’t.
However, it only works if I define the __resolveType function in the SDL file, but not if I try using the resolveType function in the services file (my 2nd example above). It’s not a big deal since the first form is working for me, but I was wondering why the 2nd form doesn’t get merged. Maybe that’s a special function name of some sort?
Not quite sure. Could you check in v0.13.0 and loop back with status? If no, please don’t hesitate to ping Peter directly with an @ Thanks! And have a good weekend.
@thedavid@peterp This doesn’t seems resolved, I can still see warnings in console. I tried adding __resolveType and resolveType in graphql type as mentioned above.
Hi @TMaYaD Thanks for joining the community and checking in about this!
@Chris could you possibly take the lead on this one? Ultimately, we need to a) confirm this and b) create a GH Issue and c) make sure @peterp and/or @Tobbe (maybe) have it on their radar to get resolved. I’m super focused on the v0.25 release so could use the help managing this. No pressure just let me know. We can loop in someone else if needed.