https://kotlinlang.org logo
#graphql-kotlin
Title
# graphql-kotlin
f

Francois

11/27/2023, 6:06 PM
Hi team, i'm new in this channel but already used a lot the library for GraphQL especially with Federation v2. Currently i'm wondering about the possibility to pass dynamic context information from 1 service to another one. For example if i have a mutation like this: mutation createPolicy($policy: PolicyCreateParamsInput!, $participants: [Int!]!) { createPolicy(policy:$policy) { policyId productId dynamic, }, createParticipants(participantId: $participants), }
s

Shane Myrick

11/28/2023, 10:42 PM
Root level mutations in GraphQL do execute sequentially but only if they are in the same subgraph server, if you are going across subgraphs they can execute in parallel. That is the intention of putting both these mutation in a single operation. If you want to first execute one operation and then do another one they should be split into two unique operations and then sharing of data can happen either by the clients or some shared state used on the backend There are other ways you can share data across services but I don’t see this as a Federation or even GraphQL problem, you would still have this exact same issue in REST
👍 1
f

Francois

11/30/2023, 10:24 PM
Thanks @Shane Myrick for the feedback, but only concern is the fact the seconds operation is consuming an id created by the first operation. Would it be possible to do the same as queries and have cascading operations that permit to get a child operation receiving information from a parent operation
s

Shane Myrick

12/06/2023, 5:56 AM
You can do that, but not as a built in feature of GraphQL itself, you would have to write the logic in the resolver to wait for some input or context update to be received
👍 1