graphql-python / graphql-python/graphql-core

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

Open
#122 2 comments 1 reaction 1 assignee Claimed by @Cito View on GitHub
pending upstream
Dominant language
Python
Stars
531
Forks
146
PR merge metrics
No merged PRs in 30d

Description

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:

```graphql
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.