Skip to content

Built-in PageInfo conflicts with the same from external graphql schema #755

@astronom

Description

@astronom
Q A
Bug report? no
Feature request? no
BC Break report? no
RFC? yes
Version/Branch 0.13.x & dev-master

If your external graphql schema contains type PageInfo there is no way to disabled auto_discover in the config of the bundle for built-in types. When there is duplicates for type definitions it fails with ForbiddenOverwriteException('Types (%s) cannot be overwritten. See inheritance doc section for more details.')

src/DependencyInjection/Compiler/ConfigParserPass.php:156
    private function mappingConfig(array $config, ContainerBuilder $container)
    {
        // use default value if needed
        $config = \array_replace_recursive(self::$defaultDefaultConfig, $config);

        $mappingConfig = $config['definitions']['mappings'];
        $typesMappings = $mappingConfig['types'];

        // app only config files (yml or xml or graphql)
        if ($mappingConfig['auto_discover']['root_dir'] && $container->hasParameter('kernel.root_dir')) {
            $typesMappings[] = ['dir' => $container->getParameter('kernel.root_dir').'/config/graphql', 'types' => null];
        }
        if ($mappingConfig['auto_discover']['bundles']) {
            $mappingFromBundles = $this->mappingFromBundles($container);
            $typesMappings = \array_merge($typesMappings, $mappingFromBundles);
        } else {
            // enabled only for this bundle
            $typesMappings[] = [
                'dir' => $this->bundleDir(OverblogGraphQLBundle::class).'/Resources/config/graphql',
                'types' => ['yaml'],
            ];
        }

        // from config
        $typesMappings = $this->detectFilesFromTypesMappings($typesMappings, $container);

        return $typesMappings;
    }

Suggestion
add additional boolean auto_discover.built-in configuration option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions