5

I am trying to create a mutation that takes an input type FooInputType. My problem is having a field on that input to represent a JSON dictionary(string-string). for example, foo.tags field could have any set of key-value pairs of type string.

sample mutation:

{
  "query": "mutation ($foo: FooInputType) { addFoo(foo: $foo) { tags } }",
  "variables": {
    "foo": { "bar": "test", "tags": { "priority": "high" } }
  }
}

Here is the mutation:

class MyMutation : ObjectGraphType {
    public MyMutation() {
        Field<TaskItemType>("addFoo", "Add a new foo",
            new QueryArgument<FooInputType> {Name = "foo"}
        );
    }
}

And input type:

class FooInputType : InputObjectGraphType {
    public FooInputType() {
        Field<StringGraphType>("bar");
        Field<InputObjectGraphType<JObject>>("tags");
    }
}
Poulad
  • 1,149
  • 1
  • 12
  • 22

0 Answers0