Skip to content

IntegerValidator: Default min/max values for 32 bit integers #42

@binaryDiv

Description

@binaryDiv

Currently, the IntegerValidator doesn't have defaults for min_value and max_value. Since Python allows for really big integers, this can cause problems with database backends (e.g. the MySQL INT type is 32 bits).

I think the use case of having a storage backend with a standard 32 bit integer size is way more common than the use case of validating integers that can be bigger than 2^32 (in most cases you'd probably use decimals or floats for that anyway), so setting default values to accommodate 32 bit integers seems like a good idea. If you do need bigger integers, you still can reset the values with min_value=None, max_value=None.

Proposed defaults:

min_value=-2147483648, max_value=2147483647

(Maybe use constants instead of magic numbers though)

(Also, technically this is a breaking change, though I doubt it will break any actual code.)

Metadata

Metadata

Assignees

Labels

breaking changesThis issue will cause a breaking change (or deprecation warning).

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions