Skip to content

[Fix #1333] Fixing WorkflowModelCollection serialization/deserialization#1334

Merged
fjtirado merged 1 commit intoserverlessworkflow:mainfrom
fjtirado:Fix_#1333
Apr 22, 2026
Merged

[Fix #1333] Fixing WorkflowModelCollection serialization/deserialization#1334
fjtirado merged 1 commit intoserverlessworkflow:mainfrom
fjtirado:Fix_#1333

Conversation

@fjtirado
Copy link
Copy Markdown
Collaborator

Fix #1333

Copilot AI review requested due to automatic review settings April 22, 2026 13:49
@fjtirado fjtirado requested a review from gmunozfe April 22, 2026 13:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes #1333 by ensuring WorkflowModelCollection implementations are marshalled/unmarshalled as models (custom objects) rather than as raw collections, preventing type loss and potential ClassCastException when consumers expect a WorkflowModel.

Changes:

  • Register new collection-specific CustomObjectMarshaller implementations for both Jackson and experimental Java model collections.
  • Add Jackson serializer/deserializer so JacksonModelCollection is represented as a JSON array (not an object wrapper).
  • Update core writeObject logic to treat any WorkflowModel as Type.CUSTOM, ensuring model collections don’t fall through to Type.COLLECTION.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
impl/model/src/main/resources/META-INF/services/io.serverlessworkflow.impl.marshaller.CustomObjectMarshaller Registers Jackson collection marshaller via ServiceLoader.
impl/model/src/main/java/io/serverlessworkflow/impl/model/jackson/JacksonModelCollectionSerializer.java Serializes JacksonModelCollection as its underlying array node.
impl/model/src/main/java/io/serverlessworkflow/impl/model/jackson/JacksonModelCollectionDeserializer.java Deserializes JSON into JacksonModelCollection (currently has a constructor/type mismatch bug).
impl/model/src/main/java/io/serverlessworkflow/impl/model/jackson/JacksonModelCollectionMarshaller.java Adds a Jackson-based CustomObjectMarshaller for JacksonModelCollection.
impl/model/src/main/java/io/serverlessworkflow/impl/model/jackson/JacksonModelCollection.java Adds Jackson (de)serialization annotations and exposes node for serializer access.
impl/core/src/main/java/io/serverlessworkflow/impl/marshaller/AbstractOutputBuffer.java Forces WorkflowModel instances (including collections) to be written as Type.CUSTOM.
experimental/model/src/main/resources/META-INF/services/io.serverlessworkflow.impl.marshaller.CustomObjectMarshaller Registers experimental Java collection marshaller via ServiceLoader.
experimental/model/src/main/java/io/serverlessworkflow/impl/model/func/JavaModelCollectionMarshaller.java Adds CustomObjectMarshaller for JavaModelCollection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Collaborator

@gmunozfe gmunozfe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm, excellent work @fjtirado !

…ation/deserialization

Signed-off-by: fjtirado <ftirados@redhat.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fjtirado fjtirado merged commit 6d01f37 into serverlessworkflow:main Apr 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collections models are marshalled as collections and not as model

3 participants