graphql-go / graphql

An implementation of GraphQL for Go / Golang
MIT License
9.91k stars 839 forks source link

Variable "" cannot be non-input type "Int!"." #464

Closed Valdenirmezadri closed 5 years ago

Valdenirmezadri commented 5 years ago

Good morning.

I'm having a very strange error and I can not figure out what it is

if I pass variables of type string, queries work screenshot_20-03-2019:10:06:09

Any other type generates error screenshot_20-03-2019:10:06:18

however, if I pass the values straight, it works screenshot_20-03-2019:10:09:29

my code:

GetMensagens = graphql.Field{ Name: "getMensagens", Type: graphql.NewList(mensagemType), Description: "Pega todas as mensagens de uma conversa pelo id da conversa", Args: graphql.FieldConfigArgument{ "conversaID": &graphql.ArgumentConfig{ Type: graphql.NewNonNull( graphql.Int, ), }, }, Resolve: func(params graphql.ResolveParams) (interface{}, error) { println("#### cheguei aqui #######") return nil, errors.New("Resolved ") },

the login code:

graphql.Field{ Name: "login", Type: loginType, Description: "executa o login com e-mail e senha", Args: graphql.FieldConfigArgument{ "email": &graphql.ArgumentConfig{ Type: graphql.NewNonNull(graphql.String), }, "senha": &graphql.ArgumentConfig{ Type: graphql.NewNonNull(graphql.String), }, }, Resolve: resolveLogin, }

Valdenirmezadri commented 5 years ago

I figured out what the problem was, there were two declared schemas

vincent-scw commented 5 years ago

hi @Valdenirmezadri , I'm running into the same issue. Could you please explain how did you resolve it? What did you mean "two declared schemas"?

Valdenirmezadri commented 5 years ago

hi @Valdenirmezadri , I'm running into the same issue. Could you please explain how did you resolve it? What did you mean "two declared schemas"?

I created two schema, one was a test, and I was just declaring the wrong