graphql-rust / graphql-client

Typed, correct GraphQL requests and responses in Rust
Apache License 2.0
1.15k stars 158 forks source link

Support JSONObject #397

Open cdknight opened 2 years ago

cdknight commented 2 years ago

This library seems to be lacking support for JSONObject, or maybe I'm holding it wrong.

mutation TestMutation($user_data: JSONObject) {
    testMutation(uuid: $uuid, userData: $user_data) {
        uuid
    }
}

JSONObject isn't a "custom" data type since I'm pretty sure it's part of the GraphQL spec. If I try to turn the aforementioned GraphQL into code, I get the error cannot find type `JSONObject` in module `super.

I should be able to "just" use JSONObject with this library, considering it's a part of GraphQL, but I'm not able to. Or maybe I'm mistaken.

jvliwanag commented 1 year ago

You can always create your own type mapping:

type JSONObject = serde_json::Map<String, serde_json::Value>;