Skip to content

Instantly share code, notes, and snippets.

@ricardozanini
Last active December 14, 2020 21:09
Show Gist options
  • Save ricardozanini/0632f34d3f1f75717d7c3eac165ce95f to your computer and use it in GitHub Desktop.
Save ricardozanini/0632f34d3f1f75717d7c3eac165ce95f to your computer and use it in GitHub Desktop.
Fahrenheit to Celsius Conversion Workflow
{
"id": "fahrenheit_to_celsius",
"name": "Fahrenheit to Celsius Conversion Flow",
"version": "v1.0",
"functions": [
{
"name": "multiplication",
"resource": "/",
"type": "rest",
"metadata": {
"method": "POST"
}
},
{
"name": "subtraction",
"resource": "/",
"type": "rest",
"metadata": {
"method": "POST"
}
}
],
"states": [
{
"start": {
"kind": "default"
},
"name": "SetConstants",
"type": "inject",
"data": {
"subtractValue": "32.0",
"multiplyValue": "0.5556"
},
"transition": {
"nextState": "Computation"
}
},
{
"name": "Computation",
"actionMode": "sequential",
"type": "operation",
"actions": [
{
"name": "subtract32",
"functionRef": {
"refName": "subtraction",
"parameters": {
"leftElement": "$.fahrenheit",
"rightElement": "$.subtractValue"
}
}
},
{
"name": "multiplyByFiveNinth",
"functionRef": {
"refName": "multiplication",
"parameters": {
"leftElement": "$.subtraction.difference",
"rightElement": "$.multiplyValue"
}
}
}
],
"transition": {
"nextState": "FormatResult"
}
},
{
"name": "FormatResult",
"type": "inject",
"data": {
"celsius": "$.multiplication.product"
},
"end": {
"kind": "terminate"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment