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

Empty value for Decimal scalar #927

Closed
hgylfason opened this issue Mar 22, 2019 · 0 comments · May be fixed by #1360
Closed

Empty value for Decimal scalar #927

hgylfason opened this issue Mar 22, 2019 · 0 comments · May be fixed by #1360

Comments

@hgylfason
Copy link

hgylfason commented Mar 22, 2019

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.

@hgylfason hgylfason changed the title Decimal scalar and empty values Empty value for Decimal scalar Mar 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant