[go: up one dir, main page]

Skip to content

Commit

Permalink
Check required prop for each case instead of top level
Browse files Browse the repository at this point in the history
  • Loading branch information
GogoVega committed Jun 28, 2024
1 parent 19a8fa0 commit 2464d9a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions packages/node_modules/@node-red/editor-client/src/js/ui/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,26 +148,21 @@ RED.editor = (function() {
((typeof definition[property].label) == "string")) {
label = definition[property].label;
}
if ("required" in definition[property]) {
if (definition[property].required) {
valid = value !== "";
if (!valid && label) {
return RED._("validator.errors.missing-required-prop", {
prop: label
});
}
} else {
if ("required" in definition[property] && definition[property].required) {
valid = value !== "";
if (!valid && label) {
return RED._("validator.errors.missing-required-prop", {
prop: label
});
}
}
if (valid && "validate" in definition[property]) {
if (definition[property].hasOwnProperty("required") &&
definition[property].required === false) {
if (value === "") {
return true;
}
}

} else {
if (value === "") {
return true;
}
}
if (valid && "validate" in definition[property]) {
try {
var opt = {};
if (label) {
Expand All @@ -194,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";
Expand Down

0 comments on commit 2464d9a

Please sign in to comment.