Skip to content

Enum cannot represent value, when querying for defaultValue #126

Closed
@dkbarn

Description

@dkbarn

I'm using ariadne and suddenly started encountering an error from the introspection query issued by GraphQL Playground when I upgraded from ariadne 0.12.0 to 0.13.0.

I've boiled the problem down as simply as possible and actually it seems to have nothing to do with ariadne, but instead is a change in behaviour from graphql-core 3.0 -> 3.1.

The following works in graphql-core 3.0, but not in 3.1:

import graphql
import pprint

schema = graphql.build_schema("""
    enum Role {
        ADMIN
        USER
    }

    type Query {
        hello(r: Role = USER): String
    }
""")

query = "{__schema{types{name,fields{name,args{name,defaultValue}}}}}"

result = graphql.graphql_sync(schema, query)

pprint.pprint(result)

In graphql-core 3.1, it throws the error: Enum 'Role' cannot represent value: 'USER'

Could someone tell me if I'm doing something wrong? Have I been making an incorrect assumption which errorneously passed in 3.0 and has now been "fixed"? Or is this a regression?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions