From b3b42b009dbba11792b86a7b029c520c6c29b6ed Mon Sep 17 00:00:00 2001 From: Konstantin Babushkin Date: Thu, 22 Aug 2024 17:35:38 +0200 Subject: [PATCH] add consistent docs to master and 6th version --- docs/6/performance/query-caching.md | 8 ++++++++ docs/master/security/validation.md | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/6/performance/query-caching.md b/docs/6/performance/query-caching.md index 2af2f17152..313822b3f6 100644 --- a/docs/6/performance/query-caching.md +++ b/docs/6/performance/query-caching.md @@ -15,6 +15,14 @@ Lighthouse supports Automatic Persisted Queries (APQ), compatible with the APQ is enabled by default, but depends on query caching being enabled. +## Query validation caching + +Lighthouse can cache the result of the query validation process as well. It only caches queries without errors. +`QueryComplexity` validation can not be cached as it is dependent on the query, so it is always executed. + +Query validation caching is disabled by default. You can enable it by setting `validation_cache.enable` to `true` in the +configuration in `config/lighthouse.php`. + ## Testing caveats If you are mocking Laravel cache classes like `\Illuminate\Support\Facades\Cache` or `\Illuminate\Cache\Repository` and asserting expectations in your unit tests, it might be best to disable the query cache in your `phpunit.xml`: diff --git a/docs/master/security/validation.md b/docs/master/security/validation.md index c57bac35ea..b391e30089 100644 --- a/docs/master/security/validation.md +++ b/docs/master/security/validation.md @@ -314,12 +314,12 @@ By default, Lighthouse enables all default query validation rules from `webonyx/ This covers fundamental checks, e.g. queried fields match the schema, variables have values of the correct type. If you want to add custom rules or change which ones are used, you can bind a custom implementation -of the interface `\Nuwave\Lighthouse\Support\Contracts\ProvidesValidationRules` through a service provider. +of the interface `\Nuwave\Lighthouse\Support\Contracts\ProvidesCacheableValidationRules` through a service provider. ```php use Nuwave\Lighthouse\Support\Contracts\ProvidesValidationRules; -final class MyCustomRulesProvider implements ProvidesValidationRules {} +final class MyCustomRulesProvider implements ProvidesCacheableValidationRules {} -$this->app->bind(ProvidesValidationRules::class, MyCustomRulesProvider::class); +$this->app->bind(ProvidesCacheableValidationRules::class, MyCustomRulesProvider::class); ```