Revert "Add objectCheck"

This reverts commit 87d11f99dd.
This commit is contained in:
HelderSepu
2017-10-24 18:35:28 -04:00
parent 87d11f99dd
commit 43c5d9a8c9
2 changed files with 1 additions and 20 deletions

View File

@@ -568,7 +568,6 @@ export const validateParam = (param, isXml, isOAS3 = false) => {
// These checks should evaluate to true if the parameter's value is valid // These checks should evaluate to true if the parameter's value is valid
let stringCheck = type === "string" && value && !validateString(value) let stringCheck = type === "string" && value && !validateString(value)
let arrayCheck = type === "array" && Array.isArray(value) && value.length let arrayCheck = type === "array" && Array.isArray(value) && value.length
let objectCheck = type === "object" && value.length
let listCheck = type === "array" && Im.List.isList(value) && value.count() let listCheck = type === "array" && Im.List.isList(value) && value.count()
let fileCheck = type === "file" && value instanceof win.File let fileCheck = type === "file" && value instanceof win.File
let booleanCheck = type === "boolean" && !validateBoolean(value) let booleanCheck = type === "boolean" && !validateBoolean(value)
@@ -590,7 +589,7 @@ export const validateParam = (param, isXml, isOAS3 = false) => {
if (err) errors.push(err) if (err) errors.push(err)
} }
if ( required && !(stringCheck || objectCheck || arrayCheck || listCheck || fileCheck || booleanCheck || numberCheck || integerCheck) ) { if ( required && !(stringCheck || arrayCheck || listCheck || fileCheck || booleanCheck || numberCheck || integerCheck) ) {
errors.push("Required field is not provided") errors.push("Required field is not provided")
return errors return errors
} }

View File

@@ -326,24 +326,6 @@ describe("utils", function() {
expect( result ).toEqual( [] ) expect( result ).toEqual( [] )
}) })
it("validates required objects", function() {
// invalid object
param = {
required: true,
type: "object",
value: ""
}
assertValidateParam(param, ["Required field is not provided"])
// valid object
param = {
required: true,
type: "object",
value: "test"
}
assertValidateParam(param, [])
})
it("validates required strings", function() { it("validates required strings", function() {
// invalid string // invalid string
param = { param = {