[
https://issues.apache.org/jira/browse/CAMEL-19698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tomohisa Igarashi reassigned CAMEL-19698:
-----------------------------------------
Assignee: Tomohisa Igarashi (was: Luca Burgazzoli)
> camel-yaml-dsl: Express "simple" and "expression.simple" are mutually
> exclusive if possible
> --------------------------------------------------------------------------------------------
>
> Key: CAMEL-19698
> URL: https://issues.apache.org/jira/browse/CAMEL-19698
> Project: Camel
> Issue Type: Task
> Components: camel-yaml-dsl
> Reporter: Tomohisa Igarashi
> Assignee: Tomohisa Igarashi
> Priority: Major
>
> For example currently YAML DSL allows specifying both "simple" and
> "expression" under "when"
> {code:yaml}
> - from:
> uri: "timer:test"
> parameters:
> period: 3000
> steps:
> - when:
> simple: "${header.baz} != null"
> expression:
> simple: "${header.baz} == null"
> steps:
> - log: "test"
> {code}
> But at runtime only latter wins in this case. It would be nice if this
> exclusiveness could be expressed in the schema.
> Similarly, this "anyOf" seems to allow specifying multiple expressions
> https://github.com/apache/camel/blob/36bcd6277854b8e69ca91a8d51845a306b1c2136/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camel-yaml-dsl.json#L3567-L3569
> for example
> {code:yaml}
> - from:
> uri: "timer:test"
> parameters:
> period: 3000
> steps:
> - when:
> simple: ${header.baz} != null
> jq: ".foo"
> steps:
> - log: "test"
> {code}
> Although this ends up with a runtime error
> {noformat}
> 2023-08-02 14:27:29.445 INFO 1579388 --- [ main]
> org.apache.camel.main.MainSupport : Using Java 20.0.1 with PID 1579388.
> Started by tomo in /home/tomo/workspace/Kaoto/datamapper-research/examples
> Field: jq has already been configured as an expression
> in file:test.yaml, line 8, column 13:
> jq: ".foo"
> ^
> at
> org.apache.camel.dsl.yaml.deserializers.ModelDeserializers$WhenDefinitionDeserializer.setProperty(ModelDeserializers.java:18445)
> at
> org.apache.camel.dsl.yaml.deserializers.ModelDeserializers$WhenDefinitionDeserializer.setProperty(ModelDeserializers.java:18385)
> at
> org.apache.camel.dsl.yaml.common.YamlDeserializerBase.setProperties(YamlDeserializerBase.java:125)
> at
> org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:65)
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)