[
https://issues.apache.org/jira/browse/CAMEL-24875?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-24875:
--------------------------------
Fix Version/s: 4.23.0
> camel-jbang - camel validate yaml skips a multi-line simple expression
> (expression: | block scalar)
> ---------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24875
> URL: https://issues.apache.org/jira/browse/CAMEL-24875
> Project: Camel
> Issue Type: Bug
> Components: camel-jbang
> Reporter: Claus Ibsen
> Priority: Major
> Fix For: 4.23.0
>
>
> {{SimpleChecks.validateYamlSimple}} (the simple checks of {{camel validate
> yaml}}, also used by the TUI AI answer check and the MCP validator) is line
> based: for {{simple:}} followed by {{expression: |}} or {{expression: >}} the
> value on the line is empty, so the whole expression is skipped without a
> report. Every multi-line simple expression is unchecked, and an init block
> ({{$init{ ... }init$}}) is always multi-line since each statement must end
> with {{;\n}}.
> Verified on 4.23.0-SNAPSHOT: a route with
> {code}
> - setBody:
> expression:
> simple:
> expression: |
> $init{
> $cleanName := ${trim()} -> ${normalizeWhitespace()} |>
> ${uppercase()}
> }init$
> Customer: ${cleanName(${header.customerName})}
> {code}
> validates with success, and fails at runtime with {{expected symbol
> whiteSpace but was character: operators and values must be separated by a
> space at location 43}}. A missing {{}init$}} is not reported either. The
> catalog can judge these once it is handed the whole text, as
> {{AbstractCamelCatalog.doValidateSimple}} delegates to
> {{SimpleLanguage.createExpression}}.
> Proposed: join the indented lines of a block scalar (and a multi-line
> plain/quoted scalar) into the expression text before validating, and report
> the error at the line of {{expression:}}. Found while analysing CAMEL-24874.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)