99designs / 99designs/gqlgen

generate cannot resolve custom slice type

未關閉
#2,848 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Go
星號
10.8k
分支
1.3k
平均合併
2 天 36 分鐘
30 天內合併 PR
26

描述

### What happened?

I used autobind to connect graphql to my custom types. My custom types include a field that is a type with the same underlying slice. However, when I do this, the `graph/schema.resolvers.go` now includes a resolver function for that type.

### What did you expect?

If I change my custom type to use `[]User` instead of `Users` then the custom resolver goes away.

I believe gqlgen should understand that this is the same type and should not require me to implement a custom resolver.

### Minimal graphql.schema and models to reproduce

```graphql
type Todo {
users: [User!]!
}

type User {
id: ID!
name: String!
}

type Query {
todos: [Todo!]!
}
```

```go
package graphql

type Todo struct {
Users Users
}

type Users []User

type User struct {
ID string
Username string
Extra string
}
```

```yaml
autobind:
- "path/to/my/types"
```

### versions
- `go run github.com/99designs/gqlgen version`? v0.17.40
- `go version`? go version go1.21.3 linux/amd64

## Extra Notes

Is this due to the type resolution not checking the underlying type for matches? If so, I am happy to try to implement this. I've started looking through the code but would appreciate pointers for where to look.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。