graphql-go / graphql

An implementation of GraphQL for Go / Golang
MIT License
9.87k stars 839 forks source link

Feature Request: Need API to limit query complexity / depth #231

Open yookoala opened 7 years ago

yookoala commented 7 years ago

As title suggest. Library user would want to have a way to evaluate a graphql query complexity and refuse queries that are too complex.

djmcgreal commented 6 years ago

I believe https://www.npmjs.com/package/graphql-cost-analysis is the current JS library de jure. Potentially this doesn't go in the core go library?

genert commented 5 years ago

Bump.

niondir commented 4 years ago

For bigger projects complexity is quiet an important feature. What are the plans to implement it?

My feeling is that there is not much new development at all on this library.

sevenzhao commented 4 years ago

There is already an API to limit the query depth, but no API to limit the query complexity. The system should be protected from attack by complex querys. So there should be a API to limit query complexity.

hongbo-miao commented 3 years ago

FYI, if need, in JavaScript world, today graphql-query-complexity is better than graphql-cost-analysis now.

danielgtaylor commented 2 years ago

This looks like a port of graphql-cost-analysis into Go: https://github.com/koron-go/gqlcost

bielcarpi commented 3 months ago

Any news on this? I would be very interesting to have, as mentioned, something like graphql-cost-analysis for JS

maddsua commented 1 month ago

Bumping as this is a needed feature.

@sevenzhao wdym there's already a way to limit depth? I'm not sure what are you referring to, mind giving an example?