This is an automated email from the ASF dual-hosted git repository. coheigea pushed a commit to branch camel-3.0.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1a64407d1b47a8865101060e8ed72d0b495f9323 Author: Colm O hEigeartaigh <cohei...@apache.org> AuthorDate: Tue Feb 18 12:48:37 2020 +0000 CAMEL-14532 - Fixing up docs --- .../src/main/docs/yaml-snakeyaml-dataformat.adoc | 4 +++- .../camel/model/dataformat/YAMLDataFormat.java | 27 ++++++++++++++++++++++ .../reifier/dataformat/YAMLDataFormatReifier.java | 2 ++ .../SnakeYAMLDataFormatConfiguration.java | 24 +++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc b/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc index bfe9a15..ffa0c29 100644 --- a/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc +++ b/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc @@ -18,7 +18,7 @@ SnakeYAML library. == YAML Options // dataformat options: START -The YAML SnakeYAML dataformat supports 11 options, which are listed below. +The YAML SnakeYAML dataformat supports 13 options, which are listed below. @@ -35,6 +35,8 @@ The YAML SnakeYAML dataformat supports 11 options, which are listed below. | prettyFlow | false | Boolean | Force the emitter to produce a pretty YAML document when using the flow style. | allowAnyType | false | Boolean | Allow any class to be un-marshaled | typeFilter | | List | Set the types SnakeYAML is allowed to un-marshall +| maxAliasesForCollections | 50 | int | Set the maximum amount of aliases allowed for collections. +| allowRecursiveKeys | false | boolean | Set whether recursive keys are allowed. | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. |=== // dataformat options: END diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/YAMLDataFormat.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/YAMLDataFormat.java index d1b9192..951b1a6 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/YAMLDataFormat.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/YAMLDataFormat.java @@ -63,6 +63,12 @@ public class YAMLDataFormat extends DataFormatDefinition { private Boolean allowAnyType = false; @XmlElement(name = "typeFilter") private List<YAMLTypeFilterDefinition> typeFilters; + @XmlAttribute + @Metadata(javaType = "java.lang.Integer", defaultValue = "50") + private int maxAliasesForCollections = 50; + @XmlAttribute + @Metadata(javaType = "java.lang.Boolean", defaultValue = "false") + private boolean allowRecursiveKeys; public YAMLDataFormat() { this(YAMLLibrary.SnakeYAML); @@ -215,4 +221,25 @@ public class YAMLDataFormat extends DataFormatDefinition { this.typeFilters = typeFilters; } + public int getMaxAliasesForCollections() { + return maxAliasesForCollections; + } + + /** + * Set the maximum amount of aliases allowed for collections. + */ + public void setMaxAliasesForCollections(int maxAliasesForCollections) { + this.maxAliasesForCollections = maxAliasesForCollections; + } + + public boolean isAllowRecursiveKeys() { + return allowRecursiveKeys; + } + + /** + * Set whether recursive keys are allowed. + */ + public void setAllowRecursiveKeys(boolean allowRecursiveKeys) { + this.allowRecursiveKeys = allowRecursiveKeys; + } } diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/YAMLDataFormatReifier.java b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/YAMLDataFormatReifier.java index 60089e4..033134a 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/YAMLDataFormatReifier.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/YAMLDataFormatReifier.java @@ -66,6 +66,8 @@ public class YAMLDataFormatReifier extends DataFormatReifier<YAMLDataFormat> { setProperty(dataFormat, camelContext, "useApplicationContextClassLoader", definition.isUseApplicationContextClassLoader()); setProperty(dataFormat, camelContext, "prettyFlow", definition.isPrettyFlow()); setProperty(dataFormat, camelContext, "allowAnyType", definition.isAllowAnyType()); + setProperty(dataFormat, camelContext, "maxAliasesForCollections", definition.getMaxAliasesForCollections()); + setProperty(dataFormat, camelContext, "allowRecursiveKeys", definition.isAllowRecursiveKeys()); if (definition.getTypeFilters() != null && !definition.getTypeFilters().isEmpty()) { List<String> typeFilterDefinitions = new ArrayList<>(definition.getTypeFilters().size()); diff --git a/platforms/spring-boot/components-starter/camel-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatConfiguration.java index b5e946d..f5987c9 100644 --- a/platforms/spring-boot/components-starter/camel-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatConfiguration.java @@ -70,6 +70,14 @@ public class SnakeYAMLDataFormatConfiguration */ private Boolean allowAnyType = false; /** + * Set the maximum amount of aliases allowed for collections. + */ + private Integer maxAliasesForCollections = 50; + /** + * Set whether recursive keys are allowed. + */ + private Boolean allowRecursiveKeys = false; + /** * Whether the data format should set the Content-Type header with the type * from the data format if the data format is capable of doing so. For * example application/xml for data formats marshalling to XML, or @@ -142,6 +150,22 @@ public class SnakeYAMLDataFormatConfiguration this.allowAnyType = allowAnyType; } + public Integer getMaxAliasesForCollections() { + return maxAliasesForCollections; + } + + public void setMaxAliasesForCollections(Integer maxAliasesForCollections) { + this.maxAliasesForCollections = maxAliasesForCollections; + } + + public Boolean getAllowRecursiveKeys() { + return allowRecursiveKeys; + } + + public void setAllowRecursiveKeys(Boolean allowRecursiveKeys) { + this.allowRecursiveKeys = allowRecursiveKeys; + } + public Boolean getContentTypeHeader() { return contentTypeHeader; }