davsclaus opened a new pull request, #30477:
URL: https://github.com/apache/camel/pull/30477

   [CAMEL-27272](https://issues.apache.org/jira/browse/CAMEL-27272)
   
   ### The problem
   `application-x-java-object` reads Json into the class of the 
`X-Content-Class` exchange property, and keeps a POJO when that property isn't 
set. `avro-x-java-object` and `protobuf-x-java-object` extend it. A Map or a 
List without the property fails with "Missing content class information for 
Java object data type processing", although it is a Java object already and 
there is no class to read it into.
   
   So a Kamelet whose body is a Map or a List has no data type that keeps it. 
Examples are `jolt-transformation-action`, `kafka-batch-source`, and the `in` 
of `json-serialize-action`, `jsonata-action`, `avro-serialize-action` and 
`protobuf-serialize-action`.
   
   ### The change
   - **`JsonPojoDataTypeTransformer`** (camel-jackson and camel-jackson3), and 
through it the Avro and Protobuf subclasses: without `X-Content-Class`, a Map 
or a List (any `Collection`) is kept as it is and gets `Content-Type: 
application/x-java-object`. With the property, a Map or a List still fails, as 
does a null body.
   - **Body types:** for all six transformers, `transformerIn` lists `map` and 
`list`, and the descriptions say when they are kept. The generated metadata and 
the catalog copies are updated.
   
   This is part of the data types work for the Kamelet catalog 
(apache/camel-kamelets#3117, CAMEL-25928).
   
   ### Tests
   - `JsonPojoDataTypeTransformerTest`, `AvroPojoDataTypeTransformerTest`, 
`ProtobufPojoDataTypeTransformerTest` (Jackson 2 and 3 each):
     - a Map and a List are kept as the same instance without the property, 
with the Content-Type;
     - a Map with the property still fails;
     - the body types.
   - Run locally:
     - camel-jackson, camel-jackson3, camel-jackson-avro, camel-jackson3-avro, 
camel-jackson-protobuf, camel-jackson3-protobuf: all tests pass;
     - camel-yaml-dsl-validator: all 374 pass, against a catalog jar packaged 
with this change.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to