Consistently name the first resolver argument and the root value#505
Consistently name the first resolver argument and the root value#505vladar merged 9 commits intowebonyx:masterfrom spawnia:root-value-consistent-naming
Conversation
|
Looks like there is some misunderstanding here. Let me try to explain. In general GraphQL deals with types and values. Resolver of each type field receives a value of this type. Only So the correct naming for the first resolver argument is either just |
# Conflicts: # docs/data-fetching.md # src/Executor/Executor.php # tests/Executor/DeferredFieldsTest.php
|
@vladar i get your point. Let's make it so that In nested resolvers, it would be optimal to have a speaking name for the argument, as you mentioned with I looked around the spec and reference implementation, they seem to use
I think My personal vote goes towards |
|
The problem I have with So I would suggest using As for Unfortunately the reference implementation uses this naming in Anyways if anyone else has their opinion - please let us know. |
|
Yeah, let's go with |
Unified all references to the root value to
mixed $rootValuefor consistency.The first resolver argument is now called
$objectValuewhen the type is not known. For root field resolvers, it is called$rootValue, for other fields it is named after the Object Type the fields are defined on.This is a non-breaking, trivial refactoring, as only argument names are changed.