[ 
https://issues.apache.org/jira/browse/CAMEL-23816?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18090980#comment-18090980
 ] 

Claus Ibsen commented on CAMEL-23816:
-------------------------------------

While improving descriptions, I identified an architectural limitation in the 
code generator (SchemaGeneratorMojo) that prevents per-EIP expression 
descriptions.

*The problem:*

{{ExpressionNode.java}} declares a {{private ExpressionDefinition expression}} 
field with a @Metadata description. 19+ EIP subclasses (filter, when, validate, 
setHeader, setBody, setVariable, transform, loop, delay, throttle, sample, 
completionPredicate, correlationExpression, etc.) inherit this same generic 
description through the class hierarchy.

The {{SchemaGeneratorMojo}} walks {{getDeclaredFields()}} up the class 
hierarchy using a {{TreeSet}} with a custom comparator that never returns 0, 
which means if a subclass re-declares the field, the TreeSet stores both 
entries rather than replacing the parent's — resulting in duplicates instead of 
an override.

*Current workaround:*

Improved the generic description in {{ExpressionNode}} from the terse 
"Expression to evaluate." to a broader description that covers the main 
expression use cases:

{quote}
Expression to define the behavior of the EIP such as the value to set, the 
predicate to evaluate, the endpoint to resolve, or the body to split/transform.
{quote}

*Desired improvement:*

Enhance the {{SchemaGeneratorMojo}} to support per-subclass description 
overrides for inherited fields, so each EIP could have a contextually accurate 
expression description. For example:
- *filter*: "The predicate expression to evaluate. Messages that do not match 
are filtered out."
- *setHeader*: "The expression whose result is used as the header value."
- *loop*: "The expression that determines the number of times to loop."
- *delay*: "The expression that determines the delay duration in milliseconds."

This would significantly improve AI and human understanding of each EIP's 
expression purpose.

> camel-core-model - Improve descriptions in model
> ------------------------------------------------
>
>                 Key: CAMEL-23816
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23816
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core, eip
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.21.0
>
>
> The model classes can have more and better descriptions which will helps 
> users and AIs



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to