This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 517829d57c63 CAMEL-23763: Make rest/template/kamelet on
RouteDefinition @XmlTransient (#24045)
517829d57c63 is described below
commit 517829d57c63cd819cc848dae1e21d3cc571c33e
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Jun 16 14:01:09 2026 +0200
CAMEL-23763: Make rest/template/kamelet on RouteDefinition @XmlTransient
(#24045)
These boolean fields are runtime transients (marking routes created by
REST DSL, route templates, or kamelets) and should never be serialized
to XML. The @XmlAttribute annotation caused the ModelWriter to emit
spurious attributes like kamelet="false" on the route element, while
the kamelet attribute also shadowed the KameletDefinition EIP child
element in the parser, breaking XML round-trip.
Signed-off-by: Claus Ibsen <[email protected]>
Co-authored-by: Claude <[email protected]>
---
.../resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd | 3 ---
.../src/main/java/org/apache/camel/model/RouteDefinition.java | 9 +++------
.../src/generated/java/org/apache/camel/xml/in/ModelParser.java | 3 ---
.../src/generated/java/org/apache/camel/xml/out/ModelWriter.java | 3 ---
4 files changed, 3 insertions(+), 15 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
index 58730483c54e..4f429d305ed2 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
@@ -11659,7 +11659,6 @@ The group name for this route. Multiple routes can
belong to the same group.
</xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="kamelet" type="xs:boolean"/>
<xs:attribute name="logMask" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">
@@ -11697,7 +11696,6 @@ or not.
</xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="rest" type="xs:boolean"/>
<xs:attribute name="routeConfigurationId" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">
@@ -11754,7 +11752,6 @@ Whether stream caching is enabled on this route.
Default value: false
</xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="template" type="xs:boolean"/>
<xs:attribute name="trace" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">
diff --git
a/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinition.java
b/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinition.java
index 2c03f1140b46..b0f1129c53d8 100644
---
a/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinition.java
+++
b/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinition.java
@@ -1290,12 +1290,11 @@ public class RouteDefinition extends
OutputDefinition<RouteDefinition>
/**
* This route is created from REST DSL
*/
+ @XmlTransient
public void setRest(Boolean rest) {
this.rest = rest;
}
- @XmlAttribute
- @Metadata(label = "advanced")
public Boolean isRest() {
return rest;
}
@@ -1303,12 +1302,11 @@ public class RouteDefinition extends
OutputDefinition<RouteDefinition>
/**
* This route is created from a route template (or from a Kamelet).
*/
+ @XmlTransient
public void setTemplate(Boolean template) {
this.template = template;
}
- @XmlAttribute
- @Metadata(label = "advanced")
public Boolean isTemplate() {
return template;
}
@@ -1316,12 +1314,11 @@ public class RouteDefinition extends
OutputDefinition<RouteDefinition>
/**
* This route is created from a Kamelet.
*/
+ @XmlTransient
public void setKamelet(Boolean kamelet) {
this.kamelet = kamelet;
}
- @XmlAttribute
- @Metadata(label = "advanced")
public Boolean isKamelet() {
return kamelet;
}
diff --git
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
index d4f1127a263f..4fe4e629303c 100644
---
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
+++
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
@@ -922,11 +922,8 @@ public class ModelParser extends BaseParser {
case "errorHandler":
def.setErrorHandler(doParseErrorHandlerDefinition()); yield true;
case "from": def.setInput(doParseFromDefinition()); yield true;
case "inputType":
def.setInputType(doParseInputTypeDefinition()); yield true;
- case "kamelet":
def.setKamelet(Boolean.valueOf(doParseText())); yield true;
case "outputType":
def.setOutputType(doParseOutputTypeDefinition()); yield true;
- case "rest": def.setRest(Boolean.valueOf(doParseText()));
yield true;
case "routeProperty": doAdd(doParsePropertyDefinition(),
def.getRouteProperties(), def::setRouteProperties); yield true;
- case "template":
def.setTemplate(Boolean.valueOf(doParseText())); yield true;
default: yield outputDefinitionElementHandler().accept(def,
key);
}, noValueHandler());
}
diff --git
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
index 5e81fda70cc7..4f167655eec5 100644
---
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
+++
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
@@ -1588,9 +1588,6 @@ public class ModelWriter extends BaseWriter {
protected void doWriteRouteDefinition(String name, RouteDefinition def)
throws IOException {
startElement(name);
doWriteProcessorDefinitionAttributes(def);
- doWriteAttribute("template", toString(def.isTemplate()), null);
- doWriteAttribute("kamelet", toString(def.isKamelet()), null);
- doWriteAttribute("rest", toString(def.isRest()), null);
doWriteAttribute("group", def.getGroup(), null);
doWriteAttribute("nodePrefixId", def.getNodePrefixId(), null);
doWriteAttribute("routeConfigurationId",
def.getRouteConfigurationId(), null);