# Add opt-in property that allows specifying the types of nodes that a given node can connect to

**URL:** <https://discourse.nodered.org/t/add-opt-in-property-that-allows-specifying-the-types-of-nodes-that-a-given-node-can-connect-to/95047>\
**Category:** Feature Requests\
**Created:** [1 February 2025 14:41 UTC](https://discourse.nodered.org/t/add-opt-in-property-that-allows-specifying-the-types-of-nodes-that-a-given-node-can-connect-to/95047 "2025-02-01T14:41:13Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [1 February 2025 17:19 UTC](https://discourse.nodered.org/t/add-opt-in-property-that-allows-specifying-the-types-of-nodes-that-a-given-node-can-connect-to/95047/21 "2025-02-01T17:19:12Z")

</div>

> [@AllanOricil](#):
>
> ## Another Reason for this feature
> 
> Type checking messages using JSON Schemas, or even Typescript, isn't enough to validate a node can process a certain message because 2 distinct node types can ouput messages with the same Schema/Type, but with different contextual data that won't be understanded by the node that is going to process the message. For example, the following messages from Node types A and B have the same schema:
> 
> output from A
> 
> ```auto
> {
> "source" : "bar"
> }
> 
> ```
> 
> output from B
> 
> ```auto
> {
> "source" : "#0103213913"
> }
> 
> ```
> 
> Both schemas are the same, but Node C can only process the output of B, based on the context of the data.

@GogoVega  
Can you explain how this problem would be solved? Just rely on runtime errors? Let Node C get the output of Node A and throw an exception at runtime, after the user has deployed the flow?

@gregorius  
Disregard my use case. Aren't there any nodes you think that would be weird if they be connected together? Or that they wouldn't work if they were connected?

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [1 February 2025 17:21 UTC](https://discourse.nodered.org/t/add-opt-in-property-that-allows-specifying-the-types-of-nodes-that-a-given-node-can-connect-to/95047/22 "2025-02-01T17:21:21Z")

</div>

Your case is related to your nodes (I believe), so it's up to you to manage it in your nodes.

There is no reason for a lambda user to prevent him from connecting nodes. Why add this feature if it is practically not used.

If you want to control what the user does, again, it's up to you to code it on your side. You can do it without this feature.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 February 2025 17:22 UTC](https://discourse.nodered.org/t/add-opt-in-property-that-allows-specifying-the-types-of-nodes-that-a-given-node-can-connect-to/95047/23 "2025-02-01T17:22:48Z")

</div>

> [@gregorius](#):
>
> Therefore I won't use "its an edge case" as an _argument_ per-se for not doing something. It now might seem to be a and edge-case but who knows what happens tomorrow.

I'm all for people dealing with edge-cases in their own nodes! You've only got to look at some of the things in UIBUILDER to know that. 😄

The argument though is more about what should and shouldn't go into Node-RED core.

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [1 February 2025 17:26 UTC](https://discourse.nodered.org/t/add-opt-in-property-that-allows-specifying-the-types-of-nodes-that-a-given-node-can-connect-to/95047/24 "2025-02-01T17:26:38Z")

</div>

> [@TotallyInformation](#):
>
> what should and shouldn't go into Node-RED core.

And for that I found your argument:

> [@TotallyInformation](#):
>
> But remember, one of the guiding principals of Node-RED is that nodes should not care about upstream and downstream connections.

far better 😉

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [1 February 2025 17:36 UTC](https://discourse.nodered.org/t/add-opt-in-property-that-allows-specifying-the-types-of-nodes-that-a-given-node-can-connect-to/95047/25 "2025-02-01T17:36:17Z")

</div>

> [@AllanOricil](#):
>
> Disregard my use case. Aren't there any nodes you think that would be weird if they be connected together? Or that they wouldn't work if they were connected?

No. Just as I don't think there are any commands I can't pipe together on a unix box.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 February 2025 17:37 UTC](https://discourse.nodered.org/t/add-opt-in-property-that-allows-specifying-the-types-of-nodes-that-a-given-node-can-connect-to/95047/26 "2025-02-01T17:37:31Z")

</div>

> [@AllanOricil](#):
>
> Fine I build it myself and won't shere too.

Hmm, an interesting attitude. Presumably you don't want anything else from those of us who freely give of our time and knowledge then? 🙂

---

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [1 February 2025 17:39 UTC](https://discourse.nodered.org/t/add-opt-in-property-that-allows-specifying-the-types-of-nodes-that-a-given-node-can-connect-to/95047/28 "2025-02-01T17:39:36Z")

</div>

I was not asking you to build it for free. That triggered me. Sorry.

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [1 February 2025 17:45 UTC](https://discourse.nodered.org/t/add-opt-in-property-that-allows-specifying-the-types-of-nodes-that-a-given-node-can-connect-to/95047/29 "2025-02-01T17:45:27Z")

</div>

> [@AllanOricil](#):
>
> I was not asking you to build it for free.

What made me say that is because it's "feature request" hence it's need to be done. So if you don't do it, then someone else needs to do it. This might well have been me thinking too far ahead - mea culpa & my apologises.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 February 2025 17:50 UTC](https://discourse.nodered.org/t/add-opt-in-property-that-allows-specifying-the-types-of-nodes-that-a-given-node-can-connect-to/95047/30 "2025-02-01T17:50:06Z")

</div>

This thread appears to have got heated. There's no need for that.

Bringing it back to the proposal - the basic idea here is to _optionally_ allow nodes to specify some sort of rules as to what they can be wired to.

It is not a proposal that suddenly every single node should start doing this - but that, for a specific use case that @AllanOricil has, that the user of his nodes would benefit from having such a constraint applied to help them use those nodes. We have had similar requests in the past - where Node-RED is being used in specific scenarios with custom sets of nodes which have their own rules for usage.

I don't have an objection to considering this capability - as it does address a reasonable requirement, but doesn't impose anything on anyone not using those nodes. I would say it feels like an editor-only capability initially; it think it would be unnecessary for the runtime to police it as well if the editor can help prevent the user creating an 'invalid' configuration in the first place. Plus, given the way configuration isn't shared between runtime and editor, it would require the node author to duplicate the rules in both places.

There's a bunch of fine detail to consider around the full UX here - Allan has thought through a number of cases and proposed behaviours. We'd want to think through that detail before moving forward - being the weekend, I'm not able to deep dive into to at the moment.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 April 2025 17:51 UTC](https://discourse.nodered.org/t/add-opt-in-property-that-allows-specifying-the-types-of-nodes-that-a-given-node-can-connect-to/95047/31 "2025-04-02T17:51:00Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/add-opt-in-property-that-allows-specifying-the-types-of-nodes-that-a-given-node-can-connect-to/95047.md?page=1)
