Skip to content

coerce str #103

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

Closed
wants to merge 1 commit into from
Closed

Conversation

ryanwang520
Copy link

It's convenient for frontend to pass str as some value of Int type, maybe it's too strict to reject valid int str .

By the way, I tried to upgrade a project from graphene 2 to graphene 3 and found that in graphene 2 str would coerce to int correctly while graphene 3 just throws the error Int cannot represent non-integer value: , which I think is caused by the coerce_int function here.

@Cito
Copy link
Member

Cito commented Aug 15, 2020

Thanks for contributing.

I looked into this and found that the addressed behavior and tests in GraphQL-core are the same as in GraphQL.js. Since the goal of GraphQL-core is to be a faithful replication of GraphQL.js which is considered the "reference implementation", I really do not want to introduce incompatible changes in GraphQL-core. If you think this really needs to be changed, you have two options: 1. Create an issue in the GraphQL.js project. and convince them to implement the change there - don't worry, they are open for such suggestions and discussions. If it is accepted, it will then be ported to GraphQL-core as well. 2. Try to change it at a higher level, e.g. in Graphene.

@ryanwang520
Copy link
Author

Ok, I would just try some other workaround. Thanks.

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 this pull request may close these issues.

2 participants