The GraphQL specification distinguishes between enum literals and string literals in an operation document. An enum argument accepts the enum literal VALUE1, but not the string literal "VALUE1". By default, the router rejects a string literal used for an enum type with a validation error:
The allow_string_literals_for_enums option accepts such string literals when the string content matches one of the enum’s values. Strings that do not match a value are still rejected:
This is a deviation from the GraphQL specification. Servers built on graphql-js reject string literals for enums. Prefer fixing clients to send enum literals. Use this option to keep existing clients working while they migrate.
Examples
Given the schema:
The following queries behave as listed:
Variables are not affected by this option. JSON has no enum type, so a string is the standard representation for an enum variable value and is always accepted when it matches an enum value:
Configuration
Environment Variable
YAML
This option is disabled by default. See the Router Configuration reference for all engine flags.