GraphQL AST — GraphQLTag — Part Two

Variables

In our previous query, the variableDefinitionswas an empty array. But for this case, it will be not. Variable can only be defined on the operations.

  • kind- which will always be a VariableDefinition
  • variable- This provides the information of the variable, it contains the name of the variable and its type.
  • type- Defines the type of the variable. The interesting part is that, when the variable is not nullable, it’s kindwill be NonNullType($includeUsername: Boolean!), then on the type property where we get the type that is non-nullable, unlike from nullable type, its type will be defined on the property, with kind quals to NamedType.
  • defaultValue- Provides the information of the default value.
  • directive- Provides the information of the directives.

Directives

In the query above we included the directive if on the Field id that has a parameter and a variable as the parameter value.

  • kind- This will always be a Directive.
  • name- Holds the information of the name of the field.
  • arguments- Holds the information of the arguments being passed on the directive

Arguments

Based on the query above, there are 2 parts that the argument was present, the first one is from the directives and the second one was on the field.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store