keystonejs/keystone-classic
View on GitHubTextType - Over-length value validates when both max and min specified
Open
#4536 opened on Dec 28, 2017
4.x candidatebughelp wanted
Description
Expected behavior
When both max and min are specified in a field definition, over length strings should be refused.
Actual/Current behavior
Over length string accepted
Steps to reproduce the actual/current behavior
Define a field as per below:
name: { type: Types.Text, required: true, min: 3, max: 5 },
Enter a string longer than 5 characters
Submit
Environment
Keystone master (0ca9eb18c00fb051c579105ae7d283f98b182d8d) Node v9.2.0
Notes
Issue seems to be caused by a922b38a12bad632ef6f5d992ea91b363bb78d4f. If min length validation passes, all other validation results are discarded.