99designs / 99designs/gqlgen

Duplicate ComplexityRoot object names

未关闭
#1,531 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
10.8k
派生
1.3k
平均合并
2 天 36 分钟
30 天内合并 PR
26

描述

### 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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。