We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Because now juniper does not support JSON scalar(#509), I have to pass a JSON Object using a piece of string, like:
let (res, errors) = juniper::execute_async( r#"mutation { createUser(input: { nickname: "nickname", avatar: "http://example.com", badges: "{\"Github\": \"https://github.com\"}"}) { id nickname } }"#, None, &schema, &Variables::new(), &ctx, ).await.unwrap();
And then I created a new Scalar type named JsonValue:
JsonValue
juniper::graphql_scalar!(JsonValue where Scalar = <S> { // other definitions... from_input_value(v: &InputValue) -> Option<JsonValue> { v.as_string_value().and_then(|s| { println!("input string: {:?}", s); serde_json::from_str(s).ok() }) } }
What I want is receiving a string like: {"Github": "https://github.com"}, but in fact, I get:
{"Github": "https://github.com"}
{\"Github\": \"https://github.com\"}
I wonder if this a feature? How can I pass the string from input object correctly?
The text was updated successfully, but these errors were encountered:
You appear to be using Rust raw string literals (r#...#) which means you do not need to escape " on the Rust side. See https://rahul-thakoor.github.io/rust-raw-string-literals/.
r#...#
"
Do you still see the resulting slashes if you remove them from the Rust side? If so please reopen!
Sorry, something went wrong.
No branches or pull requests
Because now juniper does not support JSON scalar(#509), I have to pass a JSON Object using a piece of string, like:
And then I created a new Scalar type named
JsonValue
:What I want is receiving a string like:
{"Github": "https://github.com"}
, but in fact, I get:I wonder if this a feature? How can I pass the string from input object correctly?
The text was updated successfully, but these errors were encountered: