walmartlabs / lacinia

GraphQL implementation in pure Clojure
http://lacinia.readthedocs.io/en/latest/
Other
1.81k stars 162 forks source link

Question: Query complexity and depth #450

Closed syunta closed 3 months ago

syunta commented 11 months ago

Hello. I'm using lacinia.

I was wondering if there is a way to quantify the Query Complexity as a cost in lacinia. By measuring the complexity of queries beforehand, I could protect the application from high-cost queries. I'm open to any method, whether it's an automatic calculation or a manual assignment of costs.

Also, if there are any other suitable approaches for lacinia, I'd love to hear about them.

Thank you!

hlship commented 4 months ago

This is something that can be addressed somewhat using the preview API, which gives you a view of the entire query. Identifying cost is tricky however ... it's very application specific.

syunta commented 3 months ago

Thank you for your response. I've decided to also use Persisted Queries to prevent unexpectedly executing complex and high-cost queries.