davsclaus opened a new pull request, #26562:
URL: https://github.com/apache/camel/pull/26562
Follow-up of CAMEL-24693 (the tool), CAMEL-24713 (the generated
`eip-samples.json`) and CAMEL-24710 (the component, data format and language
examples validate, guarded by `EipDocExamplesTest` and
`CatalogDocExamplesTest`).
`camel_catalog_sample` served the EIPs and the file entries only: an agent
asking for `kafka`, `csv` or `jq` got "No sample" and suggestions. Now a
component, data format or language name answers from the catalog's
documentation of the Camel version in use, the way the EIPs already did.
### What changes
- **Components**: the component page and its sub-pages
(`aws2-s3-consumer-examples`, `salesforce-streaming`, `platform-http-vertx`; a
page of another, longer-named component such as `mina-sftp-*` is not `mina`'s).
The examples that use the component's endpoint (its scheme or an alternative
scheme) come first: the first example of the kafka page is an idempotent
consumer with a SQL repository. A component documented on another page is found
by its artifact (`smtp`, `imap`, `pop3` on the mail page, `https` on the http
page). `placement` says `from:` or `to:`; a consumer-only or producer-only
component says its side.
- **Data formats**: the data format page, or the page of its artifact
(`bindyCsv` on the bindy page), or its variants by major version (`jackson` on
the jackson2 and jackson3 pages). `placement` is the `marshal`/`unmarshal` step.
- **Languages**: the language page; `placement` is the expression of a step.
- **Resolution order** without `kind`: the EIPs and file entries by name,
part or intent; then the catalog's components, data formats and languages by
name; then the aliases of the EIP models. A name in several kinds (`avro`,
`file`) returns the `kinds` to choose from unless only one has samples. The new
optional `kind` argument (`eip`, `component`, `dataformat`, `language`) picks
one. An EIP that is also a component (`log`, `bean`, `rest`) answers as the EIP
and says `also: [component]`.
- The answer keeps its shape (`name`, `placement`, `samples[{source,
yaml}]`, `count`) and adds `kind`. Only examples that pass the YAML schema are
returned, as for the EIPs. A page whose examples never use the component's
endpoint is served with a `note`; a page without a route example answers with a
`hint` to `camel_catalog_doc`.
- Suggestions for an unknown name include the catalog's components, data
formats and languages that have a page (`mqtt` suggests `paho-mqtt5
(component)`).
- The shipped `eip-samples.json` stays the EIP and file-entry fallback; the
component, data format and language samples come from the catalog in use only,
so a catalog of an older Camel version serves that version's examples.
### Two behavior changes
- An exact catalog name beats a fuzzy EIP alias: `chunk` answers with the
Chunk templating component; `kind=eip` gives the split alias as before.
- The `timer` intent (which mapped to the `from` entry) is removed so the
timer component answers; `schedule` and `cron` still map to `from`.
### Not in this PR
- Component-level intents (`kafka topic`, `http call`, `file drop`):
`camel_catalog_find` already turns a product or protocol into a component, and
the tool description keeps telling the model to ask by name first.
- Seven component pages have YAML examples that never use their own endpoint
(aws-secrets-manager, hashicorp-vault, infinispan-embedded, jcache, knative,
mail, mapstruct); they are served as they are, with a note, and listed on the
JIRA to look at afterwards.
### Testing
- `CatalogSamplesTest`: 7 new tests (components with endpoint-first ranking
and sub-pages, consumer/producer side, data formats and languages, a name in
several kinds, components sharing a page and pages without an endpoint example,
data formats under another page name, catalog suggestions); the alias test now
expects the component for `chunk`.
- `AuthoringToolsTest` passes; `camel-jbang-mcp` compiles with the new
`kind` argument.
- The MCP page (`camel-jbang-mcp.adoc`, Authoring table) is updated.
_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]