nuwave / lighthouse

A framework for serving GraphQL from Laravel
https://lighthouse-php.com
MIT License
3.37k stars 439 forks source link

Offer Automatic persisted queries hash in the context #2589

Open mostafa-rz opened 4 months ago

mostafa-rz commented 4 months ago

I want to add the APQ hash to the context, to be accessible in all the resolvers.

What problem does this feature proposal attempt to solve?

It is useable as a unique cache key for identical requests in custom cache key implementation.

Which possible solutions should be considered?

If the feature is ok, I can send the PR.

spawnia commented 4 months ago

How would this interact with the configuration lighthouse.query_cache? I presume the hash would only be available if lighthouse.query_cache.enable is true?

mostafa-rz commented 4 months ago

yes, if the config is true then it returns the hash otherwise it is null.

spawnia commented 4 months ago

Alright, sounds good. I am not sure if the context interface can be extended without breaking changes, and how it interacts with features such as subscriptions - during which the context is serialized. Feel free to explore and contribute something, but perhaps think laterally.