From 6af25579c2362efd4892dfee8cab00fb9bae6bab Mon Sep 17 00:00:00 2001 From: Tobias Oitzinger Date: Wed, 8 Jan 2025 10:05:07 +0100 Subject: [PATCH] fix(graphql): register types for parameter args fix registering types for parameter arguments, by adding them to the type container. Closes: 6746 Signed-off-by: Tobias Oitzinger --- src/GraphQl/Type/FieldsBuilder.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/GraphQl/Type/FieldsBuilder.php b/src/GraphQl/Type/FieldsBuilder.php index 09529299815..823917bae96 100644 --- a/src/GraphQl/Type/FieldsBuilder.php +++ b/src/GraphQl/Type/FieldsBuilder.php @@ -415,7 +415,15 @@ private function getResourceFieldConfiguration(?string $property, ?string $field } $args = $this->getFilterArgs($args, $resourceClass, $rootResource, $resourceOperation, $rootOperation, $property, $depth); - $args = $this->getParameterArgs($rootOperation, $args); + + // Also register parameter args in the types container + // Note: This is a workaround, for more information read the comment on the parameterToObjectType function. + foreach ($this->getParameterArgs($rootOperation) as $key => $arg) { + if ($arg instanceof InputObjectType || (is_array($arg) && isset($arg['name']))) { + $this->typesContainer->set(is_array($arg) ? $arg['name'] : $arg->name(), $arg); + } + $args[$key] = $arg; + } } }