Skip to content

[Validator] Add a new constraint message when there is both min and max #32435

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
Jul 12, 2019
Merged

[Validator] Add a new constraint message when there is both min and max #32435

merged 1 commit into from
Jul 12, 2019

Conversation

Lctrs
Copy link
Contributor

@Lctrs Lctrs commented Jul 8, 2019

Q A
Branch? 4.4
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets Part of #31503
License MIT
Doc PR to do

Currently, the failed validation messages in the Range constraint doesn't carry a notion of range. This can be confusing and error-prone if we report these messages to the user as-is.

This PR introduces a new message to the Range constraint (This value should be between {{ min }} and {{ max }}.) that will be displayed if both min and max are not null.

@Lctrs
Copy link
Contributor Author

Lctrs commented Jul 8, 2019

Mistake on my side. Label Deprecation is invalid.

@fabpot
Copy link
Member

fabpot commented Jul 12, 2019

Thank you @Lctrs.

@fabpot fabpot merged commit c5488bc into symfony:4.4 Jul 12, 2019
fabpot added a commit that referenced this pull request Jul 12, 2019
… both min and max (Lctrs)

This PR was squashed before being merged into the 4.4 branch (closes #32435).

Discussion
----------

[Validator] Add a new constraint message when there is both min and max

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | Part of #31503
| License       | MIT
| Doc PR        | to do

Currently, the failed validation messages in the `Range` constraint doesn't carry a notion of range. This can be confusing and error-prone if we report these messages to the user as-is.

This PR introduces a new message to the `Range` constraint (`This value should be between {{ min }} and {{ max }}.`) that will be displayed if both `min` and `max` are not `null`.

Commits
-------

c5488bc [Validator] Add a new constraint message when there is both min and max
@Lctrs Lctrs deleted the validator/range/new-message branch July 12, 2019 07:56
fabpot added a commit that referenced this pull request Jul 12, 2019
…nge validator (javiereguiluz)

This PR was submitted for the 4.4 branch but it was merged into the 3.4 branch instead (closes #32510).

Discussion
----------

[Validator] Added the Spanish translation for the new Range validator

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Translation for #32435.

Commits
-------

41f51fd [Validator] Added the Spanish translation for the new Range validator
fabpot added a commit that referenced this pull request Jul 12, 2019
…PReimers)

This PR was submitted for the 4.4 branch but it was merged into the 3.4 branch instead (closes #32518).

Discussion
----------

[Validator] Add german translation for Range validator

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

German translation for #32435

Commits
-------

d392e49 Add german translation for Range validator
fabpot added a commit that referenced this pull request Jul 12, 2019
…PReimers)

This PR was submitted for the 4.4 branch but it was merged into the 3.4 branch instead (closes #32519).

Discussion
----------

[Validator] Add danish translation for Range validator

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

Danish translation for #32435

Commits
-------

dc2e36d Add danish translation for Range validator
fabpot added a commit that referenced this pull request Jul 12, 2019
…ge validator (IonBazan)

This PR was submitted for the 4.4 branch but it was merged into the 3.4 branch instead (closes #32517).

Discussion
----------

[Validator] Added the Polish translation for the new Range validator

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

Polish translation for #32435.

Commits
-------

b35131a Add notInRange translation
javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this pull request Jul 12, 2019
…tion (Lctrs)

This PR was merged into the 4.4 branch.

Discussion
----------

[Validator] Document the new notInRangeMessage option

Ref. PR : symfony/symfony#32435

Close symfony#11952

Commits
-------

61641ca [Validator] Document the new notInRangeMessage option
fabpot added a commit that referenced this pull request Jul 15, 2019
…or (norkunas)

This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] Add Lithuanian translation for Range validator

| Q             | A
| ------------- | ---
| Branch?       | 3.4 <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | -   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | - <!-- required for new features -->

Translation for #32435.

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->

Commits
-------

20ef151 [Validator] Add Lithuanian translation for Range validator
fabpot added a commit that referenced this pull request Jul 15, 2019
This PR was squashed before being merged into the 3.4 branch (closes #32539).

Discussion
----------

[Validator] Add missing Hungarian translations

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | -  <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | - <!-- required for new features -->

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->

It has 2 messages translated to Hungarian introduced in #27738 and #32435. AFAIK it should be based on 3.4, but tell me if I should rebase any of the commits.

Commits
-------

2fee912 [Validator] Add missing Hungarian translations
symfony-splitter pushed a commit to symfony/validator that referenced this pull request Jul 15, 2019
This PR was squashed before being merged into the 3.4 branch (closes #32539).

Discussion
----------

[Validator] Add missing Hungarian translations

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | -  <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | - <!-- required for new features -->

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->

It has 2 messages translated to Hungarian introduced in symfony/symfony#27738 and symfony/symfony#32435. AFAIK it should be based on 3.4, but tell me if I should rebase any of the commits.

Commits
-------

2fee9124ba [Validator] Add missing Hungarian translations
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
This was referenced Nov 12, 2019
fabpot added a commit that referenced this pull request Aug 12, 2020
…d max are set (l-vo)

This PR was merged into the 4.4 branch.

Discussion
----------

[Validator] Add BC layer for notInRangeMessage when min and max are set

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #36133
| License       | MIT
| Doc PR        |

According to #36133, the improvement added in  #32435 may lead to a BC break when the developer pass `min` and `max` options and a custom `minMessage` or `maxMessage`. In this case it's expected to receive a `minMessage`/`maxMessage` in the violation but a `notInRangeMessage` is received instead.

So in the following conditions:
- `min` and `max` options are set
- `minMessage` or `maxMessage` is set

A deprecation is triggered. If a limit is violated and matches to the min/max message passed as option (`minMessage` for `min` violated and `maxMessage` for `max` violated), `minMessage/maxMessage` is used in the violation instead of `notInRangeMessage`.

Commits
-------

092d85c [Validator] Add BC layer for notInRangeMessage when min and max are set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants