How does one invoke resolvers of queries associated with a sub schema? #982
-
Hello, this may well be a basic GQL question. Consider the following (completely made up names): schemas/root.graphql:
schemas/subSchema.graphql:
resolvers/subSchema.py:
schemas/masterSchema.graphql
resolvers/masterSchema.py
main.py:
Now, if I do
Things are great. resolver of compute_subSchema is called However if I did:
This does indeed call the resolver for How do I go about making sure if I include a schema in another schema and ask for a field of the included schema, its query resolver is called? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 1 reply
-
If I'm to be honest here, this is first time I see this. Where did you see those nested schemas? |
Beta Was this translation helpful? Give feedback.
-
I created it myself - basically my requirement is: |
Beta Was this translation helpful? Give feedback.
-
At glance I am curious how come either of those work, because those lines should raise name error;
This is because neither My question is why not have three separate GraphQL path's for schemas A, B and C, and just pass types and resolvers from A and B to |
Beta Was this translation helpful? Give feedback.
-
My apologies, there was a typo - it should be
Schema 'C' combines A, B and some other aspects not in A and B. Furthermore, when people execute a query on Schema C (which is defined by team C), I want that resolver to invoke A's resolver, wait for the answer, pass the output of A's resolver to B's resolver as input. In other words, C's resolver needs to invoke in_sequence (not parallel) A's resolver then B's resolver How does one do that? |
Beta Was this translation helpful? Give feedback.
-
Ok, so if I understand correctly, when you run this query:
Then |
Beta Was this translation helpful? Give feedback.
-
Here is a repo: https://github.com/pliablepixels/graphql_experiments/ This may well be a basic GQL question, but any help would be appreciated. What I want is when SchemaA is invoked inside SchemaC, SchemaA's resolver is called after SchemaC's resolver is called. I think the problem is I've bound a resolver to a query of SchemaA but not sure how to call that query inside SchemaC |
Beta Was this translation helpful? Give feedback.
-
Ah I think I have the answer. The trick is to code |
Beta Was this translation helpful? Give feedback.
Ah I think I have the answer. The trick is to code
type
resolvers. I added resolvers for schemaA and was able to invoke SchemaA inside SchemaC and the resolver was called! (link)