From 9dfb0a4815506f38a2f264af46bd22f7a51bb85e Mon Sep 17 00:00:00 2001 From: Owen Voke Date: Mon, 2 Sep 2024 11:11:27 +0100 Subject: [PATCH] fix: ensure `deprecationReason` is set for arguments --- CHANGELOG.md | 3 +++ src/Schema/AST/ASTHelper.php | 2 +- src/Schema/Factories/ArgumentFactory.php | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 103ab58a1..50d79e46d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ You can find and compare releases at the [GitHub release page](https://github.co ## Unreleased +### Fixed +- Ensure `deprecationReason` is set on arguments and input fields https://github.com/nuwave/lighthouse/pull/2609 + ## v6.44.0 ### Added diff --git a/src/Schema/AST/ASTHelper.php b/src/Schema/AST/ASTHelper.php index 0e41037d6..4f19ad136 100644 --- a/src/Schema/AST/ASTHelper.php +++ b/src/Schema/AST/ASTHelper.php @@ -327,7 +327,7 @@ public static function qualifiedArgType( } /** Given a collection of directives, returns the string value for the deprecation reason. */ - public static function deprecationReason(EnumValueDefinitionNode|FieldDefinitionNode $node): ?string + public static function deprecationReason(EnumValueDefinitionNode|FieldDefinitionNode|InputValueDefinitionNode $node): ?string { $deprecated = Values::getDirectiveValues( DirectiveDefinition::deprecatedDirective(), diff --git a/src/Schema/Factories/ArgumentFactory.php b/src/Schema/Factories/ArgumentFactory.php index b27ea469c..d3bab6e1d 100644 --- a/src/Schema/Factories/ArgumentFactory.php +++ b/src/Schema/Factories/ArgumentFactory.php @@ -50,6 +50,7 @@ public function convert(InputValueDefinitionNode $definitionNode): array 'name' => $definitionNode->name->value, 'description' => $definitionNode->description?->value, 'type' => $type, + 'deprecationReason' => ASTHelper::deprecationReason($definitionNode), 'astNode' => $definitionNode, ];