Skip to content

Empty value for Decimal scalar #927

@hgylfason

Description

@hgylfason

Is empty string considered an invalid value for Decimal scalar?

If so then how do we represent an empty value for a Decimal?

I've tried to fix this by parsing empty string to None but that results in an error. The error happens in graphql.utils.is_valid_value (see below).

"""
This part of the code from `graphql.utils.is_valid_value` returns errors 
when None value is returned from Decimal scalar
"""
parse_result = type.parse_value(value)
    if parse_result is None:
        return [u'Expected type "{}", found {}.'.format(type, json.dumps(value))]

UPDATE:
I dug my head out of the sand and realised that using null on the client is the obvious thing to do for clearing a value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions