99designs / 99designs/gqlgen

ComplexityLimit increments one point for Scalars as well

Đang mở
#2,367 7 bình luận 3 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ả

Hi,

Thank you for this amazing library, and all the hard work put into making this. It definitely makes my day-to-day life easier

### What happened?
- I used extenstion.FixedLimitComplexity(5)
### What did you expect?
- I expected the following behavior
```
query {
shop { # Object - 1 point
id # ID - 0 points
name # String - 0 points
timezoneOffsetMinutes # Int - 0 points
customerAccounts # Enum - 0 points
}
}
```
https://shopify.engineering/rate-limiting-graphql-apis-calculating-query-complexity

However, I noticed that the complexity is incremented by 1 even for scalar types. [This](https://github.com/99designs/gqlgen/blob/master/complexity/complexity.go#L45) is the line that is responsible for it.

If this is not the expected behavior, I'm happy to make the change to fix the issue. Please let me know.

Thanks

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.