davsclaus opened a new pull request, #26762:
URL: https://github.com/apache/camel/pull/26762
Built on #26758 (CAMEL-24917), which it also simplifies.
Nothing in Camel records which endpoint options are evaluated as a Simple
expression for each message. That knowledge lives inside the producers, so
every tool that needs it guesses — the `to:`-vs-`toD:` check in CAMEL-24917
guessed with a hand-written list, and the list was wrong: `camel-micrometer`
and `camel-opentelemetry-metrics` evaluate the metric name *in the path*, so
`to: micrometer:counter:orders.${header.region}` was reported although it is
correct.
**`@Metadata(supportSimpleExpression = true)`** now says it, beside the
tooling flags already there (`supportFileReference`, `largeInput`,
`inputLanguage`), and it reaches the component JSON and the catalog.
**It is derived for free where the type already says it.** An option
declared as `org.apache.camel.Expression` or `org.apache.camel.Predicate` is
evaluated per message by definition, so the generator sets the flag with no
annotation. That matters because the type is otherwise lost: the file
component's `fileName` is an `Expression` field with `@UriParam(javaType =
"java.lang.String")`, so the catalog records it as a plain string.
**15 annotations become 86 options over 12 components:**
| | |
|---|---|
| annotated by hand | micrometer (7), opentelemetry-metrics (7),
`doneFileName` (1) |
| derived from the type | file, ftp, ftps, sftp, mina-sftp, smb,
azure-files, scp — 10 options each |
| found by the derivation | `dynamic-router-control.predicateBean`,
`langchain4j-ingest.documentFilter` |
**The validator now asks the catalog** instead of its list: an expression in
the path is a mistake only when no path option of that component evaluates one.
An unknown component says nothing rather than the wrong thing. What is left of
the list is `language`, whose path is a script in another language — not
something the catalog can speak for.
That also makes the check *more* precise: `xslt:styles/${header.style}.xsl`
and `mybatis:${header.statement}` were excluded by my guesses and are now
correctly reported, since those paths are resource and statement names that no
producer evaluates.
Not finished, and deliberately so — the remaining sweep is in the ticket. A
component can only evaluate an option if it calls the simple language
somewhere, and that grep returns 13 components, of which the language and
dataformat implementations drop out. The human part is about eight producers,
not 300 components.
Tests: `YamlValidatorDynamicUriTest` covers both directions (micrometer
accepted from its metadata, xslt reported), the validator module is 142 green,
`CatalogDocExamplesTest` in camel-jbang-core passes, and the full reactor build
is green.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj
--
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]