99designs / 99designs/gqlgen

Function names updated incorrectly when containing `ID`

Đang mở
#3,313 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
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?

Change to `wordWalker` in `v0.17.55` unexpectedly changed all the `LT`/`EQ` function names if they contained `ID`

For example:

previous version correctly capitalized the `G` and `L` in these: (`v0.17.54`)

```
OwnerIDGt *string `json:"ownerIDGT,omitempty"`
OwnerIDGte *string `json:"ownerIDGTE,omitempty"`
OwnerIDLt *string `json:"ownerIDLT,omitempty"`
OwnerIDLte *string `json:"ownerIDLTE,omitempty"`
```

With the `v0.17.55` version they are lowercased
```
OwnerIdgt *string `json:"ownerIDGT,omitempty"`
OwnerIdgte *string `json:"ownerIDGTE,omitempty"`
OwnerIdlt *string `json:"ownerIDLT,omitempty"`
OwnerIdlte *string `json:"ownerIDLTE,omitempty"
```

This looks to be due to https://github.com/99designs/gqlgen/pull/3302/files

### What did you expect?

Functions correctly capitalized when containing the `ID`

### Minimal graphql.schema and models to reproduce

Adding the following test to `template_test.go:ToGo`:

```
require.Equal(t, "OwnerIDGT", ToGo("OwnerIDGT"))
```

```
Error Trace: /Users/sarahfunkhouser/go/src/github.com/golanglemonade/gqlgen/codegen/templates/templates_test.go:59
Error: Not equal:
expected: "OwnerIDGT"
actual : "OwnerIdgt"
```

### versions
- `go run github.com/99designs/gqlgen version`? v0.17.55
- `go version`? 1.23.2

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

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

Đánh giá

Issue này chưa được đánh giá.

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.