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
Add validation for min and max length #3701
Conversation
src/core/utils.js
Outdated
@@ -535,6 +549,16 @@ export const validateParam = (param, isXml) => { | |||
let numberCheck = type === "number" && !validateNumber(value) // validateNumber returns undefined if the value is a number | |||
let integerCheck = type === "integer" && !validateInteger(value) // validateInteger returns undefined if the value is an integer | |||
|
|||
if (maxLength) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's worth noting that 0
will fail this conditional, but I can't see why you'd ever want to set minLength: 0
or maxLength: 0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ye, I think that might play a bigger role on PR #3703 but here is not relevant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just discussed this with @webron - maxLength: 0
is funky, but valid, so that case needs to be handled 😄
minLength: 0
, though, is not an issue, because nothing can be length < 0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maxLength
validation needs to account for the case where maxLength === 0
.
I'll make these changes now.
Hey @heldersepu, I'm not able to push to your remote in order to change this PR. I think it has something to do with the source branch being Here are the changes I was trying to apply, in patch format: maxlength-0-validation.patch.zip Please apply the patch to your branch ( |
Thanks @heldersepu! |
This address some of the validation requested on Issue #993