Add support for creating Value::Number from i32
Jannis opened this issue · 5 comments
This would be super helpful to generate instances of Value::Number for testing. I think the ideal approach would be to add impl From<i64> for Number.
Well, maybe merging it was a mistake. The problem is that GraphQLInt is meant to be 32bit integer. So emitting large integer values might be a problem.
Can you explain it a little bit more? Maybe From<i32> would be enough?
I'd be fine with that but since there was .as_i64() already, I thought I'd propose the equivalent From implementation. For the purpose of creating Number values in tests, From<i32> would be sufficient.
Happy to send a follow-up PR for it.
Yes, let's make From<i32> . It's easier to make range of numbers wider than other way around.
(The as_i64 might also be a mistake, it was because serde_json has that function)