99designs / 99designs/gqlgen

Binding to a generic type

Open
#2,302 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
10.8k
Forks
1.3k
Avg merge
2d 36m
Merged PRs (30d)
26

Description

### What happened?

I tried to bind to a go1.18+ generic type. I tried the following config:
```yaml
mytype:
model: foo/bar.MyType
```

This generate invalid code and `gofmt` fail.
```yaml
mytype:
model: foo/bar.MyType[InnerType]
```

With this, gqlgen fail to find the type.

I didn't find anything suggesting that generic types are supported. Is that planned? Thanks for your work!

### What did you expect?

Working generated code, as if the underlying type wasn't a generic.

### Minimal graphql.schema and models to reproduce

Any generic type will do:

```go
type Foo[T any] struct {
Bar T
}
```

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.