Skip to content

Commit

Permalink
add consistent docs to master and 6th version
Browse files Browse the repository at this point in the history
  • Loading branch information
k0ka committed Aug 22, 2024
1 parent b8451f4 commit b3b42b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions docs/6/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
6 changes: 3 additions & 3 deletions docs/master/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);
```

0 comments on commit b3b42b0

Please sign in to comment.