danielgmyers / flux-swf-client

Apache License 2.0
10 stars 3 forks source link

Make execution context a proper nested json map #105

Closed danielgmyers closed 5 months ago

danielgmyers commented 2 years 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 5 months ago

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

danielgmyers commented 5 months ago

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