Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Benedikt Franke <[email protected]>
  • Loading branch information
k0ka and spawnia authored Sep 19, 2024
1 parent ee4f3e2 commit 6f69bde
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
7 changes: 4 additions & 3 deletions docs/master/performance/query-caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ 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.
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`.
Query validation caching is disabled by default.
You can enable it by setting `validation_cache.enable` to `true` in `config/lighthouse.php`.

## Testing caveats

Expand Down
1 change: 0 additions & 1 deletion src/LighthouseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ public function provideSubscriptionResolver(FieldValue $fieldValue): \Closure
}
});

// $this->app->bind(ProvidesValidationRules::class, ValidationRulesProvider::class);
$this->app->bind(ProvidesValidationRules::class, CacheableValidationRulesProvider::class);

$this->commands(self::COMMANDS);
Expand Down
4 changes: 2 additions & 2 deletions src/Support/Contracts/ProvidesCacheableValidationRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface ProvidesCacheableValidationRules extends ProvidesValidationRules
/**
* A set of rules for the first query validation step.
*
* These rules would be executed first and their result would be cached.
* These rules are executed first and their result is cached.
*
* @return array<string, \GraphQL\Validator\Rules\ValidationRule>
*/
Expand All @@ -16,7 +16,7 @@ public function cacheableValidationRules(): array;
/**
* A set of rules for the second query validation step.
*
* These rules would always be executed and not cached.
* These rules are always be executed and not cached.
*
* Returning `null` enables all available rules.
* Empty array skips query validation entirely.
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/ValidationCachingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Tests\TestCase;
use Tests\Utils\Queries\Foo;

class ValidationCachingTest extends TestCase
final class ValidationCachingTest extends TestCase
{
public function testEnabled(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Schema/AST/DocumentASTTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ public function testBeSerialized(): void
$this->assertInstanceOf(SchemaExtensionNode::class, $schemaExtension);
$this->assertInstanceOf(DirectiveNode::class, $schemaExtension->directives[0]);

$this->assertEquals($documentAST->hash, $reserialized->hash);
$this->assertSame($documentAST->hash, $reserialized->hash);
}
}

0 comments on commit 6f69bde

Please sign in to comment.