query($email:String){
getUserEmail(email: $email) {
name,
lastName
}
}
return
{
"data": null,
"errors": [
{
"message": "Unknown type "String".",
"locations": [
{
"line": 1,
"column": 16
}
]
}
]
}
solved problem!
This occurs when you have 2 types with the same name.
I hit this problem when trying to test a query with a schema that was not initialized (and hence was nil). Derp.
when there are 2 types with the same name there is an error in type loading.
Shouldn't we get a more explicit error message here?
@frranck
yes, it should of the problem in the application setup.
When is this problem happening? Is it when you have two different structs inside a struct with the same json tag and different definitions?
Came across the same issue and it took me ages to figure it out. Here is what @jonathanmsantosmoura meant by 2 types.
I had following 2 types defined.
var IntHistogramType = graphql.NewObject(
graphql.ObjectConfig{
Name: "histogram",
Fields: graphql.Fields{
"time": &graphql.Field{
Type: graphql.String,
},
"value": &graphql.Field{
Type: graphql.Int,
},
},
},
)
var FloatHistogramType = graphql.NewObject(
graphql.ObjectConfig{
Name: "histogram",
Fields: graphql.Fields{
"time": &graphql.Field{
Type: graphql.String,
},
"value": &graphql.Field{
Type: graphql.Float,
},
},
},
)
As you can see I have used the name "histogram" for both types.
As soon as these are added to my schema that crazy error occurred for all the queries with variables (even those are not related to these 2 types)
@frranck FYI
Most helpful comment
solved problem!
This occurs when you have 2 types with the same name.