Auto naming GraphQL mutation variables based on matching arguments

Viewed 30

I wonder if there is any syntactic sugar in graphql mutation that saving me from rewriting the name of the variable? For example, my mutation looks like this (I have to repeat each variable name triple times):

The boilerplate code that I have to write

I'm expecting something like the javascript's spreading operator, which might looks like this:

mutation SaveMedia(...$payload: SaveMediaParams) {
  saveMedia(...$payload) {
    asset {
      id
    }
  }
}

Thank you in advance!

0 Answers
Related