Repository: serverlessworkflow/sdk-java (java)

Issue:
Change getAdditionalProperties by getName and getValue. 
**What would you like to be added**:
Currently, this yaml 

```
 taskList:
    type: array
    items:
      type: object
      title: TaskItem
      minProperties: 1
      maxProperties: 1
      additionalProperties:
        $ref: '#/$defs/task'


```
is translated to

```
@Generated("jsonschema2pojo")
public class TaskItem implements Serializable
{

    @JsonIgnore
    @Valid
    private Map<String, Task> additionalProperties = new LinkedHashMap<String, Task>();
    private final static long serialVersionUID = 2309610577983775837L;

    @JsonAnyGetter
    public Map<String, Task> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(String name, Task value) {
        this.additionalProperties.put(name, value);
    }

    public TaskItem withAdditionalProperty(String name, Task value) {
        this.additionalProperties.put(name, value);
        return this;
    }

}
```
which ideally should be 

```

@Generated("jsonschema2pojo")
public class TaskItem implements Serializable
{

    @JsonIgnore
    @Valid
    private Map<String, Task> additionalProperties = new LinkedHashMap<String, Task>();
    private final static long serialVersionUID = 2309610577983775837L;

    private String name;
    private Task task;
	public Task getTask() {
		return task;
	}
	public void setTask(Task task) {
		this.task = task;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
    
}
```
**Why is this needed**:

To make API more usable

