99designs / 99designs/gqlgen

Duplicate ComplexityRoot object names

オープン
#1,531 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Go
スター
10.8k
フォーク
1.3k
平均マージ
2日 36分
マージ済み PR(30日)
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 を短くまとめたダイジェスト。