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

   [CAMEL-27269](https://issues.apache.org/jira/browse/CAMEL-27269)
   
   ### The problem
   A Kamelet declares the body it takes and gives with `spec.dataTypes`, and 
Camel runs the transformer of each default. Many Kamelets leave the body as it 
is or don't read it:
   - the filters;
   - the header, EIP and Kafka-routing actions;
   - `log-sink` and `log-action`;
   - the AWS sinks that ignore the body.
   
   No data type transformer does nothing today, so these Kamelets can't declare 
data types, and tooling such as the YAML body type validator knows nothing 
about them.
   
   ### The change
   - **New core data type `application-x-unchanged`** 
(`UnchangedDataTypeTransformer`, in camel-core-processor): it leaves the body, 
its type and the headers as they are, and sets no `Content-Type`. Its 
`@BodyTypes` say `transformerIn` `any` and `transformerOut` `unchanged`. The 
validator already reads that as "the body after the Kamelet is the body before 
it" (`kameletAfter`).
   - **Default transformer:** it is added to `DefaultTransformerLoader`, next 
to `binary` and `text-plain`.
   - **Catalog and docs:** its metadata and catalog entry are generated, and 
the body types page mentions it in the Kamelets section.
   
   This is part of the data types work for the Kamelet catalog 
(apache/camel-kamelets#3117, CAMEL-25928). It unblocks 25 Kamelets.
   
   ### Tests
   - `UnchangedDataTypeTransformerTest`:
     - the body (same instance) and the headers stay, and no `Content-Type` is 
set;
     - an existing `Content-Type` is kept;
     - it resolves as `application-x-unchanged` and 
`camel:application-x-unchanged`;
     - its body types;
     - `transformDataType("application-x-unchanged")` in a route leaves an 
`Integer` body as it is.
   - `TextBodyFlowTest`: after a Kamelet with `application-x-unchanged` in and 
out, the body is still parsed data. Its fields can be read, and `to: file` 
still warns.
   - Run locally:
     - camel-core: the data type transformer tests, `EipBodyTypesTest`, 
`TransformerContractTest`, `DataTypeProcessorTest` and the `Transformer*Test`s: 
51 pass;
     - camel-catalog: 1143 pass;
     - camel-yaml-dsl-validator: all 375 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