Claus Ibsen created CAMEL-27468:
-----------------------------------
Summary: camel-jbang - show the format of the body (json, xml,
text, binary ...) next to its Java type, from the Content-Type each step is
reached with
Key: CAMEL-27468
URL: https://issues.apache.org/jira/browse/CAMEL-27468
Project: Camel
Issue Type: Improvement
Components: camel-jbang
Reporter: Claus Ibsen
Fix For: 4.25.0
The TUI shows, next to each step of a route, the Java types of the bodies the
step has been reached with (CAMEL-25892), such as {{byte[]}} or
{{LinkedHashMap}}, and their kinds (null, payload, data, collection) when there
is more than one. The runtime records them in the {{body-type}} dev console
({{BodyTypeDevConsole}}).
The Java type alone often does not tell what the data is: a {{byte[]}} or a
stream can hold JSON, XML, CSV or a PDF. The catalog describes bodies with a
format since CAMEL-25928 ({{BodyType.format}}: json, xml, csv, yaml, text or
binary, the names of the data types of Kamelets), and {{camel doc}} prints it,
such as "stream, as csv". At runtime that format usually travels in the
{{Content-Type}} header: the Kamelet data types set it ({{application/json}}
for {{json}}, {{text/plain}} for {{text}}, {{application/octet-stream}} for
{{binary}}), and so do many components.
h3. Proposal
* The {{body-type}} dev console also records, per processor, the media types of
the {{Content-Type}} header the step has been reached with (or none), as it
does for the Java types.
* The media type is mapped to the format names of the catalog:
{{application/json}} and {{+json}} types to json, {{application/xml}},
{{text/xml}} and {{+xml}} to xml, {{text/csv}} to csv, {{application/yaml}} to
yaml, other {{text/*}} to text, {{application/octet-stream}} to binary; any
other media type is shown as it is.
* The TUI shows it next to the Java type, in the Source, Routes and Diagram
views, such as {{byte[] · json}} or {{LinkedHashMap}} (no Content-Type). A step
reached with more than one format is marked, as a step with more than one kind
is today.
* {{camel cmd route-structure}} and the MCP tools give it too, so an AI
assistant can compare what a step got with what the catalog says it takes.
h3. Example
A route {{file-watch-source -> csv-deserialize-action -> split ->
postgresql-sink}} shows today {{File}}, {{ArrayList}}, {{LinkedHashMap}}. With
the format, a step after a Kamelet with {{out: json}} would show {{byte[] ·
json}}, and a {{LinkedHashMap}} that goes into a sink that takes {{json}} is
easy to spot.
Found while writing the blog post about the Kamelets of Camel 4.24 (2026-11-23).
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)