99designs / 99designs/gqlgen

Duplicate ComplexityRoot object names

Abierto
#1,531 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Go
Estrellas
10.8k
Forks
1.3k
Merge medio
2 d 36 min
PR fusionados (30 d)
26

Descripción

### What happened?

Duplicate ComplexityRoot object names

Error :

```
validation failed: packages.Load: /Users/akshaypatil/gqlgen-todos/graph/generated/generated.go:50:2: FooBar redeclared
/Users/akshaypatil/gqlgen-todos/graph/generated/generated.go:46:2: other declaration of FooBar
/Users/akshaypatil/gqlgen-todos/graph/generated/generated.go:98:26: e.complexity.FooBar.Dummy1 undefined (type struct{Dummy2 func(childComplexity int) int} has no field or method Dummy1)
/Users/akshaypatil/gqlgen-todos/graph/generated/generated.go:102:30: e.complexity.FooBar.Dummy1 undefined (type struct{Dummy2 func(childComplexity int) int} has no field or method Dummy1)
exit status 1
```

File: `generated.go`
```
type ComplexityRoot struct {
FooBar struct {
Dummy2 func(childComplexity int) int
}

FooBar struct {
Dummy1 func(childComplexity int) int
}

Mutation struct {
CreateTodo func(childComplexity int, input model.NewTodo) int
}

Query struct {
Todos func(childComplexity int) int
}

Todo struct {
FooBar func(childComplexity int) int
FooBarWithUnderscore func(childComplexity int) int
}
}
```

### What did you expect?

Object names in ComplexityRoot should be unique.

### Minimal graphql.schema and models to reproduce

File: `graph/schema.graphqls`
```
# GraphQL schema example
#
# https://gqlgen.com/getting-started/

type Todo {
fooBarWithUnderscore: Foo_Bar
fooBar: FooBar
}

type Foo_Bar {
dummy1: String
}

type FooBar {
dummy2: String
}

type Query {
todos: [Todo!]!
}

input NewTodo {
text: String!
userId: String!
}

type Mutation {
createTodo(input: NewTodo!): Todo!
}
```

File: `graph/model/types.go`
```
package model

type Foo_Bar struct {
Dummy1 *string `json:"dummy1"`
}

type FooBar struct {
Dummy2 *string `json:"dummy2"`
}
```

### versions
- `gqlgen version`?
v0.11.3
- `go version`?
go1.15.7
- dep or go modules?
go modules

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.