Trying to setup custom models in a project but gqlgen fails with:
$ go run github.com/99designs/gqlgen
merging failed: unable to build object definition: unable to find type github.com/jasonwilson/todos/todos.Todo
exit status 3
gqlgen should be able to locate custom models specified in gqlgen.yml
schema.graphql
type Todo {
id: ID!
text: String!
done: Boolean!
user: User!
}
type User {
id: ID!
name: String!
}
type Query {
todos: [Todo!]!
}
input NewTodo {
text: String!
userId: String!
}
type Mutation {
createTodo(input: NewTodo!): Todo!
}
todos.go
package todos
type Todo struct {
ID string
Text string
Done bool
UserID string
}
gqlgen.yml
schema:
- schema.graphql
exec:
filename: generated.go
model:
filename: models_gen.go
resolver:
filename: resolver.go
type: Resolver
models:
Todo:
model: github.com/jasonwilson/todos/todos.Todo
autobind: []
gqlgen version? 0.9.1go version? go1.12.6 darwin/amd64This turned out to be user error, nested models should be referenced from the parent module.
What did you do to fix this i followed the totorial exzactly and got the same issue.
I find it hard to beleave that go whould force you to make a github repo for evry project you make ?
Most helpful comment
What did you do to fix this i followed the totorial exzactly and got the same issue.
I find it hard to beleave that go whould force you to make a github repo for evry project you make ?