davsclaus opened a new pull request, #30471: URL: https://github.com/apache/camel/pull/30471
[CAMEL-27266](https://issues.apache.org/jira/browse/CAMEL-27266) ### The bug The `@BodyTypes` of two core data types say that a null body fails: - `ByteArrayDataTypeTransformer` (`application-octet-stream`, `binary`) - `StringDataTypeTransformer` (`text-plain`, `text`) It does not fail. `TypeConverterTransformer.transform` returns early on a null body, so the body stays null and the transformer only sets the `Content-Type` header. The YAML body type validator (`camel-yaml-dsl-validator`) and the Camel CLI (`ValidatorFacts`) read this metadata from the catalog. So their answers are wrong for a data type step with no body, or a Kamelet `spec.dataTypes` default with no body. ### The change - Both transformers add the `null` carrier to `transformerIn` and `transformerOut`, and their descriptions now say that a null body stays null. A `null` carrier still counts as payload-only for the validator (`CatalogBodyTypes.onlyPayload`). - The generated transformer metadata and its catalog copy are regenerated. This is part of the data types work for the Kamelet catalog (apache/camel-kamelets#3117, CAMEL-25928). Two later changes, the binary transformer keeping a file and the narrower `text-plain` input, build on these annotations. ### Tests - `ByteArrayDataTypeTransformerTest`, `StringDataTypeTransformerTest`: the body types list `null`, and a null body stays null and gets the `Content-Type`. - Run locally: - camel-core: the data type transformer tests, `EipBodyTypesTest`, `TransformerContractTest`, `DataTypeProcessorTest`: 38 pass; - camel-yaml-dsl-validator: all 374 pass, against a catalog jar packaged with this change; - camel-jbang-core `ValidatorFactsTest`: 13 pass. _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]
