[
https://issues.apache.org/jira/browse/CAMEL-24714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-24714:
--------------------------------
Description:
Since CAMEL-10698 the model marks the expression properties the reifier
evaluates as predicates with @AsPredicate (filter, when, onWhen, validate,
choice/when, aggregate completionPredicate, the
onWhen/handled/continued/retryWhile of onException and onCompletion, catch,
intercept, interceptFrom, interceptSendToEndpoint), the package plugin writes
it as "asPredicate": true next to "kind": "expression" in the catalog
models/*.json, and JsonMapper reads it back into
EipOptionModel.isAsPredicate(). Nothing else reads it though: the tooling that
needs to know whether a simple: value is a predicate or an expression keeps its
own list.
What is left:
* Marking gaps: PredicateValidatorDefinition.expression is reified with
createPredicate but is not annotated (predicateValidator.json has no
asPredicate). LoopDefinition.expression is a predicate only when doWhile=true;
a per-property flag cannot say that, so it stays unmarked and the consumers
special-case doWhile (say so in the @AsPredicate javadoc).
* Consumers read the catalog: SimpleChecks.PREDICATE_EIPS in camel-jbang-core
(the write-time Simple check of SourceValidator, CAMEL-24698) is replaced by a
lookup of the parent EIP's expression option in the catalog (kind=expression
and asPredicate); the loopDoWhile/loop-do-while entries are dead (the YAML key
is loop with doWhile: true) and go. camel_catalog_sample the same, if it needs
the distinction.
* A test that the properties with asPredicate=true in the catalog are exactly
the ones the reifier evaluates with createPredicate, so the annotation and the
runtime cannot drift apart.
The JSON key stays asPredicate (published in the catalog since 2017); no new
@Metadata attribute.
Discussed with Claus on 2026-09-13 while reviewing PR 26379.
was:
Nothing in the model or the catalog says whether an EIP's expression is
evaluated as a predicate or as an expression: the JSON for filter, when,
validate and split is identical apart from the description text ("The predicate
expression to evaluate..."). The only place the difference exists is the
reifier, which calls createPredicate for filter, when (choice), validate, loop
(doWhile), aggregate (completion predicate), the onWhen, handled, continued and
retryWhile of onException and onCompletion, catch (onWhen), intercept,
interceptFrom and interceptSendToEndpoint (when), and createExpression
everywhere else.
Tooling needs to know: the YAML validator and the write-time Simple check
(CAMEL-24698) validate a simple: value as a predicate or an expression
depending on the EIP, from a hardcoded list; Kaoto, the docs and the sample
tool have the same question.
Mark it in the model, per property, as required is since CAMEL-24707:
* a boolean predicate() on @Metadata (default false), set on the expression
properties the reifier evaluates as predicates (the createPredicate sites above
are the list)
* the package plugin writes "predicate": true into the property in the catalog
models/*.json, next to "kind": "expression"
* the YAML validator, SourceValidator's Simple check and camel_catalog_sample
read it from the catalog instead of a list
* a test that every property annotated predicate = true is one the reifier
evaluates with createPredicate, so the annotation and the runtime cannot drift
apart
Discussed with Claus on 2026-09-13 while reviewing PR 26379.
Summary: camel-core-model - complete the @AsPredicate marking of
expression properties and have tooling read asPredicate from the catalog
instead of hardcoded lists (was: camel-core-model - mark the expression
properties evaluated as predicates (filter, when, validate, ...) with
@Metadata(predicate = true) and in the catalog JSON)
> camel-core-model - complete the @AsPredicate marking of expression properties
> and have tooling read asPredicate from the catalog instead of hardcoded lists
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24714
> URL: https://issues.apache.org/jira/browse/CAMEL-24714
> Project: Camel
> Issue Type: Improvement
> Components: camel-catalog, camel-core
> Reporter: Claus Ibsen
> Priority: Major
>
> Since CAMEL-10698 the model marks the expression properties the reifier
> evaluates as predicates with @AsPredicate (filter, when, onWhen, validate,
> choice/when, aggregate completionPredicate, the
> onWhen/handled/continued/retryWhile of onException and onCompletion, catch,
> intercept, interceptFrom, interceptSendToEndpoint), the package plugin writes
> it as "asPredicate": true next to "kind": "expression" in the catalog
> models/*.json, and JsonMapper reads it back into
> EipOptionModel.isAsPredicate(). Nothing else reads it though: the tooling
> that needs to know whether a simple: value is a predicate or an expression
> keeps its own list.
> What is left:
> * Marking gaps: PredicateValidatorDefinition.expression is reified with
> createPredicate but is not annotated (predicateValidator.json has no
> asPredicate). LoopDefinition.expression is a predicate only when
> doWhile=true; a per-property flag cannot say that, so it stays unmarked and
> the consumers special-case doWhile (say so in the @AsPredicate javadoc).
> * Consumers read the catalog: SimpleChecks.PREDICATE_EIPS in camel-jbang-core
> (the write-time Simple check of SourceValidator, CAMEL-24698) is replaced by
> a lookup of the parent EIP's expression option in the catalog
> (kind=expression and asPredicate); the loopDoWhile/loop-do-while entries are
> dead (the YAML key is loop with doWhile: true) and go. camel_catalog_sample
> the same, if it needs the distinction.
> * A test that the properties with asPredicate=true in the catalog are exactly
> the ones the reifier evaluates with createPredicate, so the annotation and
> the runtime cannot drift apart.
> The JSON key stays asPredicate (published in the catalog since 2017); no new
> @Metadata attribute.
> Discussed with Claus on 2026-09-13 while reviewing PR 26379.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)