You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/10/20 06:10:00 UTC
[jira] [Assigned] (CAMEL-25862) camel-jbang - the validator hint for a rest-openapi call with parsed data offers the JSON text of the request first, with the fields it needs
[ https://issues.apache.org/jira/browse/CAMEL-25862?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen reassigned CAMEL-25862:
-----------------------------------
Assignee: Claus Ibsen
> camel-jbang - the validator hint for a rest-openapi call with parsed data offers the JSON text of the request first, with the fields it needs
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-25862
> URL: https://issues.apache.org/jira/browse/CAMEL-25862
> Project: Camel
> Issue Type: Improvement
> Components: camel-jbang, camel-yaml-dsl
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.24.0
>
>
> The validator refuses a rest-openapi call whose body is parsed data (a Map or a List) when the operation sends a body (CAMEL-24844, CAMEL-25762). The hint says:
> {noformat}
> to: rest-openapi sends the body as the request of the operation reserveStock (POST in stock-api.json), but the body here is parsed data (a Map or a List), not text - ...: add marshal: json before this step, or let the REST binding write it (bindingMode: json)
> {noformat}
> A model follows the first advice literally: it marshals the data it has. But the request of an operation is rarely the data as it is. In the benchmark example contracts-openapi-client, each line of an order (sku, qty) is sent to reserveStock, whose request needs orderId and qty. The marshalled line has no orderId, so every call is answered 400. The 400 answer ("orderId and a positive qty are required") is not in the log of the app, so the model cannot see why.
> The step fell from 9 of 10 runs (r17, Oct 17-18) to 3 of 8 and 8 of 12 (r18, r19) once this hint came in. In r17, the runtime error said "or set the body to the JSON text", and all 5 runs that met it recovered.
> Proposal:
> * For a rest-openapi call with JSON data, offer the JSON text of the request first: "set the body to the JSON text of the request before this step (it needs orderId, qty), such as with setBody and simple: '{"orderId": ..., "qty": ...}', or add marshal: json before this step when the data has the fields of the request, or let the REST binding write it".
> * The fields come from the specification: the required properties of the operation's JSON request schema, following a $ref to the schemas of the components ({{OpenApiVerbs}} in camel-jbang reads the specification already, for the verbs).
> * Other steps keep their hint (a file, an http POST, the reply of a REST route).
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)