graphql-spec icon indicating copy to clipboard operation
graphql-spec copied to clipboard

Using variables in scalars

Open cutsoy opened this issue 2 years ago • 9 comments

I would like some clarification on using variables in scalars.

Given the following schema:

scalar Custom

type Query {
    hello(custom: Custom!): String!
}

We know that the following query could be valid (depending on Custom's wire format):

query Example {
    hello(custom: { name: "Tim" })
}

Would the following example also be valid?

query Example($name: String!) {
    hello(custom: { name: $name })
}

If so, does the executor first resolve $name and then call the scalar's deserializer with { name: "Tim" }?

Can someone shed some light on this?

cutsoy avatar Jan 24 '23 10:01 cutsoy