graphql / graphql/graphql-spec

query based on fields of complex variables

Open
#248 12 comments 18 reactions 0 assignees View on GitHub
👻 Needs Champion 💭 Strawman (RFC 0)
Dominant language
JavaScript
Stars
14.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Complex variables are described in the spec https://facebook.github.io/graphql/#sec-Variables-Are-Input-Types

This example takes a ComplexInput and passes it to the findDog query:

```input ComplexInput { name: String, owner: String }

query takesComplexInput($complexInput: ComplexInput) {
findDog(complex: $complexInput) {
name
}
}
```

What I would really like to do is use specific fields in the ComplexInput variable like this:

```query takesComplexInput($complexInput: ComplexInput) {
findDogByName(name: $complexInput.name) {
name
}
}
```

This is not valid GraphQL, but it would simplify a feature we are working on quite a bit.

For context: Graphcool is a backend application platform that combines GraphQL and Lambda. Many of our features are based on automatically generated schemas and stored queries we execute on the server in response to some event, so our needs might differ significantly from the broader community.

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.