Homepage

GraphQLVariablesCheck

Last edit: Apr 01, 2026

GraphQLVariablesCheck

Severity: error | Type: LiquidHtml

This check ensures that parameters passed in a {% graphql %} tag match the variable definitions in the referenced .graphql file. It reports two types of problems:

  • Unknown parameters — an argument is passed that does not correspond to any variable in the query.
  • Missing required parameters — a non-null variable in the query (without a default value) is not provided at the call site.

Note: If you pass the special args parameter (which splats a hash as all GraphQL variables), the check is skipped for that call because the variables cannot be determined statically.

Examples

✗ Incorrect Code Example (Avoid using this):

# app/graphql/records/search.graphql
query search($table: String!) {
  records(per_page: 20, filter: { table: { value: $table } }) {
    results { id }
  }
}

{% comment %}Missing required 'table' argument, and passing unknown 'foo' argument{% endcomment %}
{% graphql result = 'records/search', foo: "bar" %}

✓ Correct Code Example (Use this instead):


{% graphql result = 'records/search', table: "my_table" %}

Configuration

The default configuration for this check:

GraphQLVariablesCheck:
  enabled: true
  severity: error

Disabling This Check

Disabling this check is not recommended.

Resources

Questions?

We are always happy to help with any questions you may have.

contact us