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
Data is null when a number value is higher than i32 #980
Comments
The GraphQL spec doesn't support int64, I recommend using StringNumber instead. https://spec.graphql.org/October2021/#sec-Int
|
I see. Does this mean that the field of my struct should be a "String"? Or there is another type to use as a part of this limitation? |
I recommend using string, #[derive(SimpleObject)]
struct Obj {
int64_value: StringNumber<i64>,
} |
Thanks, will try it. |
How to import it? or Both did not work. |
Got it. Needed to add string_number to the features |
Cool StringNumber works fine, and it returns a string value. The only thing that I noticed that it does not implement the Default trait, which forces avoiding using the Default trait with the struct that uses it. Should we have a separate issue for this? |
Great idea, I've added it. |
As explained in the chain, StringNumber is what we need to handle numbers larger than i32. |
Expected Behavior
We should be able to use "SimpleObject" with a struct that has a field of the type i64
Actual Behavior
When the value of a field of the type i64 exceeds the limit of i32, queries always return null. This is even when we do not include this field in our selected fields
Steps to Reproduce the Problem
Specifications
Version:
async-graphql = { version = "4.0.4", features = ["apollo_tracing"] }
Platform:
Windows 11
The text was updated successfully, but these errors were encountered: