danielgmyers / flux-swf-client

Apache License 2.0
9 stars 3 forks source link

Make execution context a proper nested json map #105

Closed danielgmyers closed 3 months ago

danielgmyers commented 1 year ago

Today in the execution context users get something like this:

{
  "_nextStepName": "\"EatSandwich\"",
  "_nextStepSupportedResultCodes": "{\"_succeed\":\"DrinkWater\",\"_fail\":\"ThrowAwayBadSandwich\"}"
}

The supported result codes map is a json object encoded into a string, which is an artifact of the way step attributes are encoded (fixing that is a separate problem).

In this case all it does is make users' tooling more complicated. Instead, the next step name shouldn't be double-encoded, and the map should be a proper nested json map:

{
  "_nextStepName": "EatSandwich",
  "_nextStepSupportedResultCodes": {
    "_succeed": "DrinkWater",
    "_fail": "ThrowAwayBadSandwich"
  }
}
danielgmyers commented 4 months ago

Most of these json maps need a version field so we can do proper metadata versioning.

danielgmyers commented 4 months ago

Filed https://github.com/danielgmyers/flux-swf-client/issues/119 to track adding version fields to the other places that need it.