gqlgen: Getting started doc is broken to run init cmd

Expected Behaviour

should continue generate what ever it should.

Actual Behavior

merging failed: unable to build object definition: unable to find type github.com/99designs/gqlgen/graphql/introspection.InputValue

Minimal graphql.schema and models to reproduce

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

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

For anyone running into this issue on v0.17.8, @timohuovinen has the correct fix. You can force mod to grab the introspection directory by updating your tools.go:

//go:build tools
// +build tools

package tools

import (
	_ "github.com/99designs/gqlgen"
	_ "github.com/99designs/gqlgen/graphql/introspection"
)

Starting to see this issue again

Clearing out all the generated files, then executing:

go mod init

and then rerunning gqlgen resolved these types of issues for me.

Looks like the issue is caused by go not downloading the introspection directory, at least I don’t see it in my vendor, copying it over manually from this repo fixed the issue for me.