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

   Stacked on #28178 (it needs the `BodyTypeRegistry`). Review that one first; 
this PR's own change is the last commit.
   
   When a step fails on the body and the message history is on, the hint now 
says when other messages have reached the same step with another kind of body:
   
   ```
   ${body.qty} ... the body is text (a String): unmarshal it first (unmarshal: 
json) to read its fields; other messages
   reached this step with data (LinkedHashMap), so the body here depends on the 
path a message takes
   ```
   
   The step is right for some messages, and a path to it is what differs, such 
as a branch that does not unmarshal. A person or a model reading the error then 
looks at the branches before the step, instead of changing the step itself. The 
benchmark runs showed exactly this case: some paths marshal or unmarshal, 
others don't.
   
   ## How
   
   - `BodyFacts.hint(...)` appends the clause, so every caller gets it with no 
change: the bean OGNL read, Groovy, jsonpath, jq, unmarshal, the HTTP producer, 
the platform-http reply and the file write. It is the last part of every 
message, and it reads right also where a caller wraps the hint in parentheses.
   - The failing step is the last entry of the message history. Its kinds come 
from the registry; the kind of the current body is left out.
   - The new `BodyTypeRegistry.getBodyTypes(routeId, nodeId, kind)` gives the 
types of one kind. The default registry keeps each type with its kind in one 
array, so a reader never sees the two half-updated.
   - Without the message history, or when every message brought the same kind, 
nothing changes.
   - One sentence in the Message History docs (and the catalog copy).
   
   ## Tests
   
   - New `BodyFactsOtherBodiesTest` (camel-core):
     - a message through the branch that makes data, then one with text: the 
read on the text says other messages brought data;
     - two messages with text: no clause.
   - `DefaultBodyTypeRegistryTest`: the types of one kind.
   - These still pass, unchanged: `SimpleSyntaxHintsTest` (33), 
`BodyFactsTest`, `BodyTypeRegistryTest` and the `MessageHistory*` tests, 58 in 
all.
   
   _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