Skip to content

[Fix #379] Generating serializers/deserializers #390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
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 {

Expand All @@ -41,21 +36,10 @@ public static final ObjectMapper yamlMapper() {
}

private static ObjectMapper configure(ObjectMapper mapper) {
SimpleModule simpleModule = new SimpleModule();
simpleModule.addDeserializer(Task.class, new TaskDeserializer());
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)
.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false)
.registerModule(simpleModule);
.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false);
}

private ObjectMapperFactory() {}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

31 changes: 0 additions & 31 deletions api/src/main/java/io/serverlessworkflow/api/TaskSerializer.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.serverlessworkflow.api;
package io.serverlessworkflow.serialization;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
Expand All @@ -27,7 +27,8 @@ public class DeserializeHelper {
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);
JsonProcessingException ex =
new JsonMappingException(p, "Problem deserializing " + targetClass);
for (Class<?> unionType : unionTypes) {
try {
Object object = p.getCodec().treeToValue(node, unionType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.serverlessworkflow.api;
package io.serverlessworkflow.serialization;

import com.fasterxml.jackson.core.JsonGenerator;
import java.io.IOException;
Expand Down
Loading
Loading