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
This is not really as much a problem as a question about practices. Playing with GraphQL I realised that argument resolutions rely on types always getting the same data structure from the parent resolver (unless you want to branch the logic in them).
Is there any clever way to ensure this? So for instance wherever I define an attribute of the Image type, I can make sure a resolver for that attribute eventually returns a data structure which attribute resolvers on Image can handle.
The text was updated successfully, but these errors were encountered:
Great question. This is something I would say is currently not easy to do in the JS reference impl but probably should be. I'll leave this open to track it.
In our PHP implementation in production at Facebook, we have a function that each type defines that simply checks to ensure the produced value correctly fits the type expected (returns boolean), so that resolver functions for the sub-fields can be written with more confidence.
This is not really as much a problem as a question about practices. Playing with GraphQL I realised that argument resolutions rely on types always getting the same data structure from the parent resolver (unless you want to branch the logic in them).
Is there any clever way to ensure this? So for instance wherever I define an attribute of the
Image
type, I can make sure a resolver for that attribute eventually returns a data structure which attribute resolvers onImage
can handle.The text was updated successfully, but these errors were encountered: