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 6012a3d41bed CAMEL-25689: camel-toon - Upgrade JToon to 2.0.7 (#27907)
6012a3d41bed is described below
commit 6012a3d41bed9e0ae5325d784e63d7374f9d7848
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Oct 20 15:08:14 2026 +0200
CAMEL-25689: camel-toon - Upgrade JToon to 2.0.7 (#27907)
JToon 2.0.6 removes the lengthMarker component of EncodeOptions, as the
TOON specification no longer has the [#N] array length marker. The
lengthMarker option of the toon data format is therefore removed.
With strict=false, JToon 2.0.6 applies only the non-strict recoveries of
the TOON specification and fails on other malformed TOON, instead of
returning null or a partial result. The description of the strict option
now says so.
Supersedes #27890.
Follow-ups:
- camel-toon - mark the upgrade guide note as a breaking change
Closes #27907
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../org/apache/camel/catalog/dataformats/toon.json | 5 ++-
.../org/apache/camel/catalog/models/toon.json | 5 ++-
.../apache/camel/catalog/schemas/camel-spring.xsd | 15 ++-------
.../apache/camel/catalog/schemas/camel-xml-io.xsd | 15 ++-------
.../camel/catalog/schemas/camelYamlDsl-model.json | 16 ++-------
.../dataformat/toon/ToonDataFormatConfigurer.java | 7 ----
.../org/apache/camel/dataformat/toon/toon.json | 5 ++-
.../camel/dataformat/toon/ToonDataFormat.java | 17 +++-------
.../camel/dataformat/toon/ToonDataFormatTest.java | 18 +++++-----
.../org/apache/camel/model/dataformat/toon.json | 5 ++-
.../camel/model/dataformat/ToonDataFormat.java | 38 ++--------------------
.../reifier/dataformat/ToonDataFormatReifier.java | 1 -
.../apache/camel/java/out/JavaDslModelWriter.java | 1 -
.../java/org/apache/camel/xml/in/ModelParser.java | 1 -
.../java/org/apache/camel/xml/out/ModelWriter.java | 1 -
.../org/apache/camel/yaml/out/YamlModelWriter.java | 1 -
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 14 ++++++++
.../dsl/yaml/deserializers/ModelDeserializers.java | 8 +----
.../resources/schema/camelYamlDsl-canonical.json | 8 +----
.../resources/schema/camelYamlDsl-model.json | 16 ++-------
.../generated/resources/schema/camelYamlDsl.json | 8 +----
parent/pom.xml | 2 +-
22 files changed, 55 insertions(+), 152 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/toon.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/toon.json
index a45eeb267e26..5d2b6d93b885 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/toon.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/toon.json
@@ -19,8 +19,7 @@
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group":
"common", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "The
id of this node" },
"indent": { "index": 1, "kind": "attribute", "displayName": "Indent",
"group": "common", "required": false, "type": "integer", "javaType":
"java.lang.Integer", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 2, "description": "Number of spaces per indentation level." },
"delimiter": { "index": 2, "kind": "attribute", "displayName":
"Delimiter", "group": "common", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "COMMA", "TAB", "PIPE" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "COMMA", "description":
"Delimiter used for tabular array rows and inline primitive arrays." },
- "lengthMarker": { "index": 3, "kind": "attribute", "displayName": "Length
Marker", "group": "common", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether to prefix array lengths with a
hash marker so arrays render as hash-prefixed lengths instead of plain
lengths." },
- "strict": { "index": 4, "kind": "attribute", "displayName": "Strict",
"group": "common", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether to enable strict validation when
unmarshalling TOON. When false, JToon uses best-effort parsing." },
- "contentTypeHeader": { "index": 5, "kind": "attribute", "displayName":
"Content Type Header", "group": "common", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the data format
should set the Content-Type header to text\/toon when marshalling." }
+ "strict": { "index": 3, "kind": "attribute", "displayName": "Strict",
"group": "common", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether to enable strict validation when
unmarshalling TOON. When false, the decoder applies the non-strict recoveries
of the TOON specification, such as accepting an array whose length differs from
the declared length; other malfor [...]
+ "contentTypeHeader": { "index": 4, "kind": "attribute", "displayName":
"Content Type Header", "group": "common", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the data format
should set the Content-Type header to text\/toon when marshalling." }
}
}
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/toon.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/toon.json
index 7bb7784a39ae..f82156daa665 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/toon.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/toon.json
@@ -16,8 +16,7 @@
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group":
"common", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "The
id of this node" },
"indent": { "index": 1, "kind": "attribute", "displayName": "Indent",
"group": "common", "required": false, "type": "integer", "javaType":
"java.lang.Integer", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 2, "description": "Number of spaces per indentation level." },
"delimiter": { "index": 2, "kind": "attribute", "displayName":
"Delimiter", "group": "common", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "COMMA", "TAB", "PIPE" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "COMMA", "description":
"Delimiter used for tabular array rows and inline primitive arrays." },
- "lengthMarker": { "index": 3, "kind": "attribute", "displayName": "Length
Marker", "group": "common", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether to prefix array lengths with a
hash marker so arrays render as hash-prefixed lengths instead of plain
lengths." },
- "strict": { "index": 4, "kind": "attribute", "displayName": "Strict",
"group": "common", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether to enable strict validation when
unmarshalling TOON. When false, JToon uses best-effort parsing." },
- "contentTypeHeader": { "index": 5, "kind": "attribute", "displayName":
"Content Type Header", "group": "common", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the data format
should set the Content-Type header to text\/toon when marshalling." }
+ "strict": { "index": 3, "kind": "attribute", "displayName": "Strict",
"group": "common", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether to enable strict validation when
unmarshalling TOON. When false, the decoder applies the non-strict recoveries
of the TOON specification, such as accepting an array whose length differs from
the declared length; other malfor [...]
+ "contentTypeHeader": { "index": 4, "kind": "attribute", "displayName":
"Content Type Header", "group": "common", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the data format
should set the Content-Type header to text\/toon when marshalling." }
}
}
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
index 7c61586a3645..31bbebd95493 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
@@ -10284,16 +10284,6 @@ Number of spaces per indentation level. Default value:
2
<xs:documentation xml:lang="en">
<![CDATA[
Delimiter used for tabular array rows and inline primitive arrays. Default
value: COMMA
-]]>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="lengthMarker" type="xs:string">
- <xs:annotation>
- <xs:documentation xml:lang="en">
-<![CDATA[
-Whether to prefix array lengths with a hash marker so arrays render as
hash-prefixed lengths instead of plain lengths.
-Default value: false
]]>
</xs:documentation>
</xs:annotation>
@@ -10302,8 +10292,9 @@ Default value: false
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-Whether to enable strict validation when unmarshalling TOON. When false, JToon
uses best-effort parsing. Default value:
-true
+Whether to enable strict validation when unmarshalling TOON. When false, the
decoder applies the non-strict recoveries
+of the TOON specification, such as accepting an array whose length differs
from the declared length; other malformed
+TOON still fails. Default value: true
]]>
</xs:documentation>
</xs:annotation>
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 c10619d594f4..ff2894bcd3c2 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
@@ -9406,16 +9406,6 @@ Number of spaces per indentation level. Default value: 2
<xs:documentation xml:lang="en">
<![CDATA[
Delimiter used for tabular array rows and inline primitive arrays. Default
value: COMMA
-]]>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="lengthMarker" type="xs:string">
- <xs:annotation>
- <xs:documentation xml:lang="en">
-<![CDATA[
-Whether to prefix array lengths with a hash marker so arrays render as
hash-prefixed lengths instead of plain lengths.
-Default value: false
]]>
</xs:documentation>
</xs:annotation>
@@ -9424,8 +9414,9 @@ Default value: false
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-Whether to enable strict validation when unmarshalling TOON. When false, JToon
uses best-effort parsing. Default value:
-true
+Whether to enable strict validation when unmarshalling TOON. When false, the
decoder applies the non-strict recoveries
+of the TOON specification, such as accepting an array whose length differs
from the declared length; other malformed
+TOON still fails. Default value: true
]]>
</xs:documentation>
</xs:annotation>
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
index 58eccd8df1bb..e192cce0e155 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
@@ -13712,25 +13712,15 @@
"kind" : "attribute",
"index" : 2,
"group" : "common"
- }, {
- "name" : "lengthMarker",
- "type" : "boolean",
- "description" : "Whether to prefix array lengths with a hash marker so
arrays render as hash-prefixed lengths instead of plain lengths.",
- "title" : "Length Marker",
- "default" : "false",
- "displayName" : "Length Marker",
- "kind" : "attribute",
- "index" : 3,
- "group" : "common"
}, {
"name" : "strict",
"type" : "boolean",
- "description" : "Whether to enable strict validation when
unmarshalling TOON. When false, JToon uses best-effort parsing.",
+ "description" : "Whether to enable strict validation when
unmarshalling TOON. When false, the decoder applies the non-strict recoveries
of the TOON specification, such as accepting an array whose length differs from
the declared length; other malformed TOON still fails.",
"title" : "Strict",
"default" : "true",
"displayName" : "Strict",
"kind" : "attribute",
- "index" : 4,
+ "index" : 3,
"group" : "common"
}, {
"name" : "contentTypeHeader",
@@ -13740,7 +13730,7 @@
"default" : "true",
"displayName" : "Content Type Header",
"kind" : "attribute",
- "index" : 5,
+ "index" : 4,
"group" : "common"
} ]
},
diff --git
a/components/camel-toon/src/generated/java/org/apache/camel/dataformat/toon/ToonDataFormatConfigurer.java
b/components/camel-toon/src/generated/java/org/apache/camel/dataformat/toon/ToonDataFormatConfigurer.java
index 6497c75109e4..ca2b872f8c12 100644
---
a/components/camel-toon/src/generated/java/org/apache/camel/dataformat/toon/ToonDataFormatConfigurer.java
+++
b/components/camel-toon/src/generated/java/org/apache/camel/dataformat/toon/ToonDataFormatConfigurer.java
@@ -25,7 +25,6 @@ public class ToonDataFormatConfigurer extends
org.apache.camel.support.component
map.put("ContentTypeHeader", boolean.class);
map.put("Delimiter", java.lang.String.class);
map.put("Indent", int.class);
- map.put("LengthMarker", boolean.class);
map.put("Strict", boolean.class);
ALL_OPTIONS = map;
}
@@ -38,8 +37,6 @@ public class ToonDataFormatConfigurer extends
org.apache.camel.support.component
case "contentTypeHeader":
target.setContentTypeHeader(property(camelContext, boolean.class, value));
return true;
case "delimiter": target.setDelimiter(property(camelContext,
java.lang.String.class, value)); return true;
case "indent": target.setIndent(property(camelContext, int.class,
value)); return true;
- case "lengthmarker":
- case "lengthMarker": target.setLengthMarker(property(camelContext,
boolean.class, value)); return true;
case "strict": target.setStrict(property(camelContext, boolean.class,
value)); return true;
default: return false;
}
@@ -57,8 +54,6 @@ public class ToonDataFormatConfigurer extends
org.apache.camel.support.component
case "contentTypeHeader": return boolean.class;
case "delimiter": return java.lang.String.class;
case "indent": return int.class;
- case "lengthmarker":
- case "lengthMarker": return boolean.class;
case "strict": return boolean.class;
default: return null;
}
@@ -72,8 +67,6 @@ public class ToonDataFormatConfigurer extends
org.apache.camel.support.component
case "contentTypeHeader": return target.isContentTypeHeader();
case "delimiter": return target.getDelimiter();
case "indent": return target.getIndent();
- case "lengthmarker":
- case "lengthMarker": return target.isLengthMarker();
case "strict": return target.isStrict();
default: return null;
}
diff --git
a/components/camel-toon/src/generated/resources/META-INF/org/apache/camel/dataformat/toon/toon.json
b/components/camel-toon/src/generated/resources/META-INF/org/apache/camel/dataformat/toon/toon.json
index a45eeb267e26..5d2b6d93b885 100644
---
a/components/camel-toon/src/generated/resources/META-INF/org/apache/camel/dataformat/toon/toon.json
+++
b/components/camel-toon/src/generated/resources/META-INF/org/apache/camel/dataformat/toon/toon.json
@@ -19,8 +19,7 @@
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group":
"common", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "The
id of this node" },
"indent": { "index": 1, "kind": "attribute", "displayName": "Indent",
"group": "common", "required": false, "type": "integer", "javaType":
"java.lang.Integer", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 2, "description": "Number of spaces per indentation level." },
"delimiter": { "index": 2, "kind": "attribute", "displayName":
"Delimiter", "group": "common", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "COMMA", "TAB", "PIPE" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "COMMA", "description":
"Delimiter used for tabular array rows and inline primitive arrays." },
- "lengthMarker": { "index": 3, "kind": "attribute", "displayName": "Length
Marker", "group": "common", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether to prefix array lengths with a
hash marker so arrays render as hash-prefixed lengths instead of plain
lengths." },
- "strict": { "index": 4, "kind": "attribute", "displayName": "Strict",
"group": "common", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether to enable strict validation when
unmarshalling TOON. When false, JToon uses best-effort parsing." },
- "contentTypeHeader": { "index": 5, "kind": "attribute", "displayName":
"Content Type Header", "group": "common", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the data format
should set the Content-Type header to text\/toon when marshalling." }
+ "strict": { "index": 3, "kind": "attribute", "displayName": "Strict",
"group": "common", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether to enable strict validation when
unmarshalling TOON. When false, the decoder applies the non-strict recoveries
of the TOON specification, such as accepting an array whose length differs from
the declared length; other malfor [...]
+ "contentTypeHeader": { "index": 4, "kind": "attribute", "displayName":
"Content Type Header", "group": "common", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the data format
should set the Content-Type header to text\/toon when marshalling." }
}
}
diff --git
a/components/camel-toon/src/main/java/org/apache/camel/dataformat/toon/ToonDataFormat.java
b/components/camel-toon/src/main/java/org/apache/camel/dataformat/toon/ToonDataFormat.java
index caea472a4de1..33e603cf7e39 100644
---
a/components/camel-toon/src/main/java/org/apache/camel/dataformat/toon/ToonDataFormat.java
+++
b/components/camel-toon/src/main/java/org/apache/camel/dataformat/toon/ToonDataFormat.java
@@ -59,10 +59,9 @@ public class ToonDataFormat extends ServiceSupport
@Metadata(description = "Delimiter used for tabular array rows and inline
primitive arrays.",
defaultValue = "COMMA", enums = "COMMA,TAB,PIPE")
private String delimiter = Delimiter.COMMA.name();
- @Metadata(description = "Whether to prefix array lengths with a hash
marker so arrays render as hash-prefixed lengths instead of plain lengths.",
- defaultValue = "false", javaType = "java.lang.Boolean")
- private boolean lengthMarker = EncodeOptions.DEFAULT.lengthMarker();
- @Metadata(description = "Whether to enable strict validation when
unmarshalling TOON. When false, JToon uses best-effort parsing.",
+ @Metadata(description = "Whether to enable strict validation when
unmarshalling TOON. When false, the decoder applies the non-strict"
+ + " recoveries of the TOON specification, such as
accepting an array whose length differs from the"
+ + " declared length; other malformed TOON still
fails.",
defaultValue = "true", javaType = "java.lang.Boolean")
private boolean strict = DecodeOptions.DEFAULT.strict();
@Metadata(description = "Whether the data format should set the
Content-Type header to text/toon when marshalling.",
@@ -129,7 +128,7 @@ public class ToonDataFormat extends ServiceSupport
}
private EncodeOptions encodeOptions() {
- return new EncodeOptions(indent, resolveDelimiter(), lengthMarker,
KeyFolding.OFF, Integer.MAX_VALUE);
+ return new EncodeOptions(indent, resolveDelimiter(), KeyFolding.OFF,
Integer.MAX_VALUE);
}
private DecodeOptions decodeOptions() {
@@ -161,14 +160,6 @@ public class ToonDataFormat extends ServiceSupport
this.delimiter = delimiter;
}
- public boolean isLengthMarker() {
- return lengthMarker;
- }
-
- public void setLengthMarker(boolean lengthMarker) {
- this.lengthMarker = lengthMarker;
- }
-
public boolean isStrict() {
return strict;
}
diff --git
a/components/camel-toon/src/test/java/org/apache/camel/dataformat/toon/ToonDataFormatTest.java
b/components/camel-toon/src/test/java/org/apache/camel/dataformat/toon/ToonDataFormatTest.java
index 89b3bac6860a..97ea67f564cc 100644
---
a/components/camel-toon/src/test/java/org/apache/camel/dataformat/toon/ToonDataFormatTest.java
+++
b/components/camel-toon/src/test/java/org/apache/camel/dataformat/toon/ToonDataFormatTest.java
@@ -215,12 +215,6 @@ class ToonDataFormatTest extends CamelTestSupport {
assertThat(toon).contains(" inner");
}
- @Test
- void lengthMarkerOptionPrefixesArrayLength() {
- String toon = template.requestBody("direct:lengthMarker", List.of("a",
"b"), String.class);
- assertThat(toon).contains("[#");
- }
-
@Test
void contentTypeHeaderIsSetByDefault() {
Exchange exchange = template.request("direct:marshal", e ->
e.getIn().setBody(Map.of("ok", true)));
@@ -251,7 +245,7 @@ class ToonDataFormatTest extends CamelTestSupport {
}
@Test
- void strictFalseUsesBestEffortParsing() {
+ void strictFalseAcceptsArrayLengthMismatch() {
Object result = template.requestBody("direct:strictFalse", "tags[2]:
a,b,c");
assertThat(result).isInstanceOf(Map.class);
@SuppressWarnings("unchecked")
@@ -262,6 +256,15 @@ class ToonDataFormatTest extends CamelTestSupport {
assertThat(tags).containsExactly("a", "b", "c");
}
+ @Test
+ void malformedToonFailsWhenNotStrict() {
+ // the [#N] length marker is no longer part of the TOON specification
+ assertThatThrownBy(() -> template.requestBody("direct:strictFalse",
"tags[#2]: a,b", Object.class))
+ .isInstanceOf(CamelExecutionException.class)
+ .cause()
+ .isInstanceOf(IllegalArgumentException.class);
+ }
+
@Test
void emptyJsonStringMarshalFails() {
assertThatThrownBy(() -> template.requestBody("direct:marshal", "",
String.class))
@@ -304,7 +307,6 @@ class ToonDataFormatTest extends CamelTestSupport {
from("direct:pipe").marshal(dataFormat().toon().delimiter("PIPE").end());
from("direct:unmarshalPipe").unmarshal(dataFormat().toon().delimiter("PIPE").end());
from("direct:indent").marshal(dataFormat().toon().indent(4).end());
-
from("direct:lengthMarker").marshal(dataFormat().toon().lengthMarker(true).end());
from("direct:noContentType").marshal(dataFormat().toon().contentTypeHeader(false).end());
from("direct:strictFalse").unmarshal(dataFormat().toon().strict(false).end());
}
diff --git
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/toon.json
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/toon.json
index 7bb7784a39ae..f82156daa665 100644
---
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/toon.json
+++
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/toon.json
@@ -16,8 +16,7 @@
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group":
"common", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "The
id of this node" },
"indent": { "index": 1, "kind": "attribute", "displayName": "Indent",
"group": "common", "required": false, "type": "integer", "javaType":
"java.lang.Integer", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 2, "description": "Number of spaces per indentation level." },
"delimiter": { "index": 2, "kind": "attribute", "displayName":
"Delimiter", "group": "common", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "COMMA", "TAB", "PIPE" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "COMMA", "description":
"Delimiter used for tabular array rows and inline primitive arrays." },
- "lengthMarker": { "index": 3, "kind": "attribute", "displayName": "Length
Marker", "group": "common", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether to prefix array lengths with a
hash marker so arrays render as hash-prefixed lengths instead of plain
lengths." },
- "strict": { "index": 4, "kind": "attribute", "displayName": "Strict",
"group": "common", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether to enable strict validation when
unmarshalling TOON. When false, JToon uses best-effort parsing." },
- "contentTypeHeader": { "index": 5, "kind": "attribute", "displayName":
"Content Type Header", "group": "common", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the data format
should set the Content-Type header to text\/toon when marshalling." }
+ "strict": { "index": 3, "kind": "attribute", "displayName": "Strict",
"group": "common", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether to enable strict validation when
unmarshalling TOON. When false, the decoder applies the non-strict recoveries
of the TOON specification, such as accepting an array whose length differs from
the declared length; other malfor [...]
+ "contentTypeHeader": { "index": 4, "kind": "attribute", "displayName":
"Content Type Header", "group": "common", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the data format
should set the Content-Type header to text\/toon when marshalling." }
}
}
diff --git
a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/ToonDataFormat.java
b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/ToonDataFormat.java
index 31ebb077732a..f6419c82e8b9 100644
---
a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/ToonDataFormat.java
+++
b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/ToonDataFormat.java
@@ -43,12 +43,9 @@ public class ToonDataFormat extends DataFormatDefinition
implements ContentTypeH
enums = "COMMA,TAB,PIPE")
private String delimiter;
@XmlAttribute
- @Metadata(description = "Whether to prefix array lengths with a hash
marker so arrays render as hash-prefixed lengths instead of plain lengths.",
- defaultValue = "false",
- javaType = "java.lang.Boolean")
- private String lengthMarker;
- @XmlAttribute
- @Metadata(description = "Whether to enable strict validation when
unmarshalling TOON. When false, JToon uses best-effort parsing.",
+ @Metadata(description = "Whether to enable strict validation when
unmarshalling TOON. When false, the decoder applies the non-strict"
+ + " recoveries of the TOON specification, such as
accepting an array whose length differs from the"
+ + " declared length; other malformed TOON still
fails.",
defaultValue = "true", javaType = "java.lang.Boolean")
private String strict;
@XmlAttribute
@@ -64,7 +61,6 @@ public class ToonDataFormat extends DataFormatDefinition
implements ContentTypeH
super(source);
this.indent = source.indent;
this.delimiter = source.delimiter;
- this.lengthMarker = source.lengthMarker;
this.strict = source.strict;
this.contentTypeHeader = source.contentTypeHeader;
}
@@ -73,7 +69,6 @@ public class ToonDataFormat extends DataFormatDefinition
implements ContentTypeH
this();
this.indent = builder.indent;
this.delimiter = builder.delimiter;
- this.lengthMarker = builder.lengthMarker;
this.strict = builder.strict;
this.contentTypeHeader = builder.contentTypeHeader;
}
@@ -99,14 +94,6 @@ public class ToonDataFormat extends DataFormatDefinition
implements ContentTypeH
this.delimiter = delimiter;
}
- public String getLengthMarker() {
- return lengthMarker;
- }
-
- public void setLengthMarker(String lengthMarker) {
- this.lengthMarker = lengthMarker;
- }
-
public String getStrict() {
return strict;
}
@@ -133,7 +120,6 @@ public class ToonDataFormat extends DataFormatDefinition
implements ContentTypeH
private String indent;
private String delimiter;
- private String lengthMarker;
private String strict;
private String contentTypeHeader;
@@ -161,24 +147,6 @@ public class ToonDataFormat extends DataFormatDefinition
implements ContentTypeH
return this;
}
- /**
- * Whether to prefix array lengths with a hash marker so arrays render
as hash-prefixed lengths instead of plain
- * lengths.
- */
- public Builder lengthMarker(String lengthMarker) {
- this.lengthMarker = lengthMarker;
- return this;
- }
-
- /**
- * Whether to prefix array lengths with a hash marker so arrays render
as hash-prefixed lengths instead of plain
- * lengths.
- */
- public Builder lengthMarker(boolean lengthMarker) {
- this.lengthMarker = Boolean.toString(lengthMarker);
- return this;
- }
-
/**
* Whether to enable strict validation when unmarshalling TOON.
*/
diff --git
a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/ToonDataFormatReifier.java
b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/ToonDataFormatReifier.java
index 9e99ef930761..fe243807d5d5 100644
---
a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/ToonDataFormatReifier.java
+++
b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/ToonDataFormatReifier.java
@@ -32,7 +32,6 @@ public class ToonDataFormatReifier extends
DataFormatReifier<ToonDataFormat> {
protected void prepareDataFormatConfig(Map<String, Object> properties) {
properties.put("indent", definition.getIndent());
properties.put("delimiter", definition.getDelimiter());
- properties.put("lengthMarker", definition.getLengthMarker());
properties.put("strict", definition.getStrict());
}
}
diff --git
a/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
b/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
index 30b5500644e5..e96dd383a797 100644
---
a/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
+++
b/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
@@ -3365,7 +3365,6 @@ public class JavaDslModelWriter extends
JavaDslModelWriterSupport {
doWriteIdentifiedTypeAttributes(sb, def);
doWriteAttribute(sb, "indent", def.getIndent(), "2");
doWriteAttribute(sb, "delimiter", def.getDelimiter(), "COMMA");
- doWriteAttribute(sb, "lengthMarker", def.getLengthMarker(), "false");
doWriteAttribute(sb, "strict", def.getStrict(), "true");
doWriteAttribute(sb, "contentTypeHeader", def.getContentTypeHeader(),
"true");
}
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 fe26844ade6b..b6459b7f0e1a 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
@@ -2104,7 +2104,6 @@ public class ModelParser extends BaseParser {
case "contentTypeHeader": def.setContentTypeHeader(val); yield
true;
case "delimiter": def.setDelimiter(val); yield true;
case "indent": def.setIndent(val); yield true;
- case "lengthMarker": def.setLengthMarker(val); yield true;
case "strict": def.setStrict(val); yield true;
default: yield identifiedTypeAttributeHandler().accept(def,
key, val);
}, noElementHandler(), 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 c18aec4ad8d6..fe2a72d7880f 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
@@ -2755,7 +2755,6 @@ public class ModelWriter extends BaseWriter {
doWriteIdentifiedTypeAttributes(def);
doWriteAttribute("indent", def.getIndent(), "2");
doWriteAttribute("delimiter", def.getDelimiter(), "COMMA");
- doWriteAttribute("lengthMarker", def.getLengthMarker(), "false");
doWriteAttribute("strict", def.getStrict(), "true");
doWriteAttribute("contentTypeHeader", def.getContentTypeHeader(),
"true");
endElement(name);
diff --git
a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
index 614e3877de5e..2cea578140c9 100644
---
a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
+++
b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
@@ -2756,7 +2756,6 @@ public class YamlModelWriter extends
YamlModelWriterSupport {
doWriteIdentifiedTypeAttributes(jo, def);
doWriteAttribute(jo, "indent", def.getIndent(), "2");
doWriteAttribute(jo, "delimiter", def.getDelimiter(), "COMMA");
- doWriteAttribute(jo, "lengthMarker", def.getLengthMarker(), "false");
doWriteAttribute(jo, "strict", def.getStrict(), "true");
doWriteAttribute(jo, "contentTypeHeader", def.getContentTypeHeader(),
"true");
return jo;
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index 951f78c9f1e8..4e8fdf50290e 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -1964,3 +1964,17 @@ previous run is looked up. `camel dirty` does not count
these files.
* `camel_get_log` of an integration that is not running answers with the log
of its previous run (see
`camel log --previous`), and its message says how that run ended.
`previous=true` asks for that log also when the
integration runs again. `camel_get_errors` of an integration that is not
running says how its previous run ended.
+
+=== camel-toon - the lengthMarker option is removed (Breaking change)
+
+`camel-toon` now uses JToon 2.0.7, which follows a newer version of the TOON
specification.
+
+The `lengthMarker` option of the TOON data format is removed, because the TOON
specification no longer has the `[#N]`
+array length marker. Remove the option from the data format in Java, XML and
YAML routes. TOON text with a `[#N]` array
+header, such as the output of a data format with `lengthMarker=true`, now
fails to unmarshal in both strict and
+non-strict mode; in Camel 4.23 it already failed in strict mode (the default).
To read such data, remove the `#` from
+its array headers (`tags[#2]:` becomes `tags[2]:`).
+
+With `strict=false`, unmarshalling no longer returns `null` or a partial
result for malformed TOON. Only the non-strict
+recoveries of the TOON specification apply, such as accepting an array whose
length differs from the declared length;
+other malformed TOON fails with `IllegalArgumentException`, as in strict mode.
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
index 162ff134f239..7af4dcfb6ed7 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
@@ -19342,8 +19342,7 @@ public final class ModelDeserializers extends
YamlDeserializerSupport {
@YamlProperty(name = "delimiter", type =
"enum:COMMA,TAB,PIPE", defaultValue = "COMMA", description = "Delimiter used
for tabular array rows and inline primitive arrays.", displayName =
"Delimiter"),
@YamlProperty(name = "id", type = "string", description =
"The id of this node", displayName = "Id"),
@YamlProperty(name = "indent", type = "number",
defaultValue = "2", description = "Number of spaces per indentation level.",
displayName = "Indent"),
- @YamlProperty(name = "lengthMarker", type = "boolean",
defaultValue = "false", description = "Whether to prefix array lengths with a
hash marker so arrays render as hash-prefixed lengths instead of plain
lengths.", displayName = "Length Marker"),
- @YamlProperty(name = "strict", type = "boolean",
defaultValue = "true", description = "Whether to enable strict validation when
unmarshalling TOON. When false, JToon uses best-effort parsing.", displayName =
"Strict")
+ @YamlProperty(name = "strict", type = "boolean",
defaultValue = "true", description = "Whether to enable strict validation when
unmarshalling TOON. When false, the decoder applies the non-strict recoveries
of the TOON specification, such as accepting an array whose length differs from
the declared length; other malformed TOON still fails.", displayName = "Strict")
}
)
public static class ToonDataFormatDeserializer extends
YamlDeserializerBase<ToonDataFormat> {
@@ -19381,11 +19380,6 @@ public final class ModelDeserializers extends
YamlDeserializerSupport {
target.setIndent(val);
break;
}
- case "lengthMarker": {
- String val = asText(node);
- target.setLengthMarker(val);
- break;
- }
case "strict": {
String val = asText(node);
target.setStrict(val);
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
index dcfc26e8c91f..1e48fcea66ad 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
@@ -8716,16 +8716,10 @@
"description" : "Number of spaces per indentation level.",
"default" : 2
},
- "lengthMarker" : {
- "type" : "boolean",
- "title" : "Length Marker",
- "description" : "Whether to prefix array lengths with a hash
marker so arrays render as hash-prefixed lengths instead of plain lengths.",
- "default" : false
- },
"strict" : {
"type" : "boolean",
"title" : "Strict",
- "description" : "Whether to enable strict validation when
unmarshalling TOON. When false, JToon uses best-effort parsing.",
+ "description" : "Whether to enable strict validation when
unmarshalling TOON. When false, the decoder applies the non-strict recoveries
of the TOON specification, such as accepting an array whose length differs from
the declared length; other malformed TOON still fails.",
"default" : true
}
}
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
index 58eccd8df1bb..e192cce0e155 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
@@ -13712,25 +13712,15 @@
"kind" : "attribute",
"index" : 2,
"group" : "common"
- }, {
- "name" : "lengthMarker",
- "type" : "boolean",
- "description" : "Whether to prefix array lengths with a hash marker so
arrays render as hash-prefixed lengths instead of plain lengths.",
- "title" : "Length Marker",
- "default" : "false",
- "displayName" : "Length Marker",
- "kind" : "attribute",
- "index" : 3,
- "group" : "common"
}, {
"name" : "strict",
"type" : "boolean",
- "description" : "Whether to enable strict validation when
unmarshalling TOON. When false, JToon uses best-effort parsing.",
+ "description" : "Whether to enable strict validation when
unmarshalling TOON. When false, the decoder applies the non-strict recoveries
of the TOON specification, such as accepting an array whose length differs from
the declared length; other malformed TOON still fails.",
"title" : "Strict",
"default" : "true",
"displayName" : "Strict",
"kind" : "attribute",
- "index" : 4,
+ "index" : 3,
"group" : "common"
}, {
"name" : "contentTypeHeader",
@@ -13740,7 +13730,7 @@
"default" : "true",
"displayName" : "Content Type Header",
"kind" : "attribute",
- "index" : 5,
+ "index" : 4,
"group" : "common"
} ]
},
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
index d580432221c3..a06579e9c98b 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
@@ -10889,16 +10889,10 @@
"description" : "Number of spaces per indentation level.",
"default" : 2
},
- "lengthMarker" : {
- "type" : "boolean",
- "title" : "Length Marker",
- "description" : "Whether to prefix array lengths with a hash
marker so arrays render as hash-prefixed lengths instead of plain lengths.",
- "default" : false
- },
"strict" : {
"type" : "boolean",
"title" : "Strict",
- "description" : "Whether to enable strict validation when
unmarshalling TOON. When false, JToon uses best-effort parsing.",
+ "description" : "Whether to enable strict validation when
unmarshalling TOON. When false, the decoder applies the non-strict recoveries
of the TOON specification, such as accepting an array whose length differs from
the declared length; other malformed TOON still fails.",
"default" : true
}
}
diff --git a/parent/pom.xml b/parent/pom.xml
index 186f6dada2ee..9ee7f145ce80 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -182,7 +182,7 @@
<fory-version>1.7.7</fory-version>
<ph-ubl-version>10.2.0</ph-ubl-version>
<j8583-version>3.0.1</j8583-version>
- <jtoon-version>2.0.5</jtoon-version>
+ <jtoon-version>2.0.7</jtoon-version>
<jakarta-jms-api-version>3.1.0</jakarta-jms-api-version>
<jakarta-persistence-api-version>3.2.0</jakarta-persistence-api-version>
<jakarta-json-api-version>2.1.3</jakarta-json-api-version>