You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Re-evaluate usage of of JsonTypeInfo defaultImpl on AgentLink #3575
My presumption would've been maybe it was a UI consideration? But the following (AI) investigation opposes that, although we nonetheless probably have to make some UI changes around this:
Investigation summary
Short answer: I found nothing suggesting the DefaultAgentLink fallback was added for the UI. It existed before the JSON Forms editor, and what it does today matters only to the backend.
History
Jan 2021: the model refactor added the fallback. A custom type id resolver sent any unknown id to AgentLink.Default (getAgentLinkClass(id).orElse(AgentLink.Default.class)):
Aug 2021: 0647f57, titled "WIP or-json-forms usage", replaced that resolver with Id.NAME + defaultImpl and moved the inner class out to DefaultAgentLink. The commit title mentions the UI, but the fallback was only carried over from the earlier commit. The class javadoc gives a Java generics reason for it: it hides the type parameter in class references.
The only UI-related piece is the @JsonSchemaDefault with "type":"DefaultAgentLink". It came in Oct 2025 with cfbda0c to give JSON Forms a starting value.
Reading stored assets keeps working. Link subtypes are only registered for agent descriptors that are loaded. A stored link can have a type that is no longer registered (protocol removed, extension not deployed, class renamed) or no type key at all; with the fallback it still reads.
Without defaultImpl, Jackson throws in those cases by default. Meta is deserialised with no try/catch, unlike values, so I'd expect the whole asset to fail to load. I didn't run this.
The fallback doesn't make the link work. Agent.getAgentLink casts without checking the type. An HTTP protocol, for example, would be handed a DefaultAgentLink and fail with a ClassCastException while linking.
The one backend reason I can find is that assets with unknown or missing link types still load. If defaultImpl is removed, that case needs its own handling, such as keeping the ritem, so the asset doesn't fail to load.
I would guess it was related to the Schema generation and the JSON forms but if it can be removed and the UI can still function then we should look at doing so.
Activity
Ekhorn commentedon Nov 16, 2026
My presumption would've been maybe it was a UI consideration? But the following (AI) investigation opposes that, although we nonetheless probably have to make some UI changes around this:
Investigation summary
Short answer: I found nothing suggesting the
DefaultAgentLinkfallback was added for the UI. It existed before the JSON Forms editor, and what it does today matters only to the backend.History
Jan 2021: the model refactor added the fallback. A custom type id resolver sent any unknown id to
AgentLink.Default(getAgentLinkClass(id).orElse(AgentLink.Default.class)):core/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java
Lines 43 to 76 in f66a793
Aug 2021: 0647f57, titled "WIP or-json-forms usage", replaced that resolver with
Id.NAME+defaultImpland moved the inner class out toDefaultAgentLink. The commit title mentions the UI, but the fallback was only carried over from the earlier commit. The class javadoc gives a Java generics reason for it: it hides the type parameter in class references.core/model/src/main/java/org/openremote/model/asset/agent/DefaultAgentLink.java
Lines 23 to 28 in 53afd94
UI
The only UI-related piece is the
@JsonSchemaDefaultwith"type":"DefaultAgentLink". It came in Oct 2025 with cfbda0c to give JSON Forms a starting value.core/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java
Lines 39 to 44 in 53afd94
When you pick an agent, the UI always replaces
typewith that agent'sagentLinkType. So the UI never depends on the fallback.core/ui/component/or-attribute-input/src/renderers/agent-link.ts
Lines 111 to 115 in 53afd94
Backend effects
Reading stored assets keeps working. Link subtypes are only registered for agent descriptors that are loaded. A stored link can have a type that is no longer registered (protocol removed, extension not deployed, class renamed) or no
typekey at all; with the fallback it still reads.core/model/src/main/java/org/openremote/model/util/ValueUtil.java
Lines 936 to 942 in 53afd94
Without
defaultImpl, Jackson throws in those cases by default. Meta is deserialised with no try/catch, unlike values, so I'd expect the whole asset to fail to load. I didn't run this.core/model/src/main/java/org/openremote/model/attribute/Attribute.java
Lines 132 to 139 in 53afd94
core/model/src/main/java/org/openremote/model/attribute/Attribute.java
Lines 160 to 164 in 53afd94
The fallback doesn't make the link work.
Agent.getAgentLinkcasts without checking the type. An HTTP protocol, for example, would be handed aDefaultAgentLinkand fail with a ClassCastException while linking.core/model/src/main/java/org/openremote/model/asset/agent/Agent.java
Lines 150 to 158 in 53afd94
core/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java
Lines 118 to 123 in 53afd94
The class itself has to stay.
DefaultAgentLinkis the real link type for the TCP, UDP, serial, Art-Net and Trådfri agents. OnlydefaultImplis in question. This is also why, after binding, a fallback can't be told apart from a real link, the point raised in #3380 (comment)https://github.com/openremote/core/blob/53afd942e2c/agent/src/main/java/org/openremote/agent/protocol/tcp/TCPAgent.java#L29-L35
The one backend reason I can find is that assets with unknown or missing link types still load. If
defaultImplis removed, that case needs its own handling, such as keeping the ritem, so the asset doesn't fail to load.richturner commentedon Nov 16, 2026
I would guess it was related to the Schema generation and the JSON forms but if it can be removed and the UI can still function then we should look at doing so.