Closed
Description
Deployment Type
Self-hosted
NetBox Version
version-agnostic, seeing it on latest and develop
Python Version
3.11
Steps to Reproduce
- Create a custom field of type Integer, with a minimum value, say 2 and a maximum value, say 1000. Attach it in one or more Object Types, doesn't matter, just need one.
- Go to that Object and try to save a value for the custom_field that is less than the minimum, say, 1. This will fail as expected, as it's less than the minimum expected.
- The raised Validation Exception if you do so via the API will be something like:
RequestError: The request failed with code 400 Bad Request: {'__all__': ["Invalid value for custom field 'example': Value must be at least 1000"]}
The above example is via pynetbox, but it doesn't matter, the Exception Message would be the same in all cases.
Expected Behavior
ValidationError's message should be Invalid value for custom field 'example': Value must be at least 2"
Observed Behavior
Instead, the exception message reports the validation_maximum
instead of the validation_minimum
. It's a tiny typo in the CustomField model validation code, latest develop:
netbox/netbox/extras/models/customfields.py
Lines 662 to 664 in 8539686