New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing SDL allows true
, false
, and null
for enum value names
#3221
Comments
what a catch, sounds like a missing thing, interesting 🤔 I had a problem related a couple years ago, using schema-stitching from graphql-tools, which he was re-creating the entire schema, and the enums became syntactically problematic, probably because of this. |
I looked into the specification. It's actually a bug in the parser. Section 3.9 defines the
And section 2.9.6 defines
I'll create a PR for this fix. |
The specification disallows these in the SDL grammar definition, and using one of these enum values would result in a schema that would throw validation errors on creation. Fixes graphql#3221.
The specification disallows these in the SDL grammar definition, and using one of these enum values would result in a schema that would throw validation errors on creation. Fixes graphql#3221.
The specification disallows these in the SDL grammar definition, and using one of these enum values would result in a schema that would throw validation errors on creation. Fixes graphql#3221.
The specification disallows these in the SDL grammar definition, and using one of these enum values would result in a schema that would throw validation errors on creation. Fixes graphql#3221.
The specification disallows these in the SDL grammar definition, and using one of these enum values would result in a schema that would throw validation errors on creation. Fixes graphql#3221.
The specification disallows these in the SDL grammar definition, and using one of these enum values would result in a schema that would throw validation errors on creation. Fixes graphql#3221.
The specification disallows these in the SDL grammar definition, and using one of these enum values would result in a schema that would throw validation errors on creation. Fixes graphql#3221.
The specification disallows these in the SDL grammar definition, and using one of these enum values would result in a schema that would throw validation errors on creation. Fixes graphql#3221.
The specification disallows these in the SDL grammar definition, and using one of these enum values would result in a schema that would throw validation errors on creation. Fixes graphql#3221.
There is a schema validator that forbids
true
,false
, andnull
as enum value names sinde https://github.com/graphql/graphql-js/pull/812/files. Theparse
function together with thespecifiedSDLRules
rules however allow these strings to be used as enum value names/values (they're the same there). This means you can parse and successfully validate an SDL which generates a validation error when creating the schema.I'm not quite sure whether this is a bug in the parser or a missing SDL validator.
parseEnumValueDefinition
usesparseName
and states that theEnumValue
non-terminal is equivalent to thename
non-terminal:There also is an
EnumValue
non-terminal which is defined as follows:So an enum declaration either should switch from
EnumName
toEnumValue
, or there should be an SDL validator that rejects the three forbidden words when used as enum value names/values.The text was updated successfully, but these errors were encountered: