graphql / graphql/graphql-spec

Using variables in scalars

Open
#1,011 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
14.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

I would like some clarification on using variables in scalars.

Given the following schema:

```graphql
scalar Custom

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

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

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

Would the following example also be valid?

```graphql
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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.