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

   ## What
   
   [CAMEL-25928](https://issues.apache.org/jira/browse/CAMEL-25928), a small 
item of the EIP body types: the catalog can now say what `variableReceive` and 
`variableSend` do to the body, whatever variable name the step uses.
   
   Stacked on #28447, the validator reading the EIP body types from the catalog.
   
   ### Before
   
   `@BodyType.When` matched one value of an option, so the seven EIPs with a 
variable option had `dependsOn: variableReceive` ("not known when set"). The 
YAML validator ignored both options, and reported false errors:
   
   ```yaml
   - unmarshal: {json: {}, variableReceive: order}   # the body stays text
   - to: file:outbox                                  # ERROR: "the body here 
is parsed data (a Map or a List)"
   
   - unmarshal: {json: {}}
   - to: {uri: file:outbox, variableSend: text}       # sends the variable: 
same false ERROR
   ```
   
   ### After
   
   - **`value = "*"` is any value of the option** (`@BodyType.When`, documented 
in the Javadoc and on the Message Body Types page). No new JSON key: an older 
reader just never matches it and keeps "not known".
   - **Declarations (camel-core-model):**
     - eipOut: with `variableReceive` set the body is `unchanged`. This covers 
to, toD, enrich, pollEnrich, poll, marshal and unmarshal.
     - eipIn: with `variableSend` set the step needs no body (`any`). This 
covers to, toD, marshal and unmarshal.
     - from: a new `eipOut` from `consumerOut`. With `variableReceive` set the 
route starts with no body (`null`), because `RouteReifier.VariableAdvice` moves 
the message into the variable.
   - **`BodyTypeResolver`:** a matching `*` entry wins over `from` and 
`dependsOn`. This matches the runtime: `Enricher` restores the original body 
even when an `aggregationStrategy` is set.
   - **Build checks (`BodyTypesHelper`):** an option with `*` must not also be 
in `dependsOn`, nor have other values in `byOption`.
   - **YAML validator:**
     - a step that keeps the body (`variableReceive`) keeps the walk's body;
     - a `to` with `variableSend` is not checked against the body;
     - a route whose `from` has `variableReceive` starts with no body. 
`BodyTypeFlow` reports a body read there, as it does for a timer.
   - **Docs:** the website's Message Body table renders `*` as "With 
`variableReceive` set". The `camel_catalog_doc` lines for the AI tools do the 
same.
   
   ## Tests
   
   - `EipBodyTypesTest` (camel-core, runtime) passes 13 tests. For each of the 
7 EIPs, with `variableReceive` the body is the same instance and the reply is 
in the variable. This includes enrich with an aggregation strategy. 
`variableSend` sends the variable. `fromV` starts the route with a null body.
   - `BodyTypeResolverTest` passes 12 tests and `BodyTypesHelperEipTest` passes 
7.
   - Validator: 306 tests pass. The 5 new tests (`TextBodyFlowTest` 
testVariable*, `BodyTypeFlowTest` testVariable* and 
testAToWithVariableReceiveSetsNoBody) all fail on the old validator code.
   - jbang-core AI tests pass, 741 of them, including the new 
`CatalogDocsTest.aBodyForAnyValueOfAnOption`.
   
   _Claude Code on behalf of 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]

Reply via email to