99designs / 99designs/gqlgen

Federation entity resolver generation

Đang mở
#1,454 4 bình luận 2 reaction 0 người được giao Xem trên GitHub
accepted bug
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ả

A combination of https://github.com/99designs/gqlgen/issues/1388 & https://github.com/99designs/gqlgen/issues/1429

### What happened?
`{Entity}Resolver`'s are not generated (example [example/federation/reviews/graph/schema.resolvers.go](https://github.com/99designs/gqlgen/blob/master/example/federation/reviews/graph/schema.resolvers.go#L13-L44)) without specifying an explicit custom model (e.g. [example/federation/reviews/graph/model/models.go](https://github.com/99designs/gqlgen/blob/master/example/federation/reviews/graph/model/models.go))

Replication in the examples:

```
cd example/federation/reviews
rm graph/model/models.go
go generate server.go
```

```
validation failed: packages.Load: gqlgen/example/federation/reviews/graph/schema.resolvers.go:38:40: ProductResolver not declared by package generated
gqlgen/example/federation/reviews/graph/schema.resolvers.go:41:37: UserResolver not declared by package generated

exit status 3
```

### What did you expect?

I expected that generated Entitys would also generate the EntityResolver's? Is this not the case by design?

### Minimal graphql.schema and models to reproduce

```
type Review {
body: String!
}

extend type User @key(fields: "id") {
id: ID! @external
reviews: [Review]
}
```

### versions
- `gqlgen version`? v0.13.0
- `go version`? 1.14
- dep or go modules?


### Notes
Looking into the code a little more, I assume the issue is arising from `codegen/config/config.go` - `Init()`

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Vấn đề nằm trong ví dụ federation; hãy bắt đầu bằng cách kiểm tra example/federation/reviews/graph/schema.resolvers.go và mã được sinh ra. Vấn đề có khả năng liên quan đến phương thức Init() của config.go. Chạy các bước tái hiện để xem lỗi xác thực, sau đó lần theo cách các entity resolvers được sinh ra khi không có custom models. Kiểm tra logic sinh mã federation để hiểu việc sinh resolver bị thiếu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
go
Lĩnh vực
backend-api-design
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.