Claus Ibsen created CAMEL-24720:
-----------------------------------
Summary: camel-jbang - camel_catalog_sample returns samples for
components, data formats and languages from their documentation, once
CAMEL-24710 has their examples validating
Key: CAMEL-24720
URL: https://issues.apache.org/jira/browse/CAMEL-24720
Project: Camel
Issue Type: Improvement
Components: camel-jbang
Reporter: Claus Ibsen
camel_catalog_sample (CAMEL-24693) returns validated YAML samples of an EIP or
file entry (onException, aggregate, rest, beans, ...), read from the catalog's
EIP documentation for the Camel version in use, with the user-manual entries
generated into eip-samples.json by the build (CAMEL-24713). It does not cover
components, data formats or languages: an agent that asks for a sample of
{{kafka}}, {{csv}} or {{jq}} gets "No sample" and suggestions.
CAMEL-24710 is making the YAML route examples of the component, data format and
language pages validate, family by family, guarded by EipDocExamplesTest. Once
a family is guarded, the tool can serve it the same way it serves the EIPs:
* {{CatalogSamples.fromCatalog}} looks up the page by name in the catalog:
{{<name>-component}}, {{<name>-dataformat}}, {{<name>-language}}, plus the
component sub-pages ({{<name>-consumer}}, {{<name>-producer}},
{{<name>-examples}}, ...) as a family of the component. The kind can be given
({{kind=component|dataformat|language|eip}}) or resolved from the catalog when
the name is unambiguous; a name that exists in several kinds returns the choice.
* {{resolve()}}, {{names()}} and {{suggest()}} consult the catalog's component,
data format and language names in addition to the keys of eip-samples.json, so
the name index is not limited to the shipped file.
* The answer keeps the shape of today ({{name}}, {{placement}},
{{samples[{source, yaml}]}}, {{count}}); {{placement}} for a component says
whether it is used in {{from:}} (consumer), {{to:}} (producer) or both; a data
format sample shows the {{marshal}}/{{unmarshal}} step; a language sample shows
the expression in a step.
* The intents map ({{read file}} -> poll, {{call service}} -> enrich) can gain
the component-level ones ({{kafka}} topic, {{http}} call, {{file}} drop), but
the tool description must keep telling the model to ask by name first.
* Only examples that pass {{SourceValidator.validateCamelYaml}} are returned,
as for the EIPs; a family whose page is in the EipDocExamplesTest skip set
(xmlSecurity until CAMEL-24716) is served as far as its valid examples go.
* Tests in CatalogSamplesTest per kind, and the tool description and the MCP
server page (camel-jbang-mcp.adoc, Authoring table) updated.
Not in scope: the shipped eip-samples.json stays the EIP and file-entry
fallback; the component samples come from the catalog in use only (a catalog
for an older Camel version serves that version's examples, which is the point).
Whether the mojo of CAMEL-24713 should also ship a fallback for components is a
separate decision, the file would grow by about 1,400 examples.
Depends on CAMEL-24710. Relates to CAMEL-24693 and CAMEL-24713.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)