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

   > **Stacked on #28059**, which adds `BodyFacts`. Until #28059 is merged this 
PR also shows its commit: review the last one, `da3700fcd80c`. Once #28059 is 
merged I rebase onto main (its commit drops out) and mark this ready.
   
   ## What
   
   The second part of 
[CAMEL-25749](https://issues.apache.org/jira/browse/CAMEL-25749): the body 
failures that had no sentence get the `BodyFacts` one.
   
   **simple and bean OGNL on the message body** (`BeanExpression`) now say what 
the body is and what to write, when the body is the payload (text, bytes, a 
stream, the file as read) or an iterator:
   
   | read | body | the added sentence |
   |---|---|---|
   | `${body.qty}` | the cached stream of an HTTP request | `(the body is a 
cached stream (ByteArrayInputStreamCache): unmarshal it first (unmarshal: json, 
for the Content-Type application/json) to read its fields)` |
   | `${body[status]}` | the file consumer's body | `Key: status not found in 
bean: ... (the body is the file as read (a GenericFile): unmarshal it first 
(unmarshal: json, for the file name order-1003.json) to read its fields)` |
   | `${body.size()}` | sql's StreamList | `(the body is an iterator 
(ResultSetIterator): it has no size and can be read once: split it, or have the 
producer give a List)` |
   
   With the message history on, each also names the step that set the body.
   
   **Groovy** `body.sku` on the body itself (the file as read, a stream) gets 
the same sentence. Before, only a read on text bytes or characters did 
(CAMEL-25330).
   
   These are the failures the local-model benchmark met:
   - `${body.qty}` on the request's stream cache (contracts-openapi-server, 
r17);
   - `${body.size()}` on the iterator (connect-service-sql, r17);
   - `${body[status]}` on a GenericFile (round 2).
   
   Kept:
   - **Exception types.** The key failure stays an `IndexOutOfBoundsException`, 
and the method failure a `RuntimeBeanExpressionException`, with the sentence in 
the place the Map-key hint (CAMEL-25322) already uses.
   - **Only the body.** The sentence is added only when the bean the read 
failed on is the message body.
   - **A wrong name** on an object, or a List, still reports only the wrong 
name. A Map keeps its key list.
   
   ## Tests
   
   - `SimpleSyntaxHintsTest` (camel-core): the stream cache with a JSON 
Content-Type, the iterator, the GenericFile with a file name, and an object 
whose wrong name gets no body sentence. 30 tests.
   - `GroovyMissingPropertyHintTest` (camel-groovy): `body.sku` on a cached 
stream. 13 tests.
   - **Local runs**, against camel-support and camel-bean from this branch 
through a scratch local repository:
     - camel-core: `SimpleTest`, `SimpleOperatorTest` and the bean tests (288, 
0 failures), and `BodyFactsTest`;
     - camel-bean: 9;
     - camel-groovy: 120.
   
   _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