Claus Ibsen created CAMEL-27268:
-----------------------------------

             Summary: camel-yaml-dsl-validator - warn on parsed data before a 
text-plain data type, which sends it as its toString()
                 Key: CAMEL-27268
                 URL: https://issues.apache.org/jira/browse/CAMEL-27268
             Project: Camel
          Issue Type: Improvement
          Components: camel-yaml-dsl, camel-core
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 4.24.0


The {{@BodyTypes}} of the {{text-plain}} data type 
({{StringDataTypeTransformer}}) say its {{transformerIn}} is {{any}}. So the 
YAML body type validator never warns when parsed data (a Map or a List) comes 
before a Kamelet whose {{spec.dataTypes.in.default}} is {{text}}, or before 
{{transformDataType: text-plain}}. At runtime that body becomes its Java 
{{toString()}}, such as {{\{status=ok\}}}, which the Kamelet descriptions warn 
about.

Fix:
* narrow {{transformerIn}} of {{text-plain}} to text, bytes, a stream, a file, 
a value (such as a number) or no body;
* the validator checks the in data type of a Kamelet and {{transformDataType}} 
with a rule that also accepts a value, so parsed data before them is reported 
with a hint to marshal it first.

Part of the data types work for the Kamelet catalog (camel-kamelets#3117, 
CAMEL-25928).

_Claude Code on behalf of Claus Ibsen_



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

Reply via email to