Skip to content

Conversation

@trojanc
Copy link
Contributor

@trojanc trojanc commented Mar 23, 2025

Motivation/Abstract

please describe in 1-3 sentences,

  • When marshalling and unmarshalling variables in the VarHolder, the original types gets lost. This is a problem when you have complex structures in your variables (e.g structs from a REST Server/Client)
  • This change solves it by allowing options to be passed to the Marshal and Unmarshal functions that gives you an opportunity to change the variable in the map just before it is Marshalled, and right after is is Unmarshalled and put back into the map.
  • BREAKING CHANGE: Removed panics from Marshal and Unmarshal it now returns an error

Description/Comments

  • Originally I put all the logic in this library to export type information, but I felt that was a very opinionated solution and added a lot of bloat into this library. Instead I kept the options clean, and give the user the ability to decide if something special needs to be done to a variable
  • I've since created another library https://github.com/trojanc/jsonr which works well here in which my opinionated way of wrapping variables are done outside of lib-bmpn-engine. It uses reflection and exports the types of items in the VarHolder allowing it to be reconstructed when unmarshalled back from JSON

Checklist

Depending on your PR, please ensure the overall consistency/integrity of the project remains.
Please tick just one check item per section below

Tests

  • did you update or create tests for your code changes?
  • not relevant

Code examples

  • did you update or add example code snippets, which relate to your code changes
  • not relevant

Documentation

  • did you update or create documentation, which relates to your code changes
  • not relevant

@codecov
Copy link

codecov bot commented Mar 23, 2025

Codecov Report

Attention: Patch coverage is 57.14286% with 48 lines in your changes missing coverage. Please review.

Project coverage is 62.98%. Comparing base (bf154b2) to head (954ba52).

Files with missing lines Patch % Lines
pkg/bpmn_engine/marshalling.go 57.14% 37 Missing and 11 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #258      +/-   ##
==========================================
- Coverage   63.44%   62.98%   -0.47%     
==========================================
  Files          28       28              
  Lines        1896     1991      +95     
==========================================
+ Hits         1203     1254      +51     
- Misses        647      680      +33     
- Partials       46       57      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@trojanc trojanc force-pushed the marshal_variables branch 2 times, most recently from 589d327 to bb9f6bd Compare May 9, 2025 08:08
@trojanc trojanc force-pushed the marshal_variables branch from bb9f6bd to 954ba52 Compare May 11, 2025 19:03
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.

1 participant