diff --git a/camel-k-runtime-yaml/README.adoc b/camel-k-runtime-yaml/README.adoc index 0587618b8..e78bb32f4 100644 --- a/camel-k-runtime-yaml/README.adoc +++ b/camel-k-runtime-yaml/README.adoc @@ -76,7 +76,7 @@ filter: simple: "${in.header.continue} == true" ---- + -In general expression can be defined inline like in the examples above but in case you need provide more information, you can 'unroll' the expression definition and configure any single parameter the expression defines. +In general expression can be defined inline like in the examples above but in case you need provide more information, you can 'unroll' the expression definition and configure any single parameter the expression defines. + [source, yaml] .Full Expression definition @@ -89,7 +89,7 @@ filter: - *Data Format Aware Steps* + -Some EIP such as `set-body` and `marshal` supports the definition of a data formats through the `data-format` field: +Some EIP such as `set-body` and `marshal` supports the definition of data formats through the `data-format` field: + [source, yaml] .Explicit Data Format field @@ -97,7 +97,7 @@ Some EIP such as `set-body` and `marshal` supports the definition of a data form set-body: data-format: json: - library: Jackson + library: Gson ---- + To make the DSL less verbose, the `data-format` field can be omitted: @@ -107,7 +107,7 @@ To make the DSL less verbose, the `data-format` field can be omitted: ---- set-body: json: - library: Jackson + library: Gson ---- + [NOTE] diff --git a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/Yaml.java b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/Yaml.java index 71da7ec14..75dcd5930 100644 --- a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/Yaml.java +++ b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/Yaml.java @@ -38,7 +38,7 @@ import org.apache.camel.model.ProcessorDefinition; public final class Yaml { - public final static ObjectMapper MAPPER = mapper(); + public static final ObjectMapper MAPPER = mapper(); public static ObjectMapper mapper() { YAMLFactory yamlFactory = new YAMLFactory() @@ -68,6 +68,11 @@ public static JsonNode node(String name, JsonNode value) { return Yaml.MAPPER.createObjectNode().set(name, value); } + /** + * ProcessorDefinition declares multiple methods for setBody and Jackson get confused + * about what method to use so to hide such fields from the deserialization process + * without having to change the original class, a MixIn is required. + */ public abstract class ProcessorDefinitionMixIn> extends OptionalIdentifiedDefinition implements Block, OtherAttributesAware { diff --git a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/converter/ChoiceConverter.java b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/converter/ChoiceConverter.java index 100bfa6a7..a1865f3c7 100644 --- a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/converter/ChoiceConverter.java +++ b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/converter/ChoiceConverter.java @@ -48,8 +48,7 @@ public ProcessorDefinition toProcessor(Context context) { ConverterSupport.convertSteps( context, choice.otherwise(), - definition.otherwise.steps) - ; + definition.otherwise.steps); } return choice; diff --git a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/converter/HasDataFormat.java b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/converter/HasDataFormat.java index 3afaea5cb..ee2d846f7 100644 --- a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/converter/HasDataFormat.java +++ b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/converter/HasDataFormat.java @@ -38,7 +38,7 @@ default void handleUnknownField(String id, JsonNode node) { Class type = Definitions.DATA_FORMATS_MAP.get(id); if (type == null) { - throw new IllegalArgumentException("unknown data format type: " + type); + throw new IllegalArgumentException("unknown data format type: " + id); } if (getDataFormatType() != null) {