Skip to content
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

Adding more verbose validation error messages in case of both "min_value" and "max_value" limits are set. #7777

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SergeyPiskunov
Copy link

Description

No global issues solved, just a tiny fix:

Imagine such a field within our API:
value = serializers.IntegerField(min_value=10, max_value=30)

Let's assume the User makes the request to our API with such a payload: {"value": 5}
The API answers: "Ensure this value is greater than or equal to 10"
User updates the payload with {"value": 50}
The API answers: "Ensure this value is less than or equal to 30"

With current fix the very first response from the API would be: "Ensure this value is in the range between 10 and 30." which is more verbose for the API users.

@stale
Copy link

stale bot commented Apr 29, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 29, 2022
Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

can you please rebase? there have two more PR merged in this section very recently

@stale stale bot removed the stale label Nov 24, 2022
@tomchristie
Copy link
Member

There's a trade-off here. Adding a more verbose validation error message, also means that we've then got a new untranslated string across all of our supported languages.

Personally I think that REST framework is far enough along it's lifecycle that we should be deal strictly with bug fixes and keeping pace with newer Django versions.

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.

3 participants