diff --git a/src/Bridge/Symfony/Bundle/DependencyInjection/Configuration.php b/src/Bridge/Symfony/Bundle/DependencyInjection/Configuration.php index 193a029227b..83fecafc9cc 100644 --- a/src/Bridge/Symfony/Bundle/DependencyInjection/Configuration.php +++ b/src/Bridge/Symfony/Bundle/DependencyInjection/Configuration.php @@ -90,16 +90,17 @@ public function getConfigTreeBuilder() ->addDefaultsIfNotSet() ->children() ->arrayNode('api_keys') - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('name') - ->info('The name of the header or query parameter containing the api key.') + ->prototype('array') + ->children() + ->scalarNode('name') + ->info('The name of the header or query parameter containing the api key.') + ->end() + ->enumNode('type') + ->info('Whether the api key should be a query parameter or a header.') + ->values(['query', 'header']) + ->end() ->end() - ->enumNode('type') - ->info('Whether the api key should be a query parameter or a header.') - ->values(['query', 'header']) - ->end() - ->end() + ->end() ->end() ->end() ->end() diff --git a/tests/Bridge/Symfony/Bundle/DependencyInjection/ConfigurationTest.php b/tests/Bridge/Symfony/Bundle/DependencyInjection/ConfigurationTest.php index 257e03b2f5c..0d14622171c 100644 --- a/tests/Bridge/Symfony/Bundle/DependencyInjection/ConfigurationTest.php +++ b/tests/Bridge/Symfony/Bundle/DependencyInjection/ConfigurationTest.php @@ -225,12 +225,12 @@ public function testApiKeysConfig() $config = $this->processor->processConfiguration($this->configuration, [ 'api_platform' => [ 'swagger' => [ - 'api_keys' => $exampleConfig, + 'api_keys' => [$exampleConfig], ], ], ]); $this->assertTrue(isset($config['swagger']['api_keys'])); - $this->assertSame($exampleConfig, $config['swagger']['api_keys']); + $this->assertSame($exampleConfig, $config['swagger']['api_keys'][0]); } }