Claus Ibsen created CAMEL-27475:
-----------------------------------

             Summary: camel-jbang - show the data type a Kamelet turns the body 
into, at the step that calls it (LinkedHashMap -> json)
                 Key: CAMEL-27475
                 URL: https://issues.apache.org/jira/browse/CAMEL-27475
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 4.24.0


Follow-up of CAMEL-27468.

The body types of each step (CAMEL-25892) and their formats (CAMEL-27468) are 
what a step was reached with. At a step that calls a Kamelet, the body is then 
turned into the in data type of the Kamelet, by a data type transformer, before 
the template of the Kamelet sees it. That conversion is not shown anywhere.

h3. Example

The sample of the Kamelets 4.24 blog post: {{file-watch-source -> 
csv-deserialize-action -> split -> postgresql-sink}}. The TUI shows {{File}}, 
{{ArrayList}}, {{LinkedHashMap}}, {{LinkedHashMap}}, so it looks as if a 
{{Map}} goes into a sink that takes JSON, and yet the sink works: its 
{{dataTypes.in}} is {{json}} ({{format: application-json}}), and the 
{{application-json}} transformer writes the {{Map}} as JSON bytes.

h3. Where this is known

* The Kamelet: {{spec.dataTypes.in/out}}, the default type, its {{format}} (the 
transformer) and {{mediaType}}. At runtime {{KameletRoutesBuilderLoader}} sets 
the {{in}} type as the {{inputType}} of the route, and the {{out}} type as the 
{{kameletOutputType}} route property, which {{KameletProducer}} applies.
* The catalog: {{transformers/<name>.json}}, {{bodyTypes.transformerIn}} (the 
carriers it takes: {{application-json}} takes text, bytes, stream, map, list, 
pojo, null) and {{transformerOut}} (carriers, javaType, format).
* The YAML validator already combines the two ({{ValidatorFacts}} -> 
{{ProjectFacts.KameletDataTypes}}, 
{{CatalogBodyTypes.transformerIn/transformerOut}} in {{TextBodyFlow}}).

h3. Proposal

* The route-structure console gives, for a route with one, its input data type 
and the output data type of a Kamelet (from the route, so placeholders are 
resolved).
* The TUI (Source, Routes, Diagram), {{camel cmd route-structure}} and the MCP 
tools join it with the catalog transformer, and show the conversion at the step 
that calls the Kamelet: {{LinkedHashMap -> json}}, {{File -> text}}.
* No warning when the transformer takes the body; a warning when it does not, 
such as an {{ArrayList}} into {{text-plain}}, which takes text, bytes, a 
stream, a file or a value.

h3. Also

* The catalog transformer {{text-plain}} has no {{format}} in 
{{transformerOut}}, where {{application-json}} has {{json}}: it should say 
{{text}}.

_Claude Code on behalf of Claus Ibsen_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to