Merge pull request #4812 from GogoVega/fix-required-prop

Fix node validation if the property is not required
This commit is contained in:
Nick O'Leary 2024-06-28 17:21:40 +01:00 committed by GitHub
commit da787a9993
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -157,6 +157,12 @@ RED.editor = (function() {
}
}
if (valid && "validate" in definition[property]) {
if (definition[property].hasOwnProperty("required") &&
definition[property].required === false) {
if (value === "") {
return true;
}
}
try {
var opt = {};
if (label) {
@ -183,6 +189,11 @@ RED.editor = (function() {
});
}
} else if (valid) {
if (definition[property].hasOwnProperty("required") && definition[property].required === false) {
if (value === "") {
return true;
}
}
// If the validator is not provided in node property => Check if the input has a validator
if ("category" in node._def) {
const isConfig = node._def.category === "config";