-
-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
@namespaced
directive for namespacing by separation of concerns
- Loading branch information
1 parent
63ce62e
commit b086f46
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace App\GraphQL\Directives; | ||
|
||
use Nuwave\Lighthouse\Schema\Directives\BaseDirective; | ||
use Nuwave\Lighthouse\Schema\Values\FieldValue; | ||
use Nuwave\Lighthouse\Support\Contracts\FieldResolver; | ||
|
||
final class NamespacedDirective extends BaseDirective implements FieldResolver | ||
{ | ||
public static function definition(): string | ||
{ | ||
return /** @lang GraphQL */ <<<'GRAPHQL' | ||
""" | ||
A no-op nested field resolver that allows nesting of queries and mutations. | ||
""" | ||
directive @namespaced on FIELD_DEFINITION | ||
GRAPHQL; | ||
} | ||
|
||
public function resolveField(FieldValue $fieldValue): callable | ||
{ | ||
return static fn (mixed $root): mixed => true; | ||
} | ||
} |