Skip to content

Commit

Permalink
fix(graphql): register types for parameter args
Browse files Browse the repository at this point in the history
fix registering types for parameter arguments, by adding them to the type container.

Closes: 6746
Signed-off-by: Tobias Oitzinger <[email protected]>
  • Loading branch information
toitzi committed Jan 8, 2025
1 parent c0c3f4c commit 6af2557
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/GraphQl/Type/FieldsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit 6af2557

Please sign in to comment.