Skip to content

Commit

Permalink
Fix findings
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Jun 20, 2019
1 parent 2199554 commit b478188
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions camel-k-runtime-yaml/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -89,15 +89,15 @@ 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
----
set-body:
data-format:
json:
library: Jackson
library: Gson
----
+
To make the DSL less verbose, the `data-format` field can be omitted:
Expand All @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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<Type extends ProcessorDefinition<Type>>
extends OptionalIdentifiedDefinition<Type>
implements Block, OtherAttributesAware {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public ProcessorDefinition<?> toProcessor(Context context) {
StepParserSupport.convertSteps(
context,
choice.otherwise(),
definition.otherwise.steps)
;
definition.otherwise.steps);
}

return choice;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ default void handleUnknownField(String id, JsonNode node) {
Class<? extends DataFormatDefinition> 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) {
Expand Down

0 comments on commit b478188

Please sign in to comment.