From 1777fc749d914c4a52536da963b7ff909592f256 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 1 Dec 2023 13:11:07 +0000 Subject: [PATCH 1/3] Fix switch validation of typeof field Fixes #4464 --- .../nodes/core/function/10-switch.html | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/function/10-switch.html b/packages/node_modules/@node-red/nodes/core/function/10-switch.html index 01ec78e19..c409f8d3b 100644 --- a/packages/node_modules/@node-red/nodes/core/function/10-switch.html +++ b/packages/node_modules/@node-red/nodes/core/function/10-switch.html @@ -176,14 +176,17 @@ for (var i=0;i Date: Fri, 1 Dec 2023 19:40:49 +0000 Subject: [PATCH 2/3] Update packages/node_modules/@node-red/nodes/core/function/10-switch.html --- .../node_modules/@node-red/nodes/core/function/10-switch.html | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/node_modules/@node-red/nodes/core/function/10-switch.html b/packages/node_modules/@node-red/nodes/core/function/10-switch.html index c409f8d3b..10fcf7356 100644 --- a/packages/node_modules/@node-red/nodes/core/function/10-switch.html +++ b/packages/node_modules/@node-red/nodes/core/function/10-switch.html @@ -184,7 +184,6 @@ } if (r.hasOwnProperty('v2')) { if ((msg = RED.utils.validateTypedProperty(r.v2,r.v2t,opt)) !== true) { - console.log('HERE2', msg) errors.push(msg) } } From eebab4a921bdf3e2b7b91d5308076b1cebfe23d3 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 6 Dec 2023 10:30:49 +0000 Subject: [PATCH 3/3] Relax some node validators to allow undefined value --- .../@node-red/editor-client/src/js/validators.js | 3 +++ .../node_modules/@node-red/nodes/core/function/16-range.html | 5 +---- packages/node_modules/@node-red/nodes/core/function/rbe.html | 4 ++-- .../node_modules/@node-red/nodes/core/parsers/70-HTML.html | 4 ++-- .../node_modules/@node-red/nodes/core/parsers/70-JSON.html | 2 +- .../node_modules/@node-red/nodes/core/parsers/70-XML.html | 2 +- .../node_modules/@node-red/nodes/core/parsers/70-YAML.html | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/validators.js b/packages/node_modules/@node-red/editor-client/src/js/validators.js index 43ac90270..1673495aa 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/validators.js +++ b/packages/node_modules/@node-red/editor-client/src/js/validators.js @@ -56,6 +56,9 @@ RED.validators = { if (options.allowBlank && v === '') { return true } + if (options.allowUndefined && v === undefined) { + return true + } const result = RED.utils.validateTypedProperty(v, ptype, opt) if (result === true || opt) { // Valid, or opt provided - return result as-is diff --git a/packages/node_modules/@node-red/nodes/core/function/16-range.html b/packages/node_modules/@node-red/nodes/core/function/16-range.html index 99e802902..ebf8340f8 100644 --- a/packages/node_modules/@node-red/nodes/core/function/16-range.html +++ b/packages/node_modules/@node-red/nodes/core/function/16-range.html @@ -58,11 +58,8 @@ round: {value:false}, property: {value:"payload",required:true, label:RED._("node-red:common.label.property"), - validate: RED.validators.typedInput({ type: 'msg' }) + validate: RED.validators.typedInput({ type: 'msg', allowBlank: true }) }, - - - // RED.validators.typedInput("propertyType", false)}, name: {value:""} }, inputs: 1, diff --git a/packages/node_modules/@node-red/nodes/core/function/rbe.html b/packages/node_modules/@node-red/nodes/core/function/rbe.html index e6e61c2ec..8dff0758d 100644 --- a/packages/node_modules/@node-red/nodes/core/function/rbe.html +++ b/packages/node_modules/@node-red/nodes/core/function/rbe.html @@ -57,10 +57,10 @@ septopics: {value:true}, property: {value:"payload", required:true, label:RED._("node-red:rbe.label.property"), - validate: RED.validators.typedInput({ type: 'msg' })}, + validate: RED.validators.typedInput({ type: 'msg', allowUndefined: true })}, topi: {value:"topic", required:true, label:RED._("node-red:rbe.label.topic"), - validate: RED.validators.typedInput({ type: 'msg' })} + validate: RED.validators.typedInput({ type: 'msg', allowUndefined: true })} }, inputs:1, outputs:1, diff --git a/packages/node_modules/@node-red/nodes/core/parsers/70-HTML.html b/packages/node_modules/@node-red/nodes/core/parsers/70-HTML.html index ee878428a..3357ae011 100644 --- a/packages/node_modules/@node-red/nodes/core/parsers/70-HTML.html +++ b/packages/node_modules/@node-red/nodes/core/parsers/70-HTML.html @@ -41,8 +41,8 @@ color:"#DEBD5C", defaults: { name: {value:""}, - property: {value:"payload", validate: RED.validators.typedInput({ type: 'msg' }) }, - outproperty: {value:"payload", validate: RED.validators.typedInput({ type: 'msg' }) }, + property: {value:"payload", validate: RED.validators.typedInput({ type: 'msg', allowUndefined: true }) }, + outproperty: {value:"payload", validate: RED.validators.typedInput({ type: 'msg', allowUndefined: true }) }, tag: {value:""}, ret: {value:"html"}, as: {value:"single"} diff --git a/packages/node_modules/@node-red/nodes/core/parsers/70-JSON.html b/packages/node_modules/@node-red/nodes/core/parsers/70-JSON.html index 612b26949..8c210f4ef 100644 --- a/packages/node_modules/@node-red/nodes/core/parsers/70-JSON.html +++ b/packages/node_modules/@node-red/nodes/core/parsers/70-JSON.html @@ -32,7 +32,7 @@ defaults: { name: {value:""}, property: {value:"payload",required:true, - validate: RED.validators.typedInput({ type: 'msg' }), + validate: RED.validators.typedInput({ type: 'msg', allowUndefined: true}), label:RED._("node-red:json.label.property")}, action: {value:""}, pretty: {value:false} diff --git a/packages/node_modules/@node-red/nodes/core/parsers/70-XML.html b/packages/node_modules/@node-red/nodes/core/parsers/70-XML.html index 6c5742b96..27f9795ef 100644 --- a/packages/node_modules/@node-red/nodes/core/parsers/70-XML.html +++ b/packages/node_modules/@node-red/nodes/core/parsers/70-XML.html @@ -28,7 +28,7 @@ name: {value:""}, property: {value:"payload",required:true, label:RED._("node-red:common.label.property"), - validate: RED.validators.typedInput({ type: 'msg' })}, + validate: RED.validators.typedInput({ type: 'msg', allowUndefined: true })}, attr: {value:""}, chr: {value:""} }, diff --git a/packages/node_modules/@node-red/nodes/core/parsers/70-YAML.html b/packages/node_modules/@node-red/nodes/core/parsers/70-YAML.html index ee6ab3937..a4c0d4de9 100644 --- a/packages/node_modules/@node-red/nodes/core/parsers/70-YAML.html +++ b/packages/node_modules/@node-red/nodes/core/parsers/70-YAML.html @@ -16,7 +16,7 @@ color:"#DEBD5C", defaults: { property: {value:"payload",required:true, - validate: RED.validators.typedInput({ type: 'msg' }), + validate: RED.validators.typedInput({ type: 'msg', allowUndefined: true }), label:RED._("node-red:common.label.property")}, name: {value:""} },