fix: accept string-represented values in required array runtime validation (#5609)
* rename `listCheck` -> `arrayListCheck` * allow non-empty strings to quality a required array value
This commit is contained in:
@@ -602,6 +602,14 @@ describe("utils", function() {
|
||||
}
|
||||
value = []
|
||||
assertValidateParam(param, value, ["Required field is not provided"])
|
||||
|
||||
// invalid (empty) array, represented as a string
|
||||
param = {
|
||||
required: true,
|
||||
type: "array"
|
||||
}
|
||||
value = ""
|
||||
assertValidateParam(param, value, ["Required field is not provided"])
|
||||
|
||||
// invalid (not an array)
|
||||
param = {
|
||||
@@ -629,6 +637,14 @@ describe("utils", function() {
|
||||
}
|
||||
value = [1]
|
||||
assertValidateParam(param, value, [])
|
||||
|
||||
// valid array, with no 'type' for items, represented as a string
|
||||
param = {
|
||||
required: true,
|
||||
type: "array"
|
||||
}
|
||||
value = "[1]"
|
||||
assertValidateParam(param, value, [])
|
||||
|
||||
// valid array, items match type
|
||||
param = {
|
||||
|
||||
Reference in New Issue
Block a user