This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-4.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.22.x by this push:
     new c6a6385c76b1 [backport camel-4.22.x] camel-core-model: the avro 
dataformat's library option defaults to a value not in its own enum (#30298)
c6a6385c76b1 is described below

commit c6a6385c76b1440ac2b22ec4d94270a3ba014a4e
Author: Guillaume Nodet <[email protected]>
AuthorDate: Wed Nov 18 07:42:59 2026 +0100

    [backport camel-4.22.x] camel-core-model: the avro dataformat's library 
option defaults to a value not in its own enum (#30298)
    
    * camel-core-model: the avro dataformat's library option defaults to a 
value not in its own enum
    
        @Metadata(defaultValue = "avroJackson", description = "Which Avro 
library to use.")
        private AvroLibrary library = AvroLibrary.Jackson;
    
    avroJackson is the dataFormatName AvroLibrary.Jackson carries, not the
    constant, and the constant is what the attribute takes. The catalog ends
    up contradicting itself:
    
        "library": { ... "enum": [ "ApacheAvro", "Jackson" ], "defaultValue": 
"avroJackson", ... }
    
    The YAML DSL schema says the same, and there it is a JSON Schema whose
    declared default is not among its own enum values, so a validating
    editor rejects the default it was given. camel-spring.xsd and
    camel-xml-io.xsd both document "Default value: avroJackson" for an
    attribute that only accepts ApacheAvro or Jackson.
    
    JsonDataFormat, the closest sibling, has it right: defaultValue =
    "Jackson" against enum Fastjson, Gson, Jackson, Jsonb.
    
    Declare Jackson, the constant the field is initialised to.
    
    * Regen
    
    * camel-yaml-dsl-validator: resolve a data format whose library is the 
model's own name
    
    CatalogBodyTypes.dataFormat matched the library option against the data
    format names of the model, which worked while avro's default was the
    data format name avroJackson. With the default now the enum constant
    Jackson, avro: {} matched neither avro nor avroJackson and the validator
    lost avro's body types.
    
    Match the library against <model><library> as well, so Jackson finds
    avroJackson, and fall back to the data format named like the model, so
    ApacheAvro finds avro. That second half also fixes protobuf, whose
    default GoogleProtobuf never resolved to the protobuf data format.
    
    TextBodyFlowTest#testTheBodyOfBinaryDataFormats now covers
    avro: {library: ApacheAvro} next to the default case.
    
    * camel-yaml-dsl-validator: an avro unmarshal with ApacheAvro gives an 
object, not parsed data
    
    The ApacheAvro library makes an object of instanceClassName, which the file
    producer is not reported for, like cbor. Test the library option resolution
    of the avro data format directly instead.
    
    
    
    Backport of #29971. CatalogBodyTypes.java and TextBodyFlowTest.java do not 
exist on camel-4.22.x and are left out.
    (cherry picked from commit 9bc84e58d0426d105b9991277cfa5a2b559986b9)
    
    Co-Authored-By: Claude Opus 5 <[email protected]>
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../src/generated/resources/org/apache/camel/catalog/models/avro.json   | 2 +-
 .../resources/org/apache/camel/catalog/schemas/camel-spring.xsd         | 2 +-
 .../resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd         | 2 +-
 .../resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json  | 2 +-
 .../resources/META-INF/org/apache/camel/model/dataformat/avro.json      | 2 +-
 .../src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java | 2 +-
 .../generated/java/org/apache/camel/java/out/JavaDslModelWriter.java    | 2 +-
 .../src/generated/java/org/apache/camel/xml/out/ModelWriter.java        | 2 +-
 .../src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java   | 2 +-
 .../org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java     | 2 +-
 .../src/generated/resources/schema/camelYamlDsl-canonical.json          | 2 +-
 .../src/generated/resources/schema/camelYamlDsl-model.json              | 2 +-
 .../camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json     | 2 +-
 13 files changed, 13 insertions(+), 13 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/avro.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/avro.json
index ea01270769b7..6f79af5eab88 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/avro.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/avro.json
@@ -15,7 +15,7 @@
   "properties": {
     "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" },
     "instanceClassName": { "index": 1, "kind": "attribute", "displayName": 
"Instance Class Name", "group": "common", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Class name to use for marshal and 
unmarshalling." },
-    "library": { "index": 2, "kind": "attribute", "displayName": "Library", 
"group": "common", "required": false, "type": "enum", "javaType": 
"org.apache.camel.model.dataformat.AvroLibrary", "enum": [ "ApacheAvro", 
"Jackson" ], "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "avroJackson", "description": "Which Avro library to use." },
+    "library": { "index": 2, "kind": "attribute", "displayName": "Library", 
"group": "common", "required": false, "type": "enum", "javaType": 
"org.apache.camel.model.dataformat.AvroLibrary", "enum": [ "ApacheAvro", 
"Jackson" ], "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "Jackson", "description": "Which Avro library to use." },
     "objectMapper": { "index": 3, "kind": "attribute", "displayName": "Object 
Mapper", "group": "advanced", "label": "advanced", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "Lookup and use the existing 
ObjectMapper with the given id when using Jackson." },
     "useDefaultObjectMapper": { "index": 4, "kind": "attribute", 
"displayName": "Use Default Object Mapper", "group": "common", "required": 
false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, "description": 
"Whether to lookup and use default Jackson ObjectMapper from the registry." },
     "unmarshalType": { "index": 5, "kind": "attribute", "displayName": 
"Unmarshal Type", "group": "common", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Class name of the java type to use when 
unmarshalling." },
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 41e02a712a7a..9f046e2ec875 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
@@ -7166,7 +7166,7 @@ Class name to use for marshal and unmarshalling.
           <xs:annotation>
             <xs:documentation xml:lang="en">
 <![CDATA[
-Which Avro library to use. Default value: avroJackson
+Which Avro library to use. Default value: Jackson
 ]]>
             </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 4000d296d0ab..e99399e04af2 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
@@ -6288,7 +6288,7 @@ Class name to use for marshal and unmarshalling.
           <xs:annotation>
             <xs:documentation xml:lang="en">
 <![CDATA[
-Which Avro library to use. Default value: avroJackson
+Which Avro library to use. Default value: Jackson
 ]]>
             </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 c207e4c41bfe..0e2a74f1d16c 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
@@ -9869,7 +9869,7 @@
         "enum" : [ "ApacheAvro", "Jackson" ],
         "description" : "Which Avro library to use.",
         "title" : "Library",
-        "default" : "avroJackson",
+        "default" : "Jackson",
         "displayName" : "Library",
         "kind" : "attribute",
         "index" : 2,
diff --git 
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/avro.json
 
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/avro.json
index ea01270769b7..6f79af5eab88 100644
--- 
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/avro.json
+++ 
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/avro.json
@@ -15,7 +15,7 @@
   "properties": {
     "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" },
     "instanceClassName": { "index": 1, "kind": "attribute", "displayName": 
"Instance Class Name", "group": "common", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Class name to use for marshal and 
unmarshalling." },
-    "library": { "index": 2, "kind": "attribute", "displayName": "Library", 
"group": "common", "required": false, "type": "enum", "javaType": 
"org.apache.camel.model.dataformat.AvroLibrary", "enum": [ "ApacheAvro", 
"Jackson" ], "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "avroJackson", "description": "Which Avro library to use." },
+    "library": { "index": 2, "kind": "attribute", "displayName": "Library", 
"group": "common", "required": false, "type": "enum", "javaType": 
"org.apache.camel.model.dataformat.AvroLibrary", "enum": [ "ApacheAvro", 
"Jackson" ], "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "Jackson", "description": "Which Avro library to use." },
     "objectMapper": { "index": 3, "kind": "attribute", "displayName": "Object 
Mapper", "group": "advanced", "label": "advanced", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "Lookup and use the existing 
ObjectMapper with the given id when using Jackson." },
     "useDefaultObjectMapper": { "index": 4, "kind": "attribute", 
"displayName": "Use Default Object Mapper", "group": "common", "required": 
false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, "description": 
"Whether to lookup and use default Jackson ObjectMapper from the registry." },
     "unmarshalType": { "index": 5, "kind": "attribute", "displayName": 
"Unmarshal Type", "group": "common", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Class name of the java type to use when 
unmarshalling." },
diff --git 
a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
 
b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
index 67e07e89db37..ee11544c4b14 100644
--- 
a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
+++ 
b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
@@ -48,7 +48,7 @@ public class AvroDataFormat extends DataFormatDefinition 
implements ContentTypeH
     @Metadata(description = "Class name to use for marshal and unmarshalling.")
     private String instanceClassName;
     @XmlAttribute
-    @Metadata(defaultValue = "avroJackson", description = "Which Avro library 
to use.")
+    @Metadata(defaultValue = "Jackson", description = "Which Avro library to 
use.")
     private AvroLibrary library = AvroLibrary.Jackson;
     @XmlAttribute
     @Metadata(label = "advanced",
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 aa86751550ed..23eb4493412b 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
@@ -2828,7 +2828,7 @@ public class JavaDslModelWriter extends 
JavaDslModelWriterSupport {
         doWriteAttribute(sb, "collectionType", def.getCollectionTypeName(), 
null);
         doWriteAttribute(sb, "jsonView", def.getJsonViewTypeName(), null);
         doWriteAttribute(sb, "instanceClassName", def.getInstanceClassName(), 
null);
-        doWriteAttribute(sb, "library", toString(def.getLibrary()), 
"avroJackson");
+        doWriteAttribute(sb, "library", toString(def.getLibrary()), "Jackson");
         doWriteAttribute(sb, "objectMapper", def.getObjectMapper(), null);
         doWriteAttribute(sb, "useDefaultObjectMapper", 
def.getUseDefaultObjectMapper(), "true");
         doWriteAttribute(sb, "include", def.getInclude(), null);
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 040cacfecdad..ce3381086f0e 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
@@ -2147,7 +2147,7 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("collectionType", def.getCollectionTypeName(), null);
         doWriteAttribute("jsonView", def.getJsonViewTypeName(), null);
         doWriteAttribute("instanceClassName", def.getInstanceClassName(), 
null);
-        doWriteAttribute("library", toString(def.getLibrary()), "avroJackson");
+        doWriteAttribute("library", toString(def.getLibrary()), "Jackson");
         doWriteAttribute("objectMapper", def.getObjectMapper(), null);
         doWriteAttribute("useDefaultObjectMapper", 
def.getUseDefaultObjectMapper(), "true");
         doWriteAttribute("include", def.getInclude(), null);
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 c50d216caba3..8d05ca993175 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
@@ -2143,7 +2143,7 @@ public class YamlModelWriter extends 
YamlModelWriterSupport {
         doWriteAttribute(jo, "collectionType", def.getCollectionTypeName(), 
null);
         doWriteAttribute(jo, "jsonView", def.getJsonViewTypeName(), null);
         doWriteAttribute(jo, "instanceClassName", def.getInstanceClassName(), 
null);
-        doWriteAttribute(jo, "library", toString(def.getLibrary()), 
"avroJackson");
+        doWriteAttribute(jo, "library", toString(def.getLibrary()), "Jackson");
         doWriteAttribute(jo, "objectMapper", def.getObjectMapper(), null);
         doWriteAttribute(jo, "useDefaultObjectMapper", 
def.getUseDefaultObjectMapper(), "true");
         doWriteAttribute(jo, "include", def.getInclude(), null);
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 fdd37d85b275..786f368c0995 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
@@ -732,7 +732,7 @@ public final class ModelDeserializers extends 
YamlDeserializerSupport {
                     @YamlProperty(name = "include", type = "string", 
description = "If you want to marshal a pojo to JSON, and the pojo has some 
fields with null values. And you want to skip these null values, you can set 
this option to NON_NULL.", displayName = "Include"),
                     @YamlProperty(name = "instanceClassName", type = "string", 
description = "Class name to use for marshal and unmarshalling.", displayName = 
"Instance Class Name"),
                     @YamlProperty(name = "jsonView", type = "string", 
description = "When marshalling a POJO to JSON you might want to exclude 
certain fields from the JSON output. With Jackson you can use JSON views to 
accomplish this. This option is to refer to the class which has JsonView 
annotations.", displayName = "Json View"),
-                    @YamlProperty(name = "library", type = 
"enum:ApacheAvro,Jackson", defaultValue = "avroJackson", description = "Which 
Avro library to use.", displayName = "Library"),
+                    @YamlProperty(name = "library", type = 
"enum:ApacheAvro,Jackson", defaultValue = "Jackson", description = "Which Avro 
library to use.", displayName = "Library"),
                     @YamlProperty(name = "moduleClassNames", type = "string", 
description = "To use custom Jackson modules 
com.fasterxml.jackson.databind.Module specified as a String with FQN class 
names. Multiple classes can be separated by comma.", displayName = "Module 
Class Names"),
                     @YamlProperty(name = "moduleRefs", type = "string", 
description = "To use custom Jackson modules referred from the Camel registry. 
Multiple modules can be separated by comma.", displayName = "Module Refs"),
                     @YamlProperty(name = "objectMapper", type = "string", 
description = "Lookup and use the existing ObjectMapper with the given id when 
using Jackson.", displayName = "Object Mapper"),
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 935186046598..85101e8dd74d 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
@@ -6266,7 +6266,7 @@
             "type" : "string",
             "title" : "Library",
             "description" : "Which Avro library to use.",
-            "default" : "avroJackson",
+            "default" : "Jackson",
             "enum" : [ "ApacheAvro", "Jackson" ]
           },
           "moduleClassNames" : {
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 c207e4c41bfe..0e2a74f1d16c 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
@@ -9869,7 +9869,7 @@
         "enum" : [ "ApacheAvro", "Jackson" ],
         "description" : "Which Avro library to use.",
         "title" : "Library",
-        "default" : "avroJackson",
+        "default" : "Jackson",
         "displayName" : "Library",
         "kind" : "attribute",
         "index" : 2,
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 68f4f668be79..08cf52c5a05a 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
@@ -9663,7 +9663,7 @@
               "type" : "string",
               "title" : "Library",
               "description" : "Which Avro library to use.",
-              "default" : "avroJackson",
+              "default" : "Jackson",
               "enum" : [ "ApacheAvro", "Jackson" ]
             },
             "moduleClassNames" : {

Reply via email to