Skip to content

Commit c983cf5

Browse files
authored
[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 a8f3d97 commit c983cf5

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
@@ -42,9 +42,21 @@ public function getConfigTreeBuilder()
4242

4343
$rootNode
4444
->children()
45-
->scalarNode('title')->defaultValue('')->info('The title of the API.')->end()
46-
->scalarNode('description')->defaultValue('')->info('The description of the API.')->end()
47-
->scalarNode('version')->defaultValue('0.0.0')->info('The version of the API.')->end()
45+
->scalarNode('title')
46+
->info('The title of the API.')
47+
->cannotBeEmpty()
48+
->defaultValue('')
49+
->end()
50+
->scalarNode('description')
51+
->info('The description of the API.')
52+
->cannotBeEmpty()
53+
->defaultValue('')
54+
->end()
55+
->scalarNode('vesion')
56+
->info('The version of the API.')
57+
->cannotBeEmpty()
58+
->defaultValue('')
59+
->end()
4860
->scalarNode('default_operation_path_resolver')
4961
->beforeNormalization()->always(function ($v) {
5062
@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)