This is an automated email from the ASF dual-hosted git repository. coheigea pushed a commit to branch camel-2.25.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 75f11428cbf189c71b4a42a0d535b79d8a700522 Author: Colm O hEigeartaigh <cohei...@apache.org> AuthorDate: Tue Feb 18 12:48:37 2020 +0000 CAMEL-14532 - Fixing up docs --- .../camel/model/dataformat/YAMLDataFormat.java | 30 +++++++++++++++++++++- .../src/main/docs/yaml-snakeyaml-dataformat.adoc | 4 ++- .../SnakeYAMLDataFormatConfiguration.java | 26 ++++++++++++++++++- 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/YAMLDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/YAMLDataFormat.java index a1c26708..28b7fae 100644 --- a/camel-core/src/main/java/org/apache/camel/model/dataformat/YAMLDataFormat.java +++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/YAMLDataFormat.java @@ -36,7 +36,7 @@ import org.apache.camel.util.ObjectHelper; /** * YAML is a data format to marshal and unmarshal Java objects to and from YAML. * - * @version + * @version */ @Metadata(firstVersion = "2.17.0", label = "dataformat,transformation,yaml", title = "YAML") @XmlRootElement(name = "yaml") @@ -66,6 +66,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); @@ -211,6 +217,28 @@ public class YAMLDataFormat extends DataFormatDefinition { return 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; + } + /** * Set the types SnakeYAML is allowed to un-marshall */ 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 915d2fe..6d5bc43 100644 --- a/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc +++ b/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc @@ -19,7 +19,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. @@ -36,6 +36,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/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 d797564..01e248a 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 @@ -82,6 +82,14 @@ public class SnakeYAMLDataFormatConfiguration */ private List<YAMLTypeFilterDefinition> typeFilter; /** + * 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 @@ -170,6 +178,22 @@ public class SnakeYAMLDataFormatConfiguration this.typeFilter = typeFilter; } + 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; } @@ -177,4 +201,4 @@ public class SnakeYAMLDataFormatConfiguration public void setContentTypeHeader(Boolean contentTypeHeader) { this.contentTypeHeader = contentTypeHeader; } -} \ No newline at end of file +}