private function getMetadataNode()
    {
        $node = $this->createRootNode('metadata');
        return $node
            ->addDefaultsIfNotSet()
            ->children()
                ->arrayNode('drivers')
                    ->defaultValue(['default' => ['type' => 'yml']])
                    ->useAttributeAsKey('name')
                    ->prototype('array')
                        ->performNoDeepMerging()
                        ->children()

                            ->enumNode('type')->defaultValue('yml')
                                ->values(['yml', null])
                            ->end()
                            ->scalarNode('service')->cannotBeEmpty()->end()

                            ->arrayNode('parameters')
                                ->performNoDeepMerging()
                                ->prototype('variable')->end()
                            ->end()

                        ->end()
                    ->end()
                    ->validate()
                        ->always(function($v) {
                            $this->validateMetadataDrivers($v);
                            return $v;
                        })
                    ->end()
                ->end()

                ->arrayNode('cache')
                    ->canBeDisabled()
                    ->children()

                        ->enumNode('type')->defaultValue('file')
                            ->values(['file', 'binary_file', 'redis', null])
                        ->end()
                        ->scalarNode('service')->cannotBeEmpty()->end()

                        ->arrayNode('parameters')
                            ->performNoDeepMerging()
                            ->prototype('variable')->end()
                        ->end()

                    ->end()

                    ->validate()
                        ->always(function($v) {
                            $this->validateMetadataCache($v);
                            return $v;
                        })
                    ->end()
                ->end()
            ->end()
        ;
    }