enhancing robustness of int/float castings for string values containing commas
Opened this issue · 0 comments
Speedy1991 commented
I run into this problem again and again and it is always annoying to fix it
Feature Request Type
- Core functionality
- Alteration (enhancement/optimization) of existing feature(s)
- New behavior
Description
ValueError: could not convert string to float: '3,3'
File "graphql/type/scalars.py", line 123, in serialize_float
num = output_value if isinstance(output_value, float) else float(output_value
Currently values with ,
will break int/float resolvers, but most times this is not a real error.
It would be awesome if we can handle ,
like .
if the value is a string like this:
output_value = output_value.replace(',', '.').strip() if isinstance(output_value, str) else output_value
num = output_value if isinstance(output_value, float) else float(output_value)
The same happens with integers
Upvote & Fund
- We're using Polar.sh so you can upvote and help fund this issue.
- We receive the funding once the issue is completed & confirmed by you.
- Thank you in advance for helping prioritize & fund our backlog.