graphql-client icon indicating copy to clipboard operation
graphql-client copied to clipboard

Support JSONObject

Open cdknight opened this issue 4 years ago • 1 comments

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.

cdknight avatar Nov 25 '21 01:11 cdknight

You can always create your own type mapping:

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

jvliwanag avatar Dec 14 '22 04:12 jvliwanag