udacity / graphb

GraphQL Query Builder for Go
MIT License
38 stars 20 forks source link

Add unquoted string / field support for arguments #10

Open efrister opened 4 years ago

efrister commented 4 years ago

Hi! I didn't find a way to modify a mutation with arguments to reference fields (strings) without quotes. Use Case:
https://hasura.io/docs/1.0/graphql/manual/mutations/upsert.html

The "on_conflict" clause requires to pass the fields without quotes.

on_conflict: {
      constraint: article_pkey,
      update_columns: [title, content]
}

This pull request is a proposal to add a new ArgumentField, which will take a string and transform it without quotes. In addition, this makes the ArgumentValue interface public in case anyone needs custom transformations for arguments. I'm open to suggestions on how to improve or change this PR for it to get accepted.