Skip to content

[SymfonyBundle] Fixed the configuration #1563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/Bridge/Symfony/Bundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,21 @@ public function getConfigTreeBuilder()

$rootNode
->children()
->scalarNode('title')->defaultValue('')->info('The title of the API.')->end()
->scalarNode('description')->defaultValue('')->info('The description of the API.')->end()
->scalarNode('version')->defaultValue('0.0.0')->info('The version of the API.')->end()
->scalarNode('title')
->info('The title of the API.')
->cannotBeEmpty()
->defaultValue('')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it useless given the node that cannot be empty?

Copy link
Member

@dunglas dunglas Dec 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact we must allow empty strings, but not null. Maybe should be just normalize all empty values to ''?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, the config here is simpler than normalizing everything ...

Copy link
Contributor

@chalasr chalasr Dec 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but forbids empty strings, thus breaks with the default value

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree we must allow empty strings or it will be a big BC break (for instance the Flex recipe doesn’t set those keys).

->end()
->scalarNode('description')
->info('The description of the API.')
->cannotBeEmpty()
->defaultValue('')
->end()
->scalarNode('version')
->info('The version of the API.')
->cannotBeEmpty()
->defaultValue('0.0.0')
->end()
->scalarNode('default_operation_path_resolver')
->beforeNormalization()->always(function ($v) {
@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);
Expand Down