Claus Ibsen created CAMEL-25870:
-----------------------------------
Summary: camel-yaml-dsl-validator - say where a language goes,
translate a key in the column of a list, - stop, and keep JSON in the constant
hint
Key: CAMEL-25870
URL: https://issues.apache.org/jira/browse/CAMEL-25870
Project: Camel
Issue Type: Improvement
Components: camel-yaml-dsl
Reporter: Claus Ibsen
Fix For: 4.24.0
Four messages of the YAML DSL validator ({{camel validate yaml}}, and the
source checks of the camel-jbang AI tools) did not help a coding agent fix the
route, in a night of runs against a local model. In some runs the agent gave up
on the step.
*1. A language written as a step gets "did you mean 'sample'?"*
{noformat}
- simple: "${body}"
{noformat}
gets "property 'simple' is not defined in the schema ... (did you mean
'sample'?)". The Sample EIP is not what was meant.
Fix: for a language key as a step: "'simple' is a language, not a step: an
expression is written in a step that uses it, such as - setBody: {expression:
{simple: {expression: "${body}"}}} to set the body, or - filter: ...".
*2. A key in the column of the dashes of a list gets the raw parser message*
{noformat}
when:
- simple: "${body} == 'a'"
steps:
{noformat}
gets "while parsing a block collection ... expected <block end>, but found '?'"
('?' is the parser's name for a key). The same happens for onFallback: written
under the - to: of the steps: of a circuitBreaker.
Fix: the message says that the key is in the column of the - of the list item,
so it is part of neither the item nor the key that holds the list, and names
the two columns to choose from: the column of the item's keys (steps: of the
when) and the column of the key that holds the list (onFallback: next to
steps:).
*3. A step written as a plain name gets "string found, object expected"*
{{- stop}} gets only the raw schema message.
Fix: "a step is a key followed by its options: write - stop: {}". For the steps
with a short string form, the property is named ({{- to: {uri: "..."}}}).
*4. The hint for a ${...} in a constant turns JSON into something that is not
JSON*
{noformat}
constant: '{"error": "unknown order ${header.id}"}'
{noformat}
gets "use simple: {expression: "{'error': 'unknown order ${header.id}'}"}". The
hint swaps the double quotes for single quotes so the text fits in a
double-quoted value. The agent copied it, and the route answered a body that is
not JSON.
Fix: the text is quoted as written, in single quotes when it holds a double
quote: "use simple: {expression: '{"error": "unknown order ${header.id}"}'}".
The same for the hint "${...} is simple syntax, not groovy".
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)