Does graphql allow conditional execution of a step in a mutation? -


since can have multiple steps run sequentially in mutation, can have conditional if statement in graphql later steps run if result previous step meets condition?

e.g.

 mutation upsertlogin($idtoken: string!, $email: string!, $username: string!) {      user(email: $email, username: $username) {       id     }      // next step if no id from previous step      createuser(email: $email, username: $username) {       id     }    } 

no, graphql doesn't support kind of conditional execution. thing explicitly supported throwing error in 1 mutation in order prevent remainder of mutations running. works because mutations run sequentially.

in theory implement conditionals mention writing , reading context, shared between resolvers, not recommend doing so, because implementations of graphql declare context immutable.


Comments

Popular posts from this blog

Formatting string according to pattern without regex in php -

c - zlib and gdi32 with OpenSSL? -

java - inputmismatch exception -