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

   **A regression on main since CAMEL-27258 (apache/camel#30453, merged 
today).** `google-mail-source` gives the text of an email as JSON text: the 
text in double quotes, with JSON escapes. Its template made that with `marshal: 
json`, and it declares `out: json`.
   
   Until now, Camel applied that output type only after the consuming route had 
run, so it had no visible effect. Since CAMEL-27258 it's applied before the 
consuming route. The `application-json` transformer sees a JSON string such as 
`"Hello"`, which isn't an object or an array, so it encodes it again. The 
consuming route then gets `"\"Hello\""`.
   
   **The fix:** the template drops `marshal: json`, and the `json` default does 
the one encoding. The output is what the description says: `"Hello"` with 
`Content-Type: application/json`.
   
   ### Verified
   `camel run` on Camel main (which includes CAMEL-27258), with a test source 
Kamelet that gives `Hello` and declares `out: json`, as google-mail-source does:
   - with `marshal: json` in the template: the consuming route gets 
`["\"Hello\""]`, encoded twice;
   - without it (this PR): `["Hello"]`, with `Content-Type: application/json`.
   
   `google-mail-source` has no Citrus test, as the Gmail API can't be stood in 
for (#3288 lists the untested Kamelets). `./mvnw install` passes, run twice.
   
   The data type proposal for #3117 checks the other sources with a `json` 
default. They marshal objects, which the transformer leaves as they are.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
   


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