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

Conversation

lyrixx
Copy link
Contributor

@lyrixx lyrixx commented Dec 14, 2017

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? I guess
Fixed tickets -
License MIT
Doc PR -

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 

->cannotBeEmpty()
->defaultValue('')
->end()
->scalarNode('vesion')
Copy link
Member

Choose a reason for hiding this comment

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

version

Copy link
Contributor Author

@lyrixx lyrixx Dec 14, 2017

Choose a reason for hiding this comment

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

Oups. Good catch. Thanks (We should never edit code on Github directly :p)

->scalarNode('version')
->info('The version of the API.')
->cannotBeEmpty()
->defaultValue('')
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason to delete the old default value (0.0.0)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shame on me !
The reason: I copy paste the previous block. It's not fixed.
So Sorry

@dunglas
Copy link
Member

dunglas commented Dec 15, 2017

Can you rebase against 2.1, as it's a bug fix? Thanks!

@lyrixx lyrixx changed the base branch from master to 2.1 December 15, 2017 12:53
@lyrixx
Copy link
Contributor Author

lyrixx commented Dec 15, 2017

@dunglas Here we go ;)

->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).

Copy link
Contributor

@sroze sroze left a comment

Choose a reason for hiding this comment

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

Yup, looks good 👍

@soyuka
Copy link
Member

soyuka commented Dec 19, 2017

I don't think failing test is related, maybe a rebase would fix CI.

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
```
@lyrixx
Copy link
Contributor Author

lyrixx commented Dec 19, 2017

I just rebased.

@soyuka soyuka merged commit 38d2168 into api-platform:2.1 Dec 19, 2017
@soyuka
Copy link
Member

soyuka commented Dec 19, 2017

Thanks @lyrixx !

@chalasr
Copy link
Contributor

chalasr commented Dec 19, 2017

#1563 (comment)

soyuka pushed a commit to soyuka/core that referenced this pull request Dec 20, 2017
soyuka pushed a commit to soyuka/core that referenced this pull request Dec 20, 2017
@lyrixx lyrixx deleted the patch-1 branch December 20, 2017 09:41
soyuka pushed a commit to soyuka/core that referenced this pull request Dec 20, 2017
soyuka pushed a commit to soyuka/core that referenced this pull request Dec 20, 2017
soyuka pushed a commit to soyuka/core that referenced this pull request Dec 20, 2017
soyuka pushed a commit to soyuka/core that referenced this pull request Dec 20, 2017
dunglas added a commit that referenced this pull request Dec 20, 2017
Fix null title/description configuration (#1563 followup)
hoangnd25 pushed a commit to hoangnd25/core that referenced this pull request Feb 23, 2018
[SymfonyBundle] Fixed the configuration
hoangnd25 pushed a commit to hoangnd25/core that referenced this pull request Feb 23, 2018
hoangnd25 pushed a commit to hoangnd25/core that referenced this pull request Feb 23, 2018
Fix null title/description configuration (api-platform#1563 followup)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants