Description templates

Let's say that you have a type that you want to reuse in other types:

Source GraphQXL Compiled GraphQL
type _ToBeReused {
    "Field foo from type 'ToBeReused'"
    foo: String!
}

input Bar {
    ..._ToBeReused
}
input Bar {
    "Field foo from type 'ToBeReused'"
    foo: String!
}




There, foo's description says that the field foo belongs to the type ToBeReused, but once that is compiled it is not true, it should say something like:

input Bar {
    "Field foo from input 'Bar'"
    foo: String!
}

Description string interpolation

You can use template variables in the description strings to refer to some contextual values:

Open in sandbox

Source GraphQXL Compiled GraphQL
type _ToBeReused {
    "Field foo from ${{ block.type }} '${{ block.name }}'"
    foo: String!
}

input Bar {
    ..._ToBeReused
}

type Baz {
    ..._ToBeReused
}
input Bar {
    "Field foo from input 'Bar'"
    foo: String!
}

type Baz {
    "Field foo from type 'Baz'"
    foo: String!
}



These are the available values for the templates:

  • block.name: The parent's block name
  • block.type: The parent's block type (type or input)
  • variables.YOUR_GENERIC_VARIABLE: The value of the generic variable once instanced