You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently the issue was raised for the Python port graphql-core that enum values aren't validated against their defintion when they are used as default arguments SDL. This is the example that was given:
constsdl=`enum Role { ADMIN USER}type Query { hello(r: Role = ADMIN): String complex(i: Test = { role: DOES_NOT_EXIST }): String complexAlt(i: Test): String}input Test { ignore: String role: Role = INVALID}`constschema=graphql.buildASTSchema(graphql.parse(sdl))constfields=schema.getType('Query').getFields()constarg1=fields.hello.args[0]constarg2=fields.complex.args[0]console.log(arg1,arg2)
Should schema validation not show this is an error?
The text was updated successfully, but these errors were encountered:
GraphQL services must return one of the defined set of possible values. If a reasonable coercion is not possible they must raise a field error GraphQL enum result
In this case role doesn’t choose from one of the possible defined types in the set which means it should raise an error.
Recently the issue was raised for the Python port graphql-core that enum values aren't validated against their defintion when they are used as default arguments SDL. This is the example that was given:
Should schema validation not show this is an error?
The text was updated successfully, but these errors were encountered: