Skip to content

Commit 47471be

Browse files
committed
[SymfonyBundle] Fixed the configuration
The value of title/description/version should not be empty. If there are empty, we got the following exception: ``` Type error: Argument 8 passed to ApiPlatform\Core\Bridge\Symfony\Bundle\Action\SwaggerUiAction::__construct() must be of the type string, null given, called in /var/www/server/backend/var/cache/dev/appDevDebugProjectContainer.php on line 1155 ``` How to reproduce: ``` #config.yml api_platform: title: #nothing explicitly ```
1 parent bd9aea7 commit 47471be

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/Bridge/Symfony/Bundle/DependencyInjection/Configuration.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,21 @@ public function getConfigTreeBuilder()
4040

4141
$rootNode
4242
->children()
43-
->scalarNode('title')->defaultValue('')->info('The title of the API.')->end()
44-
->scalarNode('description')->defaultValue('')->info('The description of the API.')->end()
45-
->scalarNode('version')->defaultValue('0.0.0')->info('The version of the API.')->end()
43+
->scalarNode('title')
44+
->info('The title of the API.')
45+
->cannotBeEmpty()
46+
->defaultValue('')
47+
->end()
48+
->scalarNode('description')
49+
->info('The description of the API.')
50+
->cannotBeEmpty()
51+
->defaultValue('')
52+
->end()
53+
->scalarNode('version')
54+
->info('The version of the API.')
55+
->cannotBeEmpty()
56+
->defaultValue('0.0.0')
57+
->end()
4658
->scalarNode('default_operation_path_resolver')
4759
->beforeNormalization()->always(function ($v) {
4860
@trigger_error('The use of the `default_operation_path_resolver` has been deprecated in 2.1 and will be removed in 3.0. Use `path_segment_name_generator` instead.', E_USER_DEPRECATED);

0 commit comments

Comments
 (0)