Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
k0ka committed Aug 22, 2024
1 parent e5c3fcb commit fe03ff0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/6/security/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
```
8 changes: 8 additions & 0 deletions docs/master/performance/query-caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down

0 comments on commit fe03ff0

Please sign in to comment.