cncf / wg-serverless

CNCF Serverless WG
https://cncf.io
Apache License 2.0
1.52k stars 151 forks source link

Updating Switch State #226

Closed tsurdilo closed 4 years ago

tsurdilo commented 4 years ago

Updates Switch state:

Reason: Our Switch state is very important state in spec however was way too complex to use. It acts as an exclusive gateway so the docs and its definition have been updated to clearly state its purpose. The different choices were not needed and just made things more complicated than should be, so they are removed.

wanghq commented 4 years ago

Why renaming the choices to conditions? I feel those are actually choices which contain condition and actions (goto). Or if you don't like the choices, is cases an ok name to follow the programming lang convention like https://en.wikipedia.org/wiki/Switch_statement ?

tsurdilo commented 4 years ago

@wanghq I understand your point and in general you are correct. Traditionally the structure as you describe is "switch state includes 1 or more choices/cases, each choice/case contains a condition and action/transition."

We simplify this and just have conditions, which include a transition definition. So for what we define can be described as: "switch state includes 1 or more conditions which can trigger transitions(actions)".

IMO this reduces the amount of json to define the same functionality. WDYT?

tsurdilo commented 4 years ago

rebased