[ 
https://issues.apache.org/jira/browse/CAMEL-26386?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen reassigned CAMEL-26386:
-----------------------------------

    Assignee: Claus Ibsen

> camel-yaml-dsl-validator - Body type checks: a field read on the List of a 
> JSON array file, a field read after a marshal of an unknown body, a 
> variableSend of a header, and a setBody that emptied the body
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26386
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26386
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core, camel-jbang, camel-yaml-dsl
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> Four findings from the local-model benchmark (qwen3.6, r23), after the body 
> type checks of CAMEL-25928.
> *A field read on the List of a JSON array file* (rest-code-first step 1, 0 of 
> 7 runs in r22 and r23)
> After setBody resource:file:orders.json and unmarshal: json, the model read 
> ${body.orderId} in a choice. orders.json is a JSON array, so the body is a 
> List, and the runtime hint ("a List has no method or key orderId ... use 
> jsonpath") came only after the first reload. 4 runs then ended with the right 
> route, but the errors of the first version were counted. The AI tools now 
> read which JSON files of the project a resource: of the routes loads are 
> arrays (ProjectFacts.jsonArrays), and the validator reports a Simple field 
> read on that List when the file is written, with the same jsonpath advice. 
> Groovy is left alone (body.orderId of a List is the List of the orderIds 
> there).
> *A field read after a marshal of a body that is not known* (enrich-and-dedupe 
> step 3)
> In a direct: route a wire tap sends the order Map to, the model marshalled 
> and then logged ${body[orderId]}. The body before the marshal is not known 
> there, and the advice was "unmarshal: json is the step, not marshal". The 
> model added an unmarshal of the Map, which failed at runtime. The advice now 
> first says to read the field before the marshal, and to unmarshal only when 
> the body was text that was meant to be parsed.
> *A variableSend of a header* (ai-ticket-classifier step 1)
> The model set a header prompt and sent variableSend: prompt to the chat 
> model, which then got an empty request. When the route sets a header of that 
> name and no step sets the variable (and no bean, processor or script could), 
> the validator says to set it with setVariable.
> *A setBody that emptied the body* (http-client step 1)
> The route set the body to ${null} and then read ${body[sku]}. The runtime 
> hint said "read the data first - setBody with constant: resource:file:...", 
> which did not fit. When the message history shows that a setBody or a 
> transform emptied the body, the hint names that step and says to read what is 
> needed before it, or to write a fixed value as a constant.
> _Filed by Claude Code on behalf of davsclaus_



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

Reply via email to