Skip to content

Default default_value should be Undefined instead of None in Argument and Field #1344

Closed
@steverice

Description

@steverice

In graphql-core, the default_value for a GraphQLArgument is set to Undefined if it is not given. This corresponds to the behavior in value_from_ast, in which an argument that has not been supplied is given the default_value iff that default is not Undefined.

In other words, if the code specifies a default_value for an argument, use it if there is no value provided. If the code does not specify a default_value, do not supply a default value if none is provided.

Graphene breaks this expectation by setting the default_value to None if none is provided in Argument and in Field.

This was resolved for InputField in #1111, but it should also be changed for Argument and Field since a Field can be mounted as an Argument.

From that PR:

Since GraphQL 3.0 there is a distinction between None and INVALID (no value).
See also graphql-python/graphql-core#66 (comment)
I think there are more bugs of this kind, but since I don't know graphene well, yet, I take baby steps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions