-
Notifications
You must be signed in to change notification settings - Fork 426
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
Using variables produces invalid value errors #390
Comments
Interesting. To clarify, |
Correct, the following also does not work. Also, strings and IDs seem ok, just tripping up on Ints and Floats, I have not tried all scalar types, or custom scalars.
|
More testing, enums work, chrono date time works. Right now just Int and Float seem to be the issue |
Running it as a test using the following works too. Status and propertyType are enums, bedrooms is i32/Int &vec![
(
"where".to_owned(),
InputValue::object(vec![("id", InputValue::scalar("xxxxxxxxx"))].into_iter().collect()),
),
(
"data".to_owned(),
InputValue::object(
vec![
("status", InputValue::scalar("OTHER")),
("propertyType", InputValue::scalar("OTHER")),
("bedrooms", InputValue::scalar(1)),
]
.into_iter()
.collect(),
),
),
]
.into_iter()
.collect(), |
OK, root cause identified, not sure if it is something juniper should handle or not though. This changes the behavior globally and causes the input validation for numbers only to fail. |
Ugh, that is annoying! Looks like this could be serde-rs/json#505 ? |
What server integration are you using this with? I might try the workaround in that bug. |
Warp, the serde_json config was due to an internal library that was a dependency of a dependency. |
I'm having the same issue. My queries accepting i32 on parameters always return errors such as: And this doesn't matter if it is an input object or a raw scalar, neither works. But if I parse them from a String, it works normally. Query:
Variables: {
"assetsToDeposit": [
{
"appid": 730,
"contextid": 2,
"assetid": ["17099917172"],
"price": "100"
}
]
} Response: {
"errors": [
{
"message": "Variable \"$assetsToDeposit\" got invalid value. In element #0: In field \"appid\": Expected \"Int\".",
"locations": [
{
"line": 1,
"column": 22
}
]
},
{
"message": "Variable \"$assetsToDeposit\" got invalid value. In element #0: In field \"contextid\": Expected \"Int\".",
"locations": [
{
"line": 1,
"column": 22
}
]
}
]
} #[derive(GraphQLInputObject, Clone, Debug)]
pub struct AssetNewTradeOffer {
appid: i32,
contextid: i32,
assetid: Vec<Long>,
price: Long,
}
async fn deposit_request(context: &Context, assets_to_deposit: Vec<AssetNewTradeOffer>) -> FieldResult<i32> { ... } After using I am not sure if this dep introduced this bug because until now, there were no queries with i32 only strings. |
Describe the bug
When using "variables" to sent a nested/complex object, the request fails with "got invalid value"
To Reproduce
vs
Produces the errors like:
Expected behavior
Should work/parse the same as the first example.
The text was updated successfully, but these errors were encountered: