davsclaus commented on issue #3117:
URL: 
https://github.com/apache/camel-kamelets/issues/3117#issuecomment-7010338385

   Found in the first batch (the Transformation, JSON and EIP actions, #3263). 
Each point needs a fix in Camel before these Kamelets can get a default.
   
   **1. Two transformers have the same names.** `camel-jackson` (Jackson 2) and 
`camel-jackson3` both register `application-json`, `application-x-struct` and 
`application-x-java-object`. `camel-jackson-avro` / `camel-jackson3-avro` and 
`camel-jackson-protobuf` / `camel-jackson3-protobuf` do the same with 
`avro-x-struct` and `protobuf-x-struct`.
   - Camel resolves a transformer through 
`META-INF/services/org/apache/camel/transformer/<name>`, so with both versions 
on the classpath, the first one found runs.
   - With `out: struct` on `json-deserialize-action`, a `camel run` picked the 
Jackson 2 `application-x-struct`. It failed on the Jackson 3 `JsonNode` the 
action gives: `Cannot construct instance of 
com.fasterxml.jackson.databind.JsonNode`.
   - So no Kamelet that gives parsed JSON can declare `struct` for now. That 
covers `json-deserialize-action`, `jsonata-action`, `avro-deserialize-action`, 
`protobuf-deserialize-action`, and the sources that give a `JsonNode`.
   - `application-json` is safe: both versions handle text, bytes and a stream 
the same way.
   - Camel 4.24 makes Jackson 3 the primary Jackson. The fix could be to prefer 
the Jackson 3 transformer when both are present, or to give the Jackson 2 ones 
their own names.
   
   **2. No transformer keeps a `Map`.** `jolt-transformation-action` gives a 
`Map` (or a `List`). `application-x-struct` fails on a `Map`, and 
`application-json` would turn it into JSON bytes, which breaks the documented 
`json-serialize-action` after it.
   
   **3. No transformer marks bytes without replacing `Content-Type`.** 
`avro-serialize-action` and `protobuf-serialize-action` give bytes with 
`application/avro` and `application/protobuf`. `application-octet-stream` would 
replace those with `application/octet-stream`.
   
   _Claude Code on behalf of Claus Ibsen_
   


-- 
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