Skip to content

Improve cloud event to json conversion#1445

Merged
fjtirado merged 1 commit into
serverlessworkflow:mainfrom
fjtirado:Improve_cloudevent_json_serialization
Jun 10, 2026
Merged

Improve cloud event to json conversion#1445
fjtirado merged 1 commit into
serverlessworkflow:mainfrom
fjtirado:Improve_cloudevent_json_serialization

Conversation

@fjtirado

@fjtirado fjtirado commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Relies on SDK serialization/deserialization.

Adds small patch to be compliant with expected behaviour

Relies on SDK serialization/deserialization.

Adds small patch to be compliant with expected behaviour

Signed-off-by: fjtirado <ftirados@ibm.com>
Copilot AI review requested due to automatic review settings June 9, 2026 16:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates CloudEvent ↔ JSON conversion to rely on the project’s configured Jackson ObjectMapper (including the CloudEvents Jackson module) rather than using the CloudEvents SDK EventFormatProvider JSON format directly, with an additional adjustment to ensure the data envelope is represented as JSON when needed.

Changes:

  • Reworked JacksonCloudEventUtils.toJsonNode(CloudEvent) to use ObjectMapper.convertValue(...) and normalize data when it is emitted as a POJONode.
  • Reworked JacksonCloudEventUtils.toCloudEvent(JsonNode) to use ObjectMapper.convertValue(...) for deserialization.
  • Expanded unit tests to cover CloudEvent serialization with null data and with JsonCloudEventData.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
impl/json-utils/src/main/java/io/serverlessworkflow/impl/jackson/JacksonCloudEventUtils.java Switches CloudEvent JSON conversion to Jackson convertValue and adjusts data node handling.
impl/json-utils/src/test/java/io/serverlessworkflow/impl/jackson/JacksonCloudEventUtilsTest.java Adds/updates tests for null data serialization and JsonCloudEventData serialization.

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

@mcruzdev mcruzdev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@fjtirado fjtirado merged commit 91537da into serverlessworkflow:main Jun 10, 2026
3 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.

4 participants