Claus Ibsen created CAMEL-26266:
-----------------------------------

             Summary: camel-huaweicloud-functiongraph - a function result 
without a top-level body field leaves the body null, and a JSON body as bytes 
or a JSON array fails
                 Key: CAMEL-26266
                 URL: https://issues.apache.org/jira/browse/CAMEL-26266
             Project: Camel
          Issue Type: Bug
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of hwcloud-functiongraph 
(CAMEL-24961, PR #28406).

h4. 1. A result without a body field is lost

{{FunctionGraphProducer.invokeFunction}} (main 2a465aa4814c, lines 107-109) 
sets the body to the {{body}} field of the result only, so a function that 
returns any other JSON (no top-level {{body}}) leaves the message body null, 
and the result is lost. Checked on 4.24.0-SNAPSHOT with a mock SDK client set 
on the endpoint.

Proposed: keep the whole result when it has no {{body}} field (or add an option 
to return the whole result).

h4. 2. A JSON body as bytes or stream, or a JSON array, fails

Lines 76-89 accept a Map or a String with a JSON object only; byte[]/stream 
JSON and a JSON array fail "Exchange body is mandatory and should be a valid 
Map or JSON string". Checked on 4.24.0-SNAPSHOT with a mock SDK client set on 
the endpoint.

Proposed: convert other bodies to String first, and accept any JSON value the 
function takes.

_Claude Code on behalf of davsclaus_



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

Reply via email to