Use nested property of provided input object


For queries and mutations with multiple input parameters, I usually create an input type that contains all parameters. This works well to prevent major restructuring if the order or type of parameters changes later on. For example:

type Mutation {
  foo(input: FooInput!): Foo!
  bar(id: ID!): Bar!

input FooInput {
  id: ID!
  query: String!

If I want to write a compound query to fetch both foo and bar, is there any way for me to pass only a single input parameter and use the id it contains as a parameter for bar?

query CompoundQuery($input: FooInput!) {
  foo(input: $input) {
  bar(id: $ {


After digging through the language spec, I’ve determined this isn’t currently possible.

I’m working on implementing it at superhawk610/graphql-js#feat/nested-input-properties if anyone wants to help out.


This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.