diff --git a/src/FederatedSchema.php b/src/FederatedSchema.php index 1704d07..af3682b 100644 --- a/src/FederatedSchema.php +++ b/src/FederatedSchema.php @@ -6,6 +6,7 @@ use GraphQL\Type\Schema; use GraphQL\Type\Definition\CustomScalarType; +use GraphQL\Type\Definition\Directive; use GraphQL\Type\Definition\ObjectType; use GraphQL\Type\Definition\UnionType; use GraphQL\Type\Definition\Type; @@ -63,7 +64,7 @@ class FederatedSchema extends Schema public function __construct($config) { $this->entityTypes = $this->extractEntityTypes($config); - $this->entityDirectives = Directives::getDirectives(); + $this->entityDirectives = array_merge(Directives::getDirectives(), Directive::getInternalDirectives()); $config = array_merge($config, $this->getEntityDirectivesConfig($config), $this->getQueryTypeConfig($config)); diff --git a/test/SchemaTest.php b/test/SchemaTest.php index 8f9b882..f41fefc 100644 --- a/test/SchemaTest.php +++ b/test/SchemaTest.php @@ -62,6 +62,12 @@ public function testDirectives() $this->assertArrayHasKey('external', $directives); $this->assertArrayHasKey('provides', $directives); $this->assertArrayHasKey('requires', $directives); + + // These are the default directives, which should not be replaced + // https://www.apollographql.com/docs/apollo-server/schema/directives#default-directives + $this->assertArrayHasKey('include', $directives); + $this->assertArrayHasKey('skip', $directives); + $this->assertArrayHasKey('deprecated', $directives); } public function testServiceSdl()