#34071 closed Cleanup/optimization (fixed)

Unclear validator messages for Range(Min/Max)ValueValidator compared to docs.

Reported by: Jack Linke Owned by: Jack Linke
Component: contrib.postgres Version: dev
Severity: Normal Keywords: postgres, range, validator, validators
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The wording in the documentation for RangeMaxValueValidator and RangeMinValueValidator is very clear:

"Validates that the upper bound of the range is not greater than limit_value."
"Validates that the lower bound of the range is not less than the limit_value."

https://github.com/django/django/blob/0dd29209091280ccf34e07c9468746c396b7778e/docs/ref/contrib/postgres/validators.txt

The wording in the validator messages (and validator test messages) within the code itself is somewhat confusing in comparison:

"Ensure that this range is completely less than or equal to %(limit_value)s."
"Ensure that this range is completely greater than or equal to %(limit_value)s."

https://github.com/django/django/blob/0dd29209091280ccf34e07c9468746c396b7778e/django/contrib/postgres/validators.py
https://github.com/django/django/blob/0dd29209091280ccf34e07c9468746c396b7778e/tests/postgres_tests/test_ranges.py

Recommending a patch to modify the messages in the validator (and validator test) code to match the documentation, making it more clear to users exactly what the range validators do.


Patch 16146 on Django's GitHub PR tracker should resolve this. https://github.com/django/django/pull/16146

Change History (3)

comment:1 by Mariusz Felisiak, 19 months ago

Easy pickings: set
Owner: set to Jack Linke
Status: newassigned
Summary: Unclear / mismatched validator messages in code for RangeMaxValueValidator & RangeMinValueValidator compared to docsUnclear validator messages for Range(Min/Max)ValueValidator compared to docs.
Triage Stage: UnreviewedAccepted

comment:2 by Mariusz Felisiak, 19 months ago

Triage Stage: AcceptedReady for checkin

comment:3 by Mariusz Felisiak <felisiak.mariusz@…>, 19 months ago

Resolution: fixed
Status: assignedclosed

In 344d31c7:

Fixed #34071 -- Improved error message for Range(Min/Max)ValueValidator.

Note: See TracTickets for help on using tickets.
Back to Top