I'm trying to create mutation with graphql-go. I need to get object's nested element's args, but it's empty. How to fix it?
var mutationKittensType = graphql.NewObject(
graphql.ObjectConfig{
Name: "kittens",
Fields: graphql.Fields{
"littleName": &graphql.Field{
Type: graphql.String,
},
"age": &graphql.Field{
Type: graphql.Float,
},
},
},
)
var mutationPropertiesType = graphql.NewObject(
graphql.ObjectConfig{
Name: "properties",
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
},
"kittens": &graphql.Field{
Type: mutationKittensType,
},
},
},
)
var mutationType = graphql.NewObject(
graphql.ObjectConfig{
Name: "create_cat",
Fields: graphql.Fields{
"type": &graphql.Field{
Type: graphql.String,
},
"properties": &graphql.Field{
Type: mutationPropertiesType,
},
Resolve: func(params graphql.ResolveParams) (interface{}, error) {
log.Println("params.Args ", params.Args)
My curl is:
curl -XPOST http://localhost/graphql -H 'Content-Type: application/graphql' -d'mutation{create_cat(type:"persian", properties:{name: "alice", kittens:{littleName: "little alice", age: 1}}){type, properties{name, kittens:{littleName, age}}}}'
Terminal gives me this: params.Args map[ ]
Why is my params.Args empty and how to fix it?