Generation fails for structs with fields to slice pointer types
- Ngôn ngữ chính
- Go
- Star
- 10.8k
- Fork
- 1.3k
- Merge trung bình
- 2 ngày 36 phút
- Pull request đã merge (30 ngày)
- 26
Mô tả
### 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`
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.