Closed Bastianowicz closed 1 year ago
Well it was definitely our issue not yours. We were being helped in the symfony devs channel. The Problem for us was that we had not yet defined any providers and thus no types were being merged in the RootQuery. So what finally helped us was the following snippet. Something comparable would've helped us in the docs but maybe we just followed the wrong path.
#[GQL\Provider]
class MeResolver implements QueryInterface
{
public function __construct(private TokenStorageInterface $tokenStorage)
{
}
#[GQL\Query(name: 'me', type: 'User')]
public function __invoke(): ?User
{
return $this->tokenStorage->getToken()?->getUser();
}
}
I get same error and no solution work. I guess doc should be updated to be easily use with php attributes or annotations.
Reproduction
Expected
Experienced
Stack Trace
``` Symfony\Component\Config\Definition\Exception\InvalidConfigurationException: The path "overblog_graphql_types.RootQuery._object_config.fields" should have at least 1 element(s) defined. in webupdater/vendor/symfony/config/Definition/PrototypedArrayNode.php:184 Code: 0 Stack trace: #0 webupdater/vendor/symfony/config/Definition/BaseNode.php (455): Symfony\Component\Config\Definition\PrototypedArrayNode->finalizeValue(Array(0)) #1 webupdater/vendor/symfony/config/Definition/ArrayNode.php (245): Symfony\Component\Config\Definition\BaseNode->finalize(Array(0)) #2 webupdater/vendor/symfony/config/Definition/BaseNode.php (455): Symfony\Component\Config\Definition\ArrayNode->finalizeValue(Array(3)) #3 webupdater/vendor/symfony/config/Definition/ArrayNode.php (245): Symfony\Component\Config\Definition\BaseNode->finalize(Array(3)) #4 webupdater/vendor/symfony/config/Definition/BaseNode.php (455): Symfony\Component\Config\Definition\ArrayNode->finalizeValue(Array(5)) #5 webupdater/vendor/symfony/config/Definition/PrototypedArrayNode.php (177): Symfony\Component\Config\Definition\BaseNode->finalize(Array(3)) #6 webupdater/vendor/symfony/config/Definition/BaseNode.php (455): Symfony\Component\Config\Definition\PrototypedArrayNode->finalizeValue(Array(3)) #7 webupdater/vendor/symfony/config/Definition/Processor.php (36): Symfony\Component\Config\Definition\BaseNode->finalize(Array(3)) #8 webupdater/vendor/symfony/config/Definition/Processor.php (46): Symfony\Component\Config\Definition\Processor->process(Object: Symfony\Component\Config\Definition\PrototypedArrayNode, Array(1)) #9 webupdater/vendor/overblog/graphql-bundle/src/DependencyInjection/Compiler/ConfigParserPass.php (79): Symfony\Component\Config\Definition\Processor->processConfiguration(Object: Overblog\GraphQLBundle\DependencyInjection\TypesConfiguration, Array(1)) #10 webupdater/vendor/overblog/graphql-bundle/src/DependencyInjection/Compiler/ConfigParserPass.php (73): Overblog\GraphQLBundle\DependencyInjection\Compiler\ConfigParserPass->processConfiguration(Array(1)) #11 webupdater/vendor/symfony/dependency-injection/Compiler/Compiler.php (82): Overblog\GraphQLBundle\DependencyInjection\Compiler\ConfigParserPass->process(Object: Symfony\Component\DependencyInjection\ContainerBuilder) #12 webupdater/vendor/symfony/dependency-injection/ContainerBuilder.php (757): Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object: Symfony\Component\DependencyInjection\ContainerBuilder) #13 webupdater/vendor/symfony/http-kernel/Kernel.php (546): Symfony\Component\DependencyInjection\ContainerBuilder->compile() #14 webupdater/vendor/symfony/http-kernel/Kernel.php (787): Symfony\Component\HttpKernel\Kernel->initializeContainer() #15 webupdater/vendor/symfony/http-kernel/Kernel.php (190): Symfony\Component\HttpKernel\Kernel->preBoot() #16 webupdater/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php (35): Symfony\Component\HttpKernel\Kernel->handle(Object: Symfony\Component\HttpFoundation\Request) #17 webupdater/vendor/autoload_runtime.php (35): Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run() #18 apiv2/public/index.php (9): require_once("/srv/www/vhosts/webroot/html/webupdater/vendor/autoload_runtime.php") ```Code
/config/packages/graphql.yaml
/config/bundles.php
/config/services.yaml
/src/GraphQL/RootQuery.php
/src/GraphQL/TestType.php
Further Information
Maybe this is not a bug but simply misunderstanding or misleading docs. We appreciate every kind of help here.