Closed flaviu-chelaru closed 9 months ago
I am also interested into this topic.
Hi @cfv1000, I downloaded your projet and run it without error.
Then I changed the graphql.yaml
file into a graphql.php
file like this:
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use function Symfony\Component\DependencyInjection\Loader\Configurator\param;
return static function (ContainerConfigurator $container): void {
$container->extension('overblog_graphql', [
// when using the param() function, you only have to pass the parameter name...
'definitions' => [
'schema' => [
'query' => 'RootQuery'
],
'mappings' => [
'types' => [
['type' => 'attribute', 'dir' => '%kernel.project_dir%/src/ApplicationBundle', 'suffix' => null]
]
]
]
]);
};
and run it again, and didn't get any error.
Do you mind to update your project with the configuration that leads to the error?
@Vincz - there is an open pull request - if you change the branch from main to that pull request branch, and run the command again you should get the same error as i had
Ok, I understand. When we use a mapping with attributes, we expect the configured directories to contain only PHP files containing classes.
That's why you get this error.
One solution is to exclude this directories from the mapping parsing or be more specific on the directories containing your mapping.
We could also check if the class does exist before trying to parse it in the MetadataParser
. Feel free to submit a PR if you want, otherwise, I'll add this later.
I created the following boilerplate https://github.com/cfv1000/symfony-graphql/pull/1
Given a bundle with a PHP Configuration, the command php bin/console graphql:validate will throw a MetadataParser exception at line 261
Under the following conditions
The library will break a feature supported by Symfony