Generation fails for structs with fields to slice pointer types
- Dominant language
- Go
- Stars
- 10.8k
- Forks
- 1.3k
- Avg merge
- 2d 36m
- Merged PRs (30d)
- 26
Description
### What happened?
#### Compilation error
Validation after generation fails. Marshal func has *v but object method has no pointer on the object.
```Error: validation failed: packages.Load: …/graphql/generated.go:2288:40: cannot use v (variable of type *domain.AppliedDiscounts) as domain.AppliedDiscounts value in argument to ec._AppliedDiscounts```
#### Observation
For the current master version:
This happens only for the field `Discounts *AppliedDiscounts` with an pointer to slice type.
Field `Test *string` works fine.
Generation of this case worked at least in v0.9.0.
### What did you expect?
Validation after generation succeeds.
### Minimal graphql.schema and models to reproduce
```
type (
Cart struct {
Discounts *AppliedDiscounts
Test *string
}
AppliedDiscounts []string
)
func (d *AppliedDiscounts) Get() string {
return "42"
}
```
```
type Cart {
discounts: AppliedDiscounts
test: String!
}
type AppliedDiscounts {
get: String!
}
````
### versions
- gqlgen version: `master`
- go version: `1.14.1`
- dep or go modules? `go modules`
Contributor guide
Assessment
This issue has not been assessed yet.