diff --git a/src/core/utils.js b/src/core/utils.js index 771da4d0ec9..7a8a94c2afe 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -435,6 +435,7 @@ export const validatePattern = (val, rxPattern) => { function validateValueBySchema(value, schema, isParamRequired, bypassRequiredCheck, parameterContentMediaType) { if(!schema) return [] let errors = [] + let nullable = schema.get("nullable") let required = schema.get("required") let maximum = schema.get("maximum") let minimum = schema.get("minimum") @@ -447,6 +448,10 @@ function validateValueBySchema(value, schema, isParamRequired, bypassRequiredChe let minItems = schema.get("minItems") let pattern = schema.get("pattern") + if(nullable && value === null) { + return [] + } + /* If the parameter is required OR the parameter has a value (meaning optional, but filled in) then we should do our validation routine.