Skip to content
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

Provide a custom serialization mechanism for collection types of complex datatypes #40

Open
zambrovski opened this issue Apr 23, 2020 · 2 comments
Assignees
Labels
Type: bug Something isn't working
Milestone

Comments

@zambrovski
Copy link
Member

As a developer I want to be able to use collection types with complex data structures in variables. By complex data type, we mean everything besides Integer, Long, Float, String (so types supported by Jackson in a native way).

Due to the limitation of Jackson/SPIN, if you serialize a collection type of a custom datatype, the JSON output looks like:

[{stringValue=str1, intValue=1, dateValue=1587681368230}, {stringValue=str2, intValue=2, dateValue=1587594968230}]

For a complex type in the collection (here in Kotlin):

data class ComplexDataStructure(
    val stringValue: String,
    val intValue: Int,
    val dateValue: Date
)

As a result, the de-seririalization of such an array of values is not possible, since Jackson is missing the type information. To overcome this there are several alternatives. For example, you can configure Jackson ObjectMapper to write FQCN into JSON, but this creates a unneeded dependency between JSON and your Java code.

As an additional feature, the library should provide variable factories for collections using a special serialization wrapper object. In addition, those factories should be constructed using overloaded methods of listVariable(name, type, useWrapperType), setVariable(name, type, useWrapperType), mapVariable(name, type, useWrapperType) and create WrappedListVariableFactory, WrappedSetVariableFactory and WrappedMapVariableFactory.

The implementation of those factories should write a wrapper object containing the list, the set and the map as a member but doesn't expose that object to the user, but just use it for the serialization.

@zambrovski zambrovski added this to the 1.0.0 milestone Apr 23, 2020
@zambrovski zambrovski added the Type: enhancement New feature or request label Apr 23, 2020
@zambrovski zambrovski self-assigned this Apr 23, 2020
@zambrovski zambrovski added the State: in progress Assignee is working on the issue. label Apr 23, 2020
@zambrovski
Copy link
Member Author

zambrovski commented Jun 15, 2020

Close this, as soon as https://jira.camunda.com/browse/CAM-12041 is resolved.
Remote the code from spin-type-detector artifact.

@zambrovski zambrovski modified the milestones: 1.0.0, BACKLOG Jun 24, 2020
@zambrovski
Copy link
Member Author

The issue is resolved on Camunda side, but the serialization of the maps doesn't work!

@zambrovski zambrovski added the Type: bug Something isn't working label Nov 23, 2020
@zambrovski zambrovski removed State: in progress Assignee is working on the issue. Type: enhancement New feature or request labels Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant