Skip to content
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

When enum is used as argument, its default value is not validated against enum definition #122

Open
rafalp opened this issue Mar 2, 2021 · 1 comment
Assignees
Labels
pending Waiting for other issues to move forward upstream Should be solved or discussed upstream

Comments

@rafalp
Copy link
Contributor

rafalp commented Mar 2, 2021

Hello!

While working on enum support in Ariadne I've found that enums values aren't validated against GraphQL enum when they are defined as fields on GraphQL schema.

Following schema passes validation:

enum Role {
  ADMIN
  USER
}

type Query {
  hello(r: Role = ADMIN): String
  complex(i: Test = { role: INVALID }): String
  complexAlt(i: Test): String
}

input Test {
  ignore: String
  role: Role = INVALID
}

I would've expected schema validators to raise INVALID, but instead those fields are quietly excluded from default value passed to field's resolver.

@Cito
Copy link
Member

Cito commented Mar 3, 2021

Thanks for reporting. GraphQL.js behaves the same, so I passed this question on.

@Cito Cito added pending Waiting for other issues to move forward upstream Should be solved or discussed upstream labels Dec 27, 2021
@Cito Cito self-assigned this Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending Waiting for other issues to move forward upstream Should be solved or discussed upstream
Projects
None yet
Development

No branches or pull requests

2 participants