You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2023/03/13 12:11:54 UTC

[camel] 01/02: CAMEL-18829: camel-yaml-dsl - generate-yaml-schema - Support `additionalProperties: false` (#8928)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch camel-3.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit e3b9272f37a2073f53fdd5b4d8541ac9cb9bbc67
Author: Tomohisa Igarashi <tm...@gmail.com>
AuthorDate: Tue Dec 20 00:37:05 2022 -0500

    CAMEL-18829: camel-yaml-dsl - generate-yaml-schema - Support `additionalProperties: false` (#8928)
---
 .../org/apache/camel/maven/dsl/yaml/GenerateYamlSchemaMojo.java   | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-maven-plugin/src/main/java/org/apache/camel/maven/dsl/yaml/GenerateYamlSchemaMojo.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-maven-plugin/src/main/java/org/apache/camel/maven/dsl/yaml/GenerateYamlSchemaMojo.java
index 19a337ed8b5..90c83af43bc 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-maven-plugin/src/main/java/org/apache/camel/maven/dsl/yaml/GenerateYamlSchemaMojo.java
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-maven-plugin/src/main/java/org/apache/camel/maven/dsl/yaml/GenerateYamlSchemaMojo.java
@@ -61,6 +61,8 @@ public class GenerateYamlSchemaMojo extends GenerateYamlSupportMojo {
     private File outputFile;
     @Parameter(defaultValue = "true")
     private boolean kebabCase = true;
+    @Parameter(defaultValue = "true")
+    private boolean additionalProperties = true;
 
     private ObjectNode items;
     private ObjectNode definitions;
@@ -81,6 +83,9 @@ public class GenerateYamlSchemaMojo extends GenerateYamlSupportMojo {
         step = definitions.with("org.apache.camel.model.ProcessorDefinition")
                 .put("type", "object")
                 .put("maxProperties", 1);
+        if (!additionalProperties) {
+            step.put("additionalProperties", false);
+        }
 
         Map<String, ClassInfo> types = new TreeMap<>();
 
@@ -160,6 +165,9 @@ public class GenerateYamlSchemaMojo extends GenerateYamlSupportMojo {
         }
 
         objectDefinition.put("type", "object");
+        if (!additionalProperties) {
+            objectDefinition.put("additionalProperties", false);
+        }
 
         collectYamlProperties(properties, info);