diff --git a/api/src/main/java/io/serverlessworkflow/api/ObjectMapperFactory.java b/api/src/main/java/io/serverlessworkflow/api/ObjectMapperFactory.java index a245a07f..f45c7632 100644 --- a/api/src/main/java/io/serverlessworkflow/api/ObjectMapperFactory.java +++ b/api/src/main/java/io/serverlessworkflow/api/ObjectMapperFactory.java @@ -21,7 +21,7 @@ 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.Switch; +import io.serverlessworkflow.api.types.SwitchItem; import io.serverlessworkflow.api.types.Task; import io.serverlessworkflow.api.types.TaskItem; @@ -48,8 +48,8 @@ private static ObjectMapper configure(ObjectMapper mapper) { simpleModule.addSerializer(CallTask.class, new CallTaskSerializer()); simpleModule.addDeserializer(TaskItem.class, new TaskItemDeserializer()); simpleModule.addSerializer(TaskItem.class, new TaskItemSerializer()); - simpleModule.addSerializer(Switch.class, new SwitchSerializer()); - simpleModule.addDeserializer(Switch.class, new SwitchDeserializer()); + simpleModule.addSerializer(SwitchItem.class, new SwitchItemSerializer()); + simpleModule.addDeserializer(SwitchItem.class, new SwitchItemDeserializer()); return mapper .configure(SerializationFeature.INDENT_OUTPUT, true) diff --git a/api/src/main/java/io/serverlessworkflow/api/SwitchDeserializer.java b/api/src/main/java/io/serverlessworkflow/api/SwitchItemDeserializer.java similarity index 75% rename from api/src/main/java/io/serverlessworkflow/api/SwitchDeserializer.java rename to api/src/main/java/io/serverlessworkflow/api/SwitchItemDeserializer.java index 21ede4a3..5469eba9 100644 --- a/api/src/main/java/io/serverlessworkflow/api/SwitchDeserializer.java +++ b/api/src/main/java/io/serverlessworkflow/api/SwitchItemDeserializer.java @@ -19,13 +19,13 @@ import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import io.serverlessworkflow.api.types.Switch; -import io.serverlessworkflow.api.types.SwitchProperty; +import io.serverlessworkflow.api.types.SwitchItem; import java.io.IOException; -class SwitchDeserializer extends JsonDeserializer { +class SwitchItemDeserializer extends JsonDeserializer { @Override - public Switch deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { - return DeserializeHelper.deserializeItem(p, Switch.class, SwitchProperty.class); + public SwitchItem deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + return DeserializeHelper.deserializeItem(p, SwitchItem.class, Switch.class); } } diff --git a/api/src/main/java/io/serverlessworkflow/api/SwitchSerializer.java b/api/src/main/java/io/serverlessworkflow/api/SwitchItemSerializer.java similarity index 78% rename from api/src/main/java/io/serverlessworkflow/api/SwitchSerializer.java rename to api/src/main/java/io/serverlessworkflow/api/SwitchItemSerializer.java index ed64fcb9..f93b5524 100644 --- a/api/src/main/java/io/serverlessworkflow/api/SwitchSerializer.java +++ b/api/src/main/java/io/serverlessworkflow/api/SwitchItemSerializer.java @@ -18,16 +18,16 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; -import io.serverlessworkflow.api.types.Switch; +import io.serverlessworkflow.api.types.SwitchItem; import java.io.IOException; -class SwitchSerializer extends JsonSerializer { +class SwitchItemSerializer extends JsonSerializer { @Override - public void serialize(Switch value, JsonGenerator gen, SerializerProvider serializers) + public void serialize(SwitchItem value, JsonGenerator gen, SerializerProvider serializers) throws IOException { gen.writeStartObject(); - gen.writeObjectField(value.getName(), value.getSwitchProperty()); + gen.writeObjectField(value.getName(), value.getSwitch()); gen.writeEndObject(); } } diff --git a/api/src/main/resources/schema/workflow.yaml b/api/src/main/resources/schema/workflow.yaml index d3a20f2f..dd6fabdb 100644 --- a/api/src/main/resources/schema/workflow.yaml +++ b/api/src/main/resources/schema/workflow.yaml @@ -569,10 +569,12 @@ $defs: minItems: 1 items: type: object + title: SwitchItem minProperties: 1 maxProperties: 1 additionalProperties: type: object + title: Switch properties: name: type: string