davsclaus opened a new pull request, #28982: URL: https://github.com/apache/camel/pull/28982
Fixes [CAMEL-26502](https://issues.apache.org/jira/browse/CAMEL-26502). Follow-up of CAMEL-26120 (#28897). ## What was wrong `bonita:startCase` takes the contract inputs as a `Map` body. Since CAMEL-26120 a JSON text body such as `{"amount":1}` failed early with an `InvalidPayloadException`, and the docs told users to unmarshal it to a `Map` first. ## What changed - `BonitaStartProducer` reads the contract inputs in a new `getInputs` method. A `String`, `byte[]` or `InputStream` body is read as text and parsed with Jackson (as `AbstractWordpressProducer.getMandatoryBody` does since CAMEL-26163). A JSON object becomes the `Map` of contract inputs. - JSON text that is not an object (array, scalar, `null`, empty text) fails with an `InvalidPayloadException` whose cause says what it was (`The JSON text is not an object of contract inputs but array`). Text that is not JSON fails with an `InvalidPayloadException` caused by the Jackson parse error. Any other body (for example an `Integer`) fails as before. - A `Map` body works as before; the body after the call is unchanged (the `Map` with `FileInput`s replaced, or the JSON text as sent). - `pom.xml`: declares `jackson-databind` directly (it was already on the classpath through `jackson-jakarta-rs-json-provider`). ## Tests `BonitaStartProducerTest` (WireMock Bonita server): a JSON text, bytes and stream body start a case and WireMock checks the instantiation request body with `equalToJson`; an array, `null`, empty text, non-JSON text and an `Integer` body fail with `InvalidPayloadException` and start no case. The old test that expected JSON text to fail is replaced. 7 of the new tests failed before the change. Module: 35 tests, all pass. ## Docs and generated files - `@BodyTypes` `producerIn` now lists `map`, `text`, `bytes`, `stream`, and its description no longer says "unmarshal it to a Map first". `producerOut` description reworded for the JSON text case. - `bonita-component.adoc` "Body content" section updated. - Regenerated `bonita.json`; copied it and the doc into `catalog/camel-catalog`. - No upgrade-guide entry: a body that failed before now works. - No yaml-dsl-validator test references bonita. _Claude Code on behalf of Claus Ibsen (davsclaus)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