Pull request description:
[Fix #380] Change item API
**Many thanks for submitting your Pull Request :heart:!**

**What this PR does / why we need it**:
Fix #380 

**Special notes for reviewers**:

**Additional information (if needed):**

Patch:
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 8e8e53f..9192a7c 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1,1 +1,1 @@
-* @ricardozanini
+* @tsurdilo @manick02 @ricardozanini
\ No newline at end of file
diff --git a/.github/OWNERS b/.github/OWNERS
index 65579b4..04e2113 100644
--- a/.github/OWNERS
+++ b/.github/OWNERS
@@ -1,7 +1,10 @@
 reviewers:
-  - ricardozanini
+  - tsurdilo
   - manick02
+  - ricardozanini
 approvers:
+  - tsurdilo
+  - manick02
   - ricardozanini
 labels:
-  - sig/contributor-experience
+  - sig/contributor-experience
\ No newline at end of file
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 74cee57..06541a8 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -11,3 +11,4 @@ updates:
       interval: "weekly"
     assignees:
       - ricardozanini
+      - tsurdilo
diff --git a/.muse.toml b/.muse.toml
new file mode 100644
index 0000000..3e1c583
--- /dev/null
+++ b/.muse.toml
@@ -0,0 +1,5 @@
+# Ignore results from target directory
+ignoreFiles = """
+**/target/generated-sources/src/main/java/io/serverlessworkflow/api/states/DefaultState.java
+**/target/generated-sources/src/main/java/io/serverlessworkflow/api/error/Error.java
+"""
\ No newline at end of file
diff --git a/.whitesource b/.whitesource
new file mode 100644
index 0000000..78ad955
--- /dev/null
+++ b/.whitesource
@@ -0,0 +1,13 @@
+{
+  "scanSettings": {
+    "baseBranches": ["main", "4.0.x"]
+  },
+  "checkRunSettings": {
+    "vulnerableCheckRunConclusionLevel": "failure",
+    "displayMode": "diff"
+  },
+  "issueSettings": {
+    "minSeverityLevel": "LOW",
+    "issueType": "DEPENDENCY"
+  }
+}
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
index 0c9d05b..d3d0bfc 100644
--- a/MAINTAINERS.md
+++ b/MAINTAINERS.md
@@ -1,4 +1,4 @@
 # Serverless Workflow Java SDK Maintainers
 
-* [Manick Sundaram](https://github.com/manick02)
-* [Ricardo Zanini](https://github.com/ricardozanini)
+* [Tihomir Surdilovic](https://github.com/tsurdilo)
+* [Manick Sundaram](https://github.com/manick02)
\ No newline at end of file
diff --git a/api/src/main/java/io/serverlessworkflow/api/CallTaskDeserializer.java b/api/src/main/java/io/serverlessworkflow/api/CallTaskDeserializer.java
index fcfec39..097c77b 100644
--- a/api/src/main/java/io/serverlessworkflow/api/CallTaskDeserializer.java
+++ b/api/src/main/java/io/serverlessworkflow/api/CallTaskDeserializer.java
@@ -30,7 +30,7 @@ class CallTaskDeserializer extends JsonDeserializer<CallTask> {
 
   @Override
   public CallTask deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
-    return DeserializeHelper.deserialize(
+    return DeserializeHelper.deserializeOneOf(
         p,
         CallTask.class,
         List.of(CallHTTP.class, CallAsyncAPI.class, CallOpenAPI.class, CallGRPC.class));
diff --git a/api/src/main/java/io/serverlessworkflow/api/CallTaskSerializer.java b/api/src/main/java/io/serverlessworkflow/api/CallTaskSerializer.java
index 18abac3..866875b 100644
--- a/api/src/main/java/io/serverlessworkflow/api/CallTaskSerializer.java
+++ b/api/src/main/java/io/serverlessworkflow/api/CallTaskSerializer.java
@@ -25,6 +25,6 @@ class CallTaskSerializer extends JsonSerializer<CallTask> {
   @Override
   public void serialize(CallTask value, JsonGenerator gen, SerializerProvider serializers)
       throws IOException {
-    SerializeHelper.serialize(gen, value);
+    SerializeHelper.serializeOneOf(gen, value);
   }
 }
diff --git a/api/src/main/java/io/serverlessworkflow/api/DeserializeHelper.java b/api/src/main/java/io/serverlessworkflow/api/DeserializeHelper.java
index ba35b90..b6dd947 100644
--- a/api/src/main/java/io/serverlessworkflow/api/DeserializeHelper.java
+++ b/api/src/main/java/io/serverlessworkflow/api/DeserializeHelper.java
@@ -24,7 +24,7 @@ import java.util.Collection;
 
 public class DeserializeHelper {
 
-  public static <T> T deserialize(
+  public static <T> T deserializeOneOf(
       JsonParser p, Class<T> targetClass, Collection<Class<?>> unionTypes) throws IOException {
     TreeNode node = p.readValueAsTree();
     JsonProcessingException ex = new JsonMappingException("Problem deserializing " + targetClass);
@@ -38,4 +38,17 @@ public class DeserializeHelper {
     }
     throw ex;
   }
+
+  public static <T> T deserializeItem(JsonParser p, Class<T> targetClass, Class<?> valueClass)
+      throws IOException {
+    TreeNode node = p.readValueAsTree();
+    String fieldName = node.fieldNames().next();
+    try {
+      return targetClass
+          .getConstructor(String.class, valueClass)
+          .newInstance(fieldName, p.getCodec().treeToValue(node.get(fieldName), valueClass));
+    } catch (ReflectiveOperationException e) {
+      throw new IOException(e);
+    }
+  }
 }
diff --git a/api/src/main/java/io/serverlessworkflow/api/ObjectMapperFactory.java b/api/src/main/java/io/serverlessworkflow/api/ObjectMapperFactory.java
index d3a9645..f45c763 100644
--- a/api/src/main/java/io/serverlessworkflow/api/ObjectMapperFactory.java
+++ b/api/src/main/java/io/serverlessworkflow/api/ObjectMapperFactory.java
@@ -21,7 +21,9 @@ import com.fasterxml.jackson.databind.module.SimpleModule;
 import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
 import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature;
 import io.serverlessworkflow.api.types.CallTask;
+import io.serverlessworkflow.api.types.SwitchItem;
 import io.serverlessworkflow.api.types.Task;
+import io.serverlessworkflow.api.types.TaskItem;
 
 class ObjectMapperFactory {
 
@@ -44,6 +46,11 @@ class ObjectMapperFactory {
     simpleModule.addSerializer(Task.class, new TaskSerializer());
     simpleModule.addDeserializer(CallTask.class, new CallTaskDeserializer());
     simpleModule.addSerializer(CallTask.class, new CallTaskSerializer());
+    simpleModule.addDeserializer(TaskItem.class, new TaskItemDeserializer());
+    simpleModule.addSerializer(TaskItem.class, new TaskItemSerializer());
+    simpleModule.addSerializer(SwitchItem.class, new SwitchItemSerializer());
+    simpleModule.addDeserializer(SwitchItem.class, new SwitchItemDeserializer());
+
     return mapper
         .configure(SerializationFeature.INDENT_OUTPUT, true)
         .configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false)
diff --git a/api/src/main/java/io/serverlessworkflow/api/SerializeHelper.java b/api/src/main/java/io/serverlessworkflow/api/SerializeHelper.java
index e08de15..8585763 100644
--- a/api/src/main/java/io/serverlessworkflow/api/SerializeHelper.java
+++ b/api/src/main/java/io/serverlessworkflow/api/SerializeHelper.java
@@ -20,7 +20,7 @@ import java.io.IOException;
 import java.lang.reflect.Method;
 
 public class SerializeHelper {
-  public static void serialize(JsonGenerator jgen, Object item) throws IOException {
+  public static void serializeOneOf(JsonGenerator jgen, Object item) throws IOException {
     try {
       for (Method m : item.getClass().getDeclaredMethods()) {
         Object value = m.invoke(item);
diff --git a/api/src/main/java/io/serverlessworkflow/api/SwitchItemDeserializer.java b/api/src/main/java/io/serverlessworkflow/api/SwitchItemDeserializer.java
new file mode 100644
index 0000000..02d9358
--- /dev/null
+++ b/api/src/main/java/io/serverlessworkflow/api/SwitchItemDeserializer.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2020-Present The Serverless Workflow Specification Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.serverlessworkflow.api;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import io.serverlessworkflow.api.types.SwitchCase;
+import io.serverlessworkflow.api.types.SwitchItem;
+import java.io.IOException;
+
+class SwitchItemDeserializer extends JsonDeserializer<SwitchItem> {
+
+  @Override
+  public SwitchItem deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
+    return DeserializeHelper.deserializeItem(p, SwitchItem.class, SwitchCase.class);
+  }
+}
diff --git a/api/src/main/java/io/serverlessworkflow/api/SwitchItemSerializer.java b/api/src/main/java/io/serverlessworkflow/api/SwitchItemSerializer.java
new file mode 100644
index 0000000..f76582c
--- /dev/null
+++ b/api/src/main/java/io/serverlessworkflow/api/SwitchItemSerializer.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2020-Present The Serverless Workflow Specification Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.serverlessworkflow.api;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import io.serverlessworkflow.api.types.SwitchItem;
+import java.io.IOException;
+
+class SwitchItemSerializer extends JsonSerializer<SwitchItem> {
+
+  @Override
+  public void serialize(SwitchItem value, JsonGenerator gen, SerializerProvider serializers)
+      throws IOException {
+    gen.writeStartObject();
+    gen.writeObjectField(value.getName(), value.getSwitchCase());
+    gen.writeEndObject();
+  }
+}
diff --git a/api/src/main/java/io/serverlessworkflow/api/TaskDeserializer.java b/api/src/main/java/io/serverlessworkflow/api/TaskDeserializer.java
index d81091c..45892cb 100644
--- a/api/src/main/java/io/serverlessworkflow/api/TaskDeserializer.java
+++ b/api/src/main/java/io/serverlessworkflow/api/TaskDeserializer.java
@@ -38,7 +38,7 @@ class TaskDeserializer extends JsonDeserializer<Task> {
 
   @Override
   public Task deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
-    return DeserializeHelper.deserialize(
+    return DeserializeHelper.deserializeOneOf(
         p,
         Task.class,
         List.of(
diff --git a/api/src/main/java/io/serverlessworkflow/api/TaskItemDeserializer.java b/api/src/main/java/io/serverlessworkflow/api/TaskItemDeserializer.java
new file mode 100644
index 0000000..00c6d35
--- /dev/null
+++ b/api/src/main/java/io/serverlessworkflow/api/TaskItemDeserializer.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2020-Present The Serverless Workflow Specification Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.serverlessworkflow.api;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import io.serverlessworkflow.api.types.Task;
+import io.serverlessworkflow.api.types.TaskItem;
+import java.io.IOException;
+
+class TaskItemDeserializer extends JsonDeserializer<TaskItem> {
+
+  @Override
+  public TaskItem deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
+    return DeserializeHelper.deserializeItem(p, TaskItem.class, Task.class);
+  }
+}
diff --git a/api/src/main/java/io/serverlessworkflow/api/TaskItemSerializer.java b/api/src/main/java/io/serverlessworkflow/api/TaskItemSerializer.java
new file mode 100644
index 0000000..53e8a26
--- /dev/null
+++ b/api/src/main/java/io/serverlessworkflow/api/TaskItemSerializer.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2020-Present The Serverless Workflow Specification Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.serverlessworkflow.api;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import io.serverlessworkflow.api.types.TaskItem;
+import java.io.IOException;
+
+class TaskItemSerializer extends JsonSerializer<TaskItem> {
+
+  @Override
+  public void serialize(TaskItem value, JsonGenerator gen, SerializerProvider serializers)
+      throws IOException {
+    gen.writeStartObject();
+    gen.writeObjectField(value.getName(), value.getTask());
+    gen.writeEndObject();
+  }
+}
diff --git a/api/src/main/java/io/serverlessworkflow/api/TaskSerializer.java b/api/src/main/java/io/serverlessworkflow/api/TaskSerializer.java
index 3900f16..1f9d65f 100644
--- a/api/src/main/java/io/serverlessworkflow/api/TaskSerializer.java
+++ b/api/src/main/java/io/serverlessworkflow/api/TaskSerializer.java
@@ -26,6 +26,6 @@ class TaskSerializer extends JsonSerializer<Task> {
   @Override
   public void serialize(Task value, JsonGenerator gen, SerializerProvider serializers)
       throws IOException {
-    SerializeHelper.serialize(gen, value);
+    SerializeHelper.serializeOneOf(gen, value);
   }
 }
diff --git a/api/src/main/resources/schema/workflow.yaml b/api/src/main/resources/schema/workflow.yaml
index d3a20f2..1c6d1bc 100644
--- a/api/src/main/resources/schema/workflow.yaml
+++ b/api/src/main/resources/schema/workflow.yaml
@@ -571,8 +571,10 @@ $defs:
           type: object
           minProperties: 1
           maxProperties: 1
+          title: SwitchItem
           additionalProperties:
             type: object
+            title: SwitchCase
             properties:
               name:
                 type: string
diff --git a/custom-generator/src/main/java/io/serverlessworkflow/generator/AllAnyOneOfSchemaRule.java b/custom-generator/src/main/java/io/serverlessworkflow/generator/AllAnyOneOfSchemaRule.java
index e16e07b..d4bcac8 100644
--- a/custom-generator/src/main/java/io/serverlessworkflow/generator/AllAnyOneOfSchemaRule.java
+++ b/custom-generator/src/main/java/io/serverlessworkflow/generator/AllAnyOneOfSchemaRule.java
@@ -15,8 +15,6 @@
  */
 package io.serverlessworkflow.generator;
 
-import static org.apache.commons.lang3.StringUtils.*;
-
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.sun.codemodel.JClass;
@@ -127,16 +125,8 @@ class AllAnyOneOfSchemaRule extends SchemaRule {
 
   private void wrapIt(JDefinedClass definedClass, JType unionType) {
     JFieldVar instanceField =
-        definedClass.field(
-            JMod.PRIVATE,
-            unionType,
-            ruleFactory.getNameHelper().getPropertyName(unionType.name(), null));
-    JMethod method =
-        definedClass.method(
-            JMod.PUBLIC,
-            unionType,
-            ruleFactory.getNameHelper().getGetterName(unionType.name(), unionType, null));
-    method.body()._return(instanceField);
+        GeneratorUtils.addGetter(
+            definedClass, unionType, ruleFactory.getNameHelper(), unionType.name());
     JMethod constructor = definedClass.constructor(JMod.PUBLIC);
     constructor
         .body()
diff --git a/custom-generator/src/main/java/io/serverlessworkflow/generator/GeneratorUtils.java b/custom-generator/src/main/java/io/serverlessworkflow/generator/GeneratorUtils.java
new file mode 100644
index 0000000..d673615
--- /dev/null
+++ b/custom-generator/src/main/java/io/serverlessworkflow/generator/GeneratorUtils.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2020-Present The Serverless Workflow Specification Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.serverlessworkflow.generator;
+
+import com.sun.codemodel.JDefinedClass;
+import com.sun.codemodel.JFieldVar;
+import com.sun.codemodel.JMethod;
+import com.sun.codemodel.JMod;
+import com.sun.codemodel.JType;
+import org.jsonschema2pojo.util.NameHelper;
+
+public class GeneratorUtils {
+
+  public static JFieldVar addGetter(
+      JDefinedClass definedClass, JType type, NameHelper nameHelper, String name) {
+    JFieldVar instanceField =
+        definedClass.field(JMod.PRIVATE, type, nameHelper.getPropertyName(name, null));
+    JMethod method =
+        definedClass.method(JMod.PUBLIC, type, nameHelper.getGetterName(name, type, null));
+    method.body()._return(instanceField);
+    return instanceField;
+  }
+
+  private GeneratorUtils() {}
+}
diff --git a/custom-generator/src/main/java/io/serverlessworkflow/generator/UnevaluatedPropertiesRule.java b/custom-generator/src/main/java/io/serverlessworkflow/generator/UnevaluatedPropertiesRule.java
index b523967..e94d6a2 100644
--- a/custom-generator/src/main/java/io/serverlessworkflow/generator/UnevaluatedPropertiesRule.java
+++ b/custom-generator/src/main/java/io/serverlessworkflow/generator/UnevaluatedPropertiesRule.java
@@ -17,15 +17,25 @@ package io.serverlessworkflow.generator;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.sun.codemodel.JDefinedClass;
+import com.sun.codemodel.JExpr;
+import com.sun.codemodel.JFieldVar;
+import com.sun.codemodel.JMethod;
+import com.sun.codemodel.JMod;
+import com.sun.codemodel.JType;
 import org.jsonschema2pojo.Schema;
 import org.jsonschema2pojo.rules.AdditionalPropertiesRule;
 import org.jsonschema2pojo.rules.Rule;
+import org.jsonschema2pojo.rules.RuleFactory;
+import org.jsonschema2pojo.util.NameHelper;
 
 public class UnevaluatedPropertiesRule extends AdditionalPropertiesRule
     implements Rule<JDefinedClass, JDefinedClass> {
 
-  public UnevaluatedPropertiesRule(UnreferencedFactory unreferencedFactory) {
-    super(unreferencedFactory);
+  private RuleFactory ruleFactory;
+
+  public UnevaluatedPropertiesRule(RuleFactory ruleFactory) {
+    super(ruleFactory);
+    this.ruleFactory = ruleFactory;
   }
 
   public JDefinedClass apply(
@@ -35,8 +45,54 @@ public class UnevaluatedPropertiesRule extends AdditionalPropertiesRule
         || (node == null && parent.has("properties"))) {
       // no additional properties allowed
       return jclass;
+    } else if (node != null
+        && checkIntValue(parent, "maxProperties", 1)
+        && checkIntValue(parent, "minProperties", 1)) {
+      return addKeyValueFields(jclass, node, parent, nodeName, schema);
     } else {
       return super.apply(nodeName, node, parent, jclass, schema);
     }
   }
+
+  private JDefinedClass addKeyValueFields(
+      JDefinedClass jclass, JsonNode node, JsonNode parent, String nodeName, Schema schema) {
+    NameHelper nameHelper = ruleFactory.getNameHelper();
+    JType stringClass = jclass.owner()._ref(String.class);
+    JFieldVar nameField = GeneratorUtils.addGetter(jclass, stringClass, nameHelper, "name");
+    JType propertyType;
+    if (node != null && node.size() != 0) {
+      String pathToAdditionalProperties;
+      if (schema.getId().getFragment() == null) {
+        pathToAdditionalProperties = "#/additionalProperties";
+      } else {
+        pathToAdditionalProperties = "#" + schema.getId().getFragment() + "/additionalProperties";
+      }
+      Schema additionalPropertiesSchema =
+          ruleFactory
+              .getSchemaStore()
+              .create(
+                  schema,
+                  pathToAdditionalProperties,
+                  ruleFactory.getGenerationConfig().getRefFragmentPathDelimiters());
+      propertyType =
+          ruleFactory
+              .getSchemaRule()
+              .apply(nodeName + "Property", node, parent, jclass, additionalPropertiesSchema);
+      additionalPropertiesSchema.setJavaTypeIfEmpty(propertyType);
+    } else {
+      propertyType = jclass.owner().ref(Object.class);
+    }
+    JFieldVar valueField =
+        GeneratorUtils.addGetter(jclass, propertyType, nameHelper, propertyType.name());
+    JMethod constructor = jclass.constructor(JMod.PUBLIC);
+    constructor
+        .body()
+        .assign(JExpr._this().ref(nameField), constructor.param(stringClass, nameField.name()))
+        .assign(JExpr._this().ref(valueField), constructor.param(propertyType, valueField.name()));
+    return jclass;
+  }
+
+  private boolean checkIntValue(JsonNode node, String propName, int value) {
+    return node.has(propName) && node.get(propName).asInt() == value;
+  }
 }


Test patch:
diff --git a/api/src/test/java/io/serverlessworkflow/api/ApiTest.java b/api/src/test/java/io/serverlessworkflow/api/ApiTest.java
index 8792449..8e4c27b 100644
--- a/api/src/test/java/io/serverlessworkflow/api/ApiTest.java
+++ b/api/src/test/java/io/serverlessworkflow/api/ApiTest.java
@@ -31,9 +31,9 @@ public class ApiTest {
   void testCallHTTPAPI() throws IOException {
     Workflow workflow = readWorkflowFromClasspath("features/callHttp.yaml");
     assertThat(workflow.getDo()).isNotEmpty();
-    assertThat(workflow.getDo().get(0).getAdditionalProperties()).isNotEmpty();
-    assertThat(workflow.getDo().get(0).getAdditionalProperties().values()).isNotEmpty();
-    Task task = workflow.getDo().get(0).getAdditionalProperties().values().iterator().next();
+    assertThat(workflow.getDo().get(0).getName()).isNotNull();
+    assertThat(workflow.getDo().get(0).getTask()).isNotNull();
+    Task task = workflow.getDo().get(0).getTask();
     CallTask callTask = task.getCallTask();
     assertThat(callTask).isNotNull();
     assertThat(task.getDoTask()).isNull();