Skip to content

Commit 07a0f9e

Browse files
committed
Fix merge conflict: make updates equivalent to the commit 4f958dd
1 parent 408c3e1 commit 07a0f9e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/SchemaBuilder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Apollo\Federation;
66

7+
use GraphQL\Type\Definition\Directive;
8+
79
class SchemaBuilder
810
{
911
/**
@@ -27,6 +29,9 @@ public function build(array $schemaConfig, array $builderConfig = []): Federated
2729
protected function getEntityDirectivesConfig(array $schemaConfig, array $builderConfig): array
2830
{
2931
$directives = array_intersect_key(Directives::getDirectives(), array_flip($builderConfig['directives']));
32+
if (array_intersect_key($directives, Directive::getInternalDirectives())) {
33+
throw new \LogicException('Some Apollo directives override internals.');
34+
}
3035
$schemaConfig['directives'] = array_merge($schemaConfig['directives'] ?? [], $directives);
3136

3237
return $schemaConfig;

test/StarWarsSchema.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Apollo\Federation\SchemaBuilder;
1010
use Apollo\Federation\Types\EntityObjectType;
1111
use Apollo\Federation\Types\EntityRefObjectType;
12+
use GraphQL\Type\Definition\Directive;
1213
use GraphQL\Type\Definition\ObjectType;
1314
use GraphQL\Type\Definition\Type;
1415

@@ -21,6 +22,7 @@ public static function getEpisodesSchema(): FederatedSchema
2122
{
2223
if (!self::$episodesSchema) {
2324
self::$episodesSchema = (new SchemaBuilder())->build([
25+
'directives' => Directive::getInternalDirectives(),
2426
'query' => self::getQueryType(),
2527
], [
2628
'directives' => DirectiveEnum::getAll(),
@@ -34,6 +36,7 @@ public static function getEpisodesSchemaCustomResolver(): FederatedSchema
3436
{
3537
if (!self::$overriddenEpisodesSchema) {
3638
self::$overriddenEpisodesSchema = (new SchemaBuilder())->build([
39+
'directives' => Directive::getInternalDirectives(),
3740
'query' => self::getQueryType(),
3841
'resolve' => function ($root, $args, $context, $info): array {
3942
return array_map(static function (array $ref) use ($info) {

0 commit comments

Comments
 (0)