Claus Ibsen created CAMEL-24362:
-----------------------------------
Summary: Generate YAML DSL completion tree from canonical schema
and catalog metadata
Key: CAMEL-24362
URL: https://issues.apache.org/jira/browse/CAMEL-24362
Project: Camel
Issue Type: Improvement
Components: camel-yaml-dsl, tooling
Reporter: Claus Ibsen
Currently the TUI source editor tab completion for YAML DSL routes is
hand-coded per context level — each nesting depth (EIP options, expression
languages, language options, data format names, data format options, route
options, top-level elements) has its own context detection method in
SourceViewer and provider method in SourceTab.
This approach works but does not scale: adding a new EIP option kind or a new
nesting level requires manual code changes. It also risks going stale when the
EIP model changes.
h3. Proposal
Generate a completion tree during the build (via {{camel-package-maven-plugin}}
or a new mojo) that maps every valid YAML DSL position to its children, derived
from:
- The canonical YAML DSL JSON schema ({{camelYamlDsl-canonical.json}}) —
defines the structural tree of valid keys at each level
- The EIP/component/language/dataformat catalog metadata — provides
descriptions, types, required flags, default values, enum values, and
deprecated status
The generated artifact (a JSON file or Java class in the catalog) would be a
single tree that the TUI completor walks at runtime instead of querying the
catalog API and doing per-context logic.
h3. Benefits
- Automatically up to date when EIP models, languages, or data formats change
- No manual code changes needed per context level
- Single source of truth for what is valid where in YAML DSL
- Could also be used by other tooling (IDE plugins, MCP server, LSP) for YAML
DSL completion
- Replaces ~500 lines of hand-coded context detection and provider methods
h3. Implementation notes
- Follow the same pattern as the existing catalog and YAML schema generation
(source-generated during build, committed to {{src/generated}})
- The tree should include: valid child keys at each position, their types,
descriptions, required/deprecated flags, default values, enum choices, and
whether they expect a value or nested structure
- The tree root corresponds to the YAML DSL document root (top-level elements
like route, from, rest, beans, etc.)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)