Hi team,
Each node has a validationErrors
property which contains either the name of the property in error or a validation error message. It seems that config-nodes do not use this validationErrors
property if the validation comes from a credential , @knolleary is this a limitation?
Is it also possible to show that a config node is in error as the following issue suggests?
opened 03:57PM - 27 Oct 23 UTC
needs-triage
### Current Behavior
<img width="506" alt="Screenshot 2023-10-27 at 16 55 12" s… rc="https://github.com/node-red/node-red/assets/99246719/b5420f69-9fb9-49cc-aa9c-729a1efdacbb">
If a config node has an error in validation, in this case, `ui-page` doesn't have a required `ui-base` property assigned, then the reporting of this could be much clearer in the "config" side bar of Node-RED.
### Expected Behavior
The relevant `ui-page` node in the Node-RED Config panel should show it's error/validation state (e.g. red colouring, or red triangle as per main nodes.)
<img width="444" alt="Screenshot 2023-10-27 at 16 56 35" src="https://github.com/node-red/node-red/assets/99246719/fa0e6fd8-402b-4da5-8ea9-fb438ba02ade">
### Steps To Reproduce
_No response_
### Example flow
_No response_
### Environment
- Node-RED version: 3.0.2
Hi @knolleary ,
I might be wrong but I feel like there is a bug here:
// editor-client -> editor.js
// validateNode function
- if (node._def._creds) {
- validationErrors = validationErrors.concat(validateNodeProperties(node, node._def.credentials, node._def._creds))
- }
+ if (node.credentials) {
+ validationErrors = validationErrors.concat(validateNodeProperties(node, node._def.credentials, node.credentials))
+ }
Otherwise the config-node never validates these credentials.
As the issue states, it is not currently possible to flag config nodes as have errors.
They simply don't get handled in all the places they should. I haven't started looking at it yet.
It's quite hard to comment on individual lines of code taken out of context here.
This could be the subject of a new functionality
What interests me most is being able to get node.validationErrors
.
And for context
Yes. That is why I asked Joe to raise the issue in the first place.
2 Likes
Hi @knolleary ,
Do you confirm the issue? I see no other reference to node._def._creds
Hi Team,
@knolleary , after delving deeper into the subject, I noticed:
A validation of node._def._creds
is done but what is it?
The credentials (node.credentials
) are not validated.
The reason for the last one seems logical... can I suggest validating the defined properties since they are there:
I know that the working of has_
does not allow "safe" validation but it's better to validate what the node can rather than nothing, right?
This will allow to display catchable errors in the future functionality proposed by Joe.
I forgot to mention it:
The problem is that the node credentials are only loaded when the node edit box is opened. Which implies that when loading the workspace the credentials cannot be validated.
Do we leave it like this or do we add the loading of credentials to the loading of the workspace? Of course, for optimal validation credentials is needed...
system
Closed
15 February 2024 14:26
10
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.