davsclaus opened a new pull request, #26716:
URL: https://github.com/apache/camel/pull/26716

   Fixes https://issues.apache.org/jira/browse/CAMEL-24882
   
   In the camel-jbang-mcp stepwise benchmark the local model wrote a Groovy 
expression that returns `'resource:file:order.json'`; the body became that text 
and the JSON unmarshal failed with `Unrecognized token 'resource'`, and nothing 
at write time or run time said why.
   
   - **Validator** (`camel validate`, `camel_validate_source`, 
`camel_write_file`): a script expression (groovy, jq, js, python, mvel, ognl, 
java, spel, ...) whose text holds a quoted `resource:...` literal gets: 
"groovy: the script returns the text 'resource:file:order.json', not the file: 
the resource: prefix is resolved on an expression's text, never on a value it 
returns. Add resolveResource: true under groovy: to load the resource the 
result names, or set the body with constant: \"resource:file:order.json\" 
(simple: \"resource:file:${...}\" for a name chosen per message)". The 
`resource:` prefix on the expression text itself (`groovy: 
"resource:file:script.groovy"`) and an expression that already has 
`resolveResource: true` (CAMEL-24884, #26714) are left alone; inline values, 
`expression:` values and block scalars are read, with the `\"` of a 
double-quoted YAML scalar unescaped.
   - **Error diagnoser** (`camel_error_diagnose`): `JsonParseException` is a 
known exception now, with the returned literal as its first cause and the same 
two fixes.
   
   Tests in `SourceValidatorResourceLiteralTest`; every documentation example 
still passes `CatalogDocExamplesTest`.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj


-- 
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]

Reply via email to