graphql icon indicating copy to clipboard operation
graphql copied to clipboard

params.Args of the nested element is empty

Open mziia opened this issue 6 years ago • 3 comments

What am I trying to do:

                  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)`

For example, this curl:

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}}}}'

I got this:

params.Args map[ ]

Why is my params.Args empty and how to fix it?

mziia avatar Feb 18 '19 07:02 mziia

I have the same issue

Valdenirmezadri avatar Mar 25 '19 20:03 Valdenirmezadri

I have the same issue too, but my args is a list and I got a list with nil values

  addRule(
    name: "test",
    rule:"Meta[\"environment\"] in [\"dev\", \"test\"]",
    triggers: [{
      pre_condition: "a == b",
      action:"http",
      meta:"hello, world"
    }, {
      pre_condition: "a == b",
      action:"http",
      meta:"hello, world"
    }, {
      pre_condition: "a == b",
      action:"http",
      meta:"hello, world"
    }]
  ) {
    name
    description
    rule
  }

when I print triggers

[<nil> <nil> <nil>]

mylxsw avatar Aug 10 '19 09:08 mylxsw

has someone find a solution ?

constraintAutomaton avatar Aug 29 '21 17:08 constraintAutomaton