diff --git a/schema/auth.json b/schema/auth.json
index 253ab07b..5a651988 100644
--- a/schema/auth.json
+++ b/schema/auth.json
@@ -32,7 +32,8 @@
"name": {
"type": "string",
"description": "Unique auth definition name",
- "minLength": 1
+ "minLength": 1,
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"scheme": {
"type": "string",
diff --git a/schema/errors.json b/schema/errors.json
index 52088967..7e01a8ea 100644
--- a/schema/errors.json
+++ b/schema/errors.json
@@ -32,7 +32,8 @@
"name": {
"type": "string",
"description": "Domain-specific error name",
- "minLength": 1
+ "minLength": 1,
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"code": {
"type": "string",
diff --git a/schema/events.json b/schema/events.json
index 59ef767d..9c20f8de 100644
--- a/schema/events.json
+++ b/schema/events.json
@@ -32,7 +32,8 @@
"name": {
"type": "string",
"description": "Unique event name",
- "minLength": 1
+ "minLength": 1,
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"source": {
"type": "string",
diff --git a/schema/functions.json b/schema/functions.json
index a29bd2d7..49dea47f 100644
--- a/schema/functions.json
+++ b/schema/functions.json
@@ -32,7 +32,8 @@
"name": {
"type": "string",
"description": "Unique function name",
- "minLength": 1
+ "minLength": 1,
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"operation": {
"type": "string",
@@ -58,7 +59,8 @@
{
"type": "string",
"description": "References the auth definition to be used to invoke the operation",
- "minLength": 1
+ "minLength": 1,
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
{
"type": "object",
@@ -67,7 +69,8 @@
"resource":{
"type": "string",
"description": "References an auth definition to be used to access the resource defined in the operation parameter",
- "minLength": 1
+ "minLength": 1,
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"invocation":{
"type": "string",
diff --git a/schema/retries.json b/schema/retries.json
index 1690abd7..fe77f3df 100644
--- a/schema/retries.json
+++ b/schema/retries.json
@@ -32,7 +32,8 @@
"name": {
"type": "string",
"description": "Unique retry strategy name",
- "minLength": 1
+ "minLength": 1,
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"delay": {
"type": "string",
diff --git a/schema/workflow.json b/schema/workflow.json
index dae1bd54..9d0cb97c 100644
--- a/schema/workflow.json
+++ b/schema/workflow.json
@@ -301,7 +301,8 @@
{
"type": "string",
"description": "Name of state to transition to",
- "minLength": 1
+ "minLength": 1,
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
{
"type": "object",
@@ -310,7 +311,8 @@
"nextState": {
"type": "string",
"description": "Name of state to transition to",
- "minLength": 1
+ "minLength": 1,
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"produceEvents": {
"type": "array",
@@ -396,7 +398,8 @@
"description": "References one or more unique event names in the defined workflow events",
"minItems": 1,
"items": {
- "type": "string"
+ "type": "string",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"uniqueItems": true,
"additionalItems": false
@@ -434,7 +437,8 @@
"properties": {
"name": {
"type": "string",
- "description": "Unique action definition name"
+ "description": "Unique action definition name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"functionRef": {
"description": "References a function to be invoked",
@@ -488,16 +492,19 @@
"oneOf": [
{
"required": [
+ "name",
"functionRef"
]
},
{
"required": [
+ "name",
"eventRef"
]
},
{
"required": [
+ "name",
"subFlowRef"
]
}
@@ -508,7 +515,8 @@
{
"type": "string",
"description": "Name of the referenced function",
- "minLength": 1
+ "minLength": 1,
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
{
"type": "object",
@@ -516,7 +524,8 @@
"properties": {
"refName": {
"type": "string",
- "description": "Name of the referenced function"
+ "description": "Name of the referenced function",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"arguments": {
"type": "object",
@@ -549,11 +558,13 @@
"properties": {
"produceEventRef": {
"type": "string",
- "description": "Reference to the unique name of a 'produced' event definition"
+ "description": "Reference to the unique name of a 'produced' event definition",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"consumeEventRef": {
"type": "string",
- "description": "Reference to the unique name of a 'consumed' event definition"
+ "description": "Reference to the unique name of a 'consumed' event definition",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"consumeEventTimeout": {
"type": "string",
@@ -631,7 +642,8 @@
"properties": {
"name": {
"type": "string",
- "description": "Branch name"
+ "description": "Branch name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"timeouts": {
"type": "object",
@@ -668,7 +680,8 @@
"properties": {
"name": {
"type": "string",
- "description": "State name"
+ "description": "State name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"type": {
"type": "string",
@@ -717,7 +730,8 @@
"properties": {
"name": {
"type": "string",
- "description": "State name"
+ "description": "State name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"type": {
"type": "string",
@@ -778,7 +792,8 @@
"compensatedBy": {
"type": "string",
"minLength": 1,
- "description": "Unique Name of a workflow state which is responsible for compensation of this state"
+ "description": "Unique Name of a workflow state which is responsible for compensation of this state",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"metadata": {
"$ref": "common.json#/definitions/metadata"
@@ -810,7 +825,8 @@
"properties": {
"name": {
"type": "string",
- "description": "State name"
+ "description": "State name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"type": {
"type": "string",
@@ -871,7 +887,8 @@
"compensatedBy": {
"type": "string",
"minLength": 1,
- "description": "Unique Name of a workflow state which is responsible for compensation of this state"
+ "description": "Unique Name of a workflow state which is responsible for compensation of this state",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"usedForCompensation": {
"type": "boolean",
@@ -927,7 +944,8 @@
"properties": {
"name": {
"type": "string",
- "description": "State name"
+ "description": "State name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"type": {
"type": "string",
@@ -998,7 +1016,8 @@
"compensatedBy": {
"type": "string",
"minLength": 1,
- "description": "Unique Name of a workflow state which is responsible for compensation of this state"
+ "description": "Unique Name of a workflow state which is responsible for compensation of this state",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"usedForCompensation": {
"type": "boolean",
@@ -1064,7 +1083,8 @@
"properties": {
"name": {
"type": "string",
- "description": "State name"
+ "description": "State name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"type": {
"type": "string",
@@ -1113,7 +1133,8 @@
"compensatedBy": {
"type": "string",
"minLength": 1,
- "description": "Unique Name of a workflow state which is responsible for compensation of this state"
+ "description": "Unique Name of a workflow state which is responsible for compensation of this state",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"usedForCompensation": {
"type": "boolean",
@@ -1138,7 +1159,8 @@
"properties": {
"name": {
"type": "string",
- "description": "State name"
+ "description": "State name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"type": {
"type": "string",
@@ -1184,7 +1206,8 @@
"compensatedBy": {
"type": "string",
"minLength": 1,
- "description": "Unique Name of a workflow state which is responsible for compensation of this state"
+ "description": "Unique Name of a workflow state which is responsible for compensation of this state",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"usedForCompensation": {
"type": "boolean",
@@ -1209,7 +1232,8 @@
"properties": {
"name": {
"type": "string",
- "description": "The optional name of the default condition, used solely for display purposes"
+ "description": "The optional name of the default condition, used solely for display purposes",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"transition": {
"$ref": "#/definitions/transition"
@@ -1248,11 +1272,13 @@
"properties": {
"name": {
"type": "string",
- "description": "Event condition name"
+ "description": "Event condition name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"eventRef": {
"type": "string",
- "description": "References an unique event name in the defined workflow events"
+ "description": "References an unique event name in the defined workflow events",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"transition": {
"description": "Next transition of the workflow if there is valid matches",
@@ -1268,6 +1294,7 @@
},
"additionalProperties": false,
"required": [
+ "name",
"eventRef",
"transition"
]
@@ -1278,11 +1305,13 @@
"properties": {
"name": {
"type": "string",
- "description": "Event condition name"
+ "description": "Event condition name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"eventRef": {
"type": "string",
- "description": "References an unique event name in the defined workflow events"
+ "description": "References an unique event name in the defined workflow events",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"end": {
"$ref": "#/definitions/end",
@@ -1298,6 +1327,7 @@
},
"additionalProperties": false,
"required": [
+ "name",
"eventRef",
"end"
]
@@ -1318,7 +1348,8 @@
"properties": {
"name": {
"type": "string",
- "description": "Data condition name"
+ "description": "Data condition name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"condition": {
"type": "string",
@@ -1334,6 +1365,7 @@
},
"additionalProperties": false,
"required": [
+ "name",
"condition",
"transition"
]
@@ -1344,7 +1376,8 @@
"properties": {
"name": {
"type": "string",
- "description": "Data condition name"
+ "description": "Data condition name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"condition": {
"type": "string",
@@ -1360,6 +1393,7 @@
},
"additionalProperties": false,
"required": [
+ "name",
"condition",
"end"
]
@@ -1370,7 +1404,8 @@
"properties": {
"name": {
"type": "string",
- "description": "State name"
+ "description": "State name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"type": {
"type": "string",
@@ -1396,7 +1431,8 @@
"compensatedBy": {
"type": "string",
"minLength": 1,
- "description": "Unique Name of a workflow state which is responsible for compensation of this state"
+ "description": "Unique Name of a workflow state which is responsible for compensation of this state",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"usedForCompensation": {
"type": "boolean",
@@ -1452,7 +1488,8 @@
"properties": {
"name": {
"type": "string",
- "description": "State name"
+ "description": "State name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"type": {
"type": "string",
@@ -1526,7 +1563,8 @@
"compensatedBy": {
"type": "string",
"minLength": 1,
- "description": "Unique Name of a workflow state which is responsible for compensation of this state"
+ "description": "Unique Name of a workflow state which is responsible for compensation of this state",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"usedForCompensation": {
"type": "boolean",
@@ -1594,7 +1632,8 @@
"properties": {
"name": {
"type": "string",
- "description": "State name"
+ "description": "State name",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"type": {
"type": "string",
@@ -1607,7 +1646,8 @@
},
"eventRef": {
"type": "string",
- "description": "References an unique callback event name in the defined workflow events"
+ "description": "References an unique callback event name in the defined workflow events",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"timeouts": {
"type": "object",
@@ -1653,7 +1693,8 @@
"compensatedBy": {
"type": "string",
"minLength": 1,
- "description": "Unique Name of a workflow state which is responsible for compensation of this state"
+ "description": "Unique Name of a workflow state which is responsible for compensation of this state",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"usedForCompensation": {
"type": "boolean",
@@ -1711,7 +1752,8 @@
{
"type": "string",
"description": "Name of the starting workflow state",
- "minLength": 1
+ "minLength": 1,
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
{
"type": "object",
@@ -1720,7 +1762,8 @@
"stateName": {
"type": "string",
"description": "Name of the starting workflow state",
- "minLength": 1
+ "minLength": 1,
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"schedule": {
"description": "Define the time/repeating intervals or cron at which workflow instances should be automatically started.",
@@ -1819,7 +1862,8 @@
"properties": {
"eventRef": {
"type": "string",
- "description": "References a name of a defined event"
+ "description": "References a name of a defined event",
+ "pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"data": {
"type": [
diff --git a/specification.md b/specification.md
index 9364266a..d47c6e77 100644
--- a/specification.md
+++ b/specification.md
@@ -97,6 +97,7 @@
* [Workflow Secrets](#workflow-secrets)
* [Workflow Metadata](#workflow-metadata)
* [Workflow Context](#workflow-context)
+ * [Naming Convention](#naming-convention)
- [Extensions](#extensions)
- [Use Cases](#use-cases)
- [Examples](#examples)
@@ -539,6 +540,7 @@ and have the following action definition:
{
"actions":[
{
+ "name": "fetch-items-to-buy",
"functionRef": "breadAndPastaTypesFunction",
"actionDataFilter": {
"results": "${ [ .breads[0], .pasta[1] ] }",
@@ -647,18 +649,19 @@ a workflow with a single event state and show how data filters can be combined.
"start": "WaitForCustomerToArrive",
"states":[
{
- "name": "WaitForCustomerToArrive",
+ "name": "wait-for-customer-to-arrive",
"type": "event",
"onEvents": [{
- "eventRefs": ["CustomerArrivesEvent"],
+ "eventRefs": ["customer-arrives-event"],
"eventDataFilter": {
"data": "${ .customer }",
"toStateData": "${ .customerInfo }"
},
"actions":[
{
+ "name": "greet-customer",
"functionRef": {
- "refName": "greetingFunction",
+ "refName": "greeting-function",
"arguments": {
"greeting": "${ .hello.spanish } ",
"customerName": "${ .customerInfo.name } "
@@ -680,12 +683,12 @@ a workflow with a single event state and show how data filters can be combined.
}
],
"events": [{
- "name": "CustomerArrivesEvent",
+ "name": "customer-arrives-event",
"type": "customer-arrival-type",
"source": "customer-arrival-event-source"
}],
"functions": [{
- "name": "greetingFunction",
+ "name": "greeting-function",
"operation": "http://my.api.org/myapi.json#greeting"
}]
}
@@ -1030,7 +1033,7 @@ Here is an example function definition for a RESTful service operation.
{
"functions": [
{
- "name": "sendOrderConfirmation",
+ "name": "send-order-confirmation",
"operation": "file://confirmationapi.json#sendOrderConfirmation"
}
]
@@ -1044,11 +1047,11 @@ For example:
{
"states": [
{
- "name":"SendConfirmState",
+ "name":"send-confirm-state",
"type":"operation",
"actions":[
{
- "functionRef": "sendOrderConfirmation"
+ "functionRef": "send-order-confirmation"
}],
"end": true
}]
@@ -1111,7 +1114,7 @@ To define a workflow action invocation, we can then use the following workflow [
{
"functions": [
{
- "name": "publishLightMeasurements",
+ "name": "publish-light-measurements",
"operation": "file://streetlightsapi.yaml#onLightMeasured",
"type": "asyncapi"
}]
@@ -1130,13 +1133,13 @@ Our defined function definition can then we referenced in a workflow [action](#A
```json
{
- "name": "Publish Measurements",
+ "name": "publish-measurements",
"type": "operation",
"actions":[
{
- "name": "Publish Light Measurements",
+ "name": "publish-light-measurements",
"functionRef":{
- "refName": "publishLightMeasurements",
+ "refName": "publish-light-measurements",
"arguments":{
"id": "${ .currentLight.id }",
"lumens": "${ .currentLight.lumens }",
@@ -1193,7 +1196,7 @@ In our workflow definition, we can then use function definitions:
{
"functions": [
{
- "name": "listUsers",
+ "name": "list-users",
"operation": "file://myuserservice.proto#UserService#ListUsers",
"type": "rpc"
}
@@ -1252,7 +1255,7 @@ In our workflow definition, we can then use a function definition for the `pet`
{
"functions": [
{
- "name": "getOnePet",
+ "name": "get-one-pet",
"operation": "https://example.com/pets/graphql#query#pet",
"type": "graphql"
}
@@ -1270,7 +1273,7 @@ In order to invoke this query, we would use the following `functionRef` paramete
```json
{
- "refName": "getOnePet",
+ "refName": "get-one-pet",
"arguments": {
"id": 42
},
@@ -1300,7 +1303,7 @@ Likewise, we would use the following function definition:
{
"functions": [
{
- "name": "createPet",
+ "name": "create-pet",
"operation": "https://example.com/pets/graphql#mutation#createPet",
"type": "graphql"
}
@@ -1312,7 +1315,7 @@ With the parameters for the `functionRef`:
```json
{
- "refName": "createPet",
+ "refName": "create-pet",
"arguments": {
"pet": {
"id": 43,
@@ -1342,7 +1345,7 @@ Note you can include [expressions](#Workflow-Expressions) in both `arguments` an
```json
{
- "refName": "getOnePet",
+ "refName": "get-one-pet",
"arguments": {
"id": "${ .petId }"
},
@@ -1370,7 +1373,7 @@ We start off by creating a workflow [Functions Definitions](#Function-Definition
{
"functions": [
{
- "name": "queryPersons",
+ "name": "query-persons",
"operation": "https://services.odata.org/V3/OData/OData.svc#Persons",
"type": "odata"
}
@@ -1391,7 +1394,7 @@ simply reference it in a workflow [Action Definition](#Action-Definition) and se
```json
{
- "refName": "queryPersons",
+ "refName": "query-persons",
"arguments": {
"queryOptions":{
"expand": "PersonDetail/Person",
@@ -1423,12 +1426,12 @@ Let's take a look at an example of such definitions:
{
"functions": [
{
- "name": "isAdult",
+ "name": "is-adult",
"operation": ".applicant | .age >= 18",
"type": "expression"
},
{
- "name": "isMinor",
+ "name": "is-minor",
"operation": ".applicant | .age < 18",
"type": "expression"
}
@@ -1447,22 +1450,22 @@ Our expression function definitions can now be referenced by workflow states whe
{
"states":[
{
- "name":"CheckApplicant",
+ "name":"check-Applicant",
"type":"switch",
"dataConditions": [
{
- "name": "Applicant is adult",
- "condition": "${ fn:isAdult }",
- "transition": "ApproveApplication"
+ "name": "applicant-is-adult",
+ "condition": "${ fn:is-adult }",
+ "transition": "approve-application"
},
{
- "name": "Applicant is minor",
- "condition": "${ fn:isMinor }",
- "transition": "RejectApplication"
+ "name": "applicant-is-minor",
+ "condition": "${ fn:is-minor }",
+ "transition": "reject-application"
}
],
"defaultCondition": {
- "transition": "RejectApplication"
+ "transition": "reject-application"
}
}
]
@@ -1477,27 +1480,27 @@ Let's say we have the following workflow definition:
"name": "simpleadd",
"functions": [
{
- "name": "Increment Count Function",
+ "name": "Iicrement-count-function",
"type": "expression",
"operation": ".count += 1 | .count"
}
],
- "start": "Initialize Count",
+ "start": "initialize-count",
"states": [
{
- "name": "Initialize Count",
+ "name": "initialize-count",
"type": "inject",
"data": {
"count": 0
},
- "transition": "Increment Count"
+ "transition": "increment-count"
},
{
- "name": "Increment Count",
+ "name": "increment-count",
"type": "operation",
"actions": [
{
- "functionRef": "Increment Count Function",
+ "functionRef": "increment-count-function",
"actionDataFilter": {
"toStateData": "${ .count }"
}
@@ -1542,7 +1545,7 @@ defined in the specification. In those cases you can define a custom function ty
{
"functions": [
{
- "name": "sendOrderConfirmation",
+ "name": "send-order-confirmation",
"operation": "/path/to/my/script/order.ts#myFunction",
"type": "custom"
}
@@ -1560,13 +1563,13 @@ Later, the function should be able to be used in an action as any other function
```json
[{
"states": [{
- "name": "handleOrder",
+ "name": "handle-order",
"type": "operation",
"actions": [
{
- "name": "sendOrderConfirmation",
+ "name": "send-order-confirmation",
"functionRef": {
- "refName": "sendOrderConfirmation",
+ "refName": "send-order-confirmation",
"arguments": {
"order": "${ .order }"
}
@@ -1654,7 +1657,7 @@ In our workflow model we can define our reusable expression function:
{
"functions": [
{
- "name": "IsAdultApplicant",
+ "name": "is-adult-applicant",
"operation": ".applicant | .age > 18",
"type": "expression"
}
@@ -1670,7 +1673,7 @@ an inline expression that sets an input parameter inside an action for example:
"actions": [
{
"functionRef": {
- "refName": "confirmApplicant",
+ "refName": "confirm-applicant",
"arguments": {
"applicantName": "${ .applicant.name }"
}
@@ -1723,8 +1726,8 @@ We can now get back to our previously defined "IsAdultApplicant" expression func
```json
{
"dataConditions": [ {
- "condition": "${ fn:IsAdultApplicant }",
- "transition": "StartApplication"
+ "condition": "${ fn:is-adult-applicant }",
+ "transition": "start-application"
}]
}
```
@@ -1977,9 +1980,9 @@ If we have the following function definition:
{
"functions": [
{
- "name": "HelloWorldFunction",
+ "name": "hello-world-function",
"operation": "https://secure.resources.com/myapi.json#helloWorld",
- "authRef": "My Basic Auth"
+ "authRef": "my-basic-auth"
}
]
}
@@ -2017,7 +2020,7 @@ Here is an example of using external resource for function definitions:
{
"functions": [
{
- "name":"HelloWorldFunction",
+ "name":"hello-world-function",
"operation":"file://myapi.json#helloWorld"
}
]
@@ -2054,7 +2057,7 @@ Here is an example of using external resource for event definitions:
{
"events": [
{
- "name": "ApplicantInfo",
+ "name": "applicant-info",
"type": "org.application.info",
"source": "applicationssource",
"correlation": [
@@ -2153,14 +2156,14 @@ Serverless Workflow defines the following Workflow States:
```json
{
-"name": "MonitorVitals",
+"name": "monitor-vitals",
"type": "event",
"exclusive": true,
"onEvents": [{
- "eventRefs": ["HighBodyTemperature"],
+ "eventRefs": ["high-body-temperature"],
"actions": [{
"functionRef": {
- "refName": "sendTylenolOrder",
+ "refName": "send-tylenol-order",
"arguments": {
"patientid": "${ .patientId }"
}
@@ -2168,10 +2171,10 @@ Serverless Workflow defines the following Workflow States:
}]
},
{
- "eventRefs": ["HighBloodPressure"],
+ "eventRefs": ["high-blood-pressure"],
"actions": [{
"functionRef": {
- "refName": "callNurse",
+ "refName": "call-nurse",
"arguments": {
"patientid": "${ .patientId }"
}
@@ -2179,10 +2182,10 @@ Serverless Workflow defines the following Workflow States:
}]
},
{
- "eventRefs": ["HighRespirationRate"],
+ "eventRefs": ["high-respiration-rate"],
"actions": [{
"functionRef": {
- "refName": "callPulmonologist",
+ "refName": "call-pulmonologist",
"arguments": {
"patientid": "${ .patientId }"
}
@@ -2205,24 +2208,24 @@ type: event
exclusive: true
onEvents:
- eventRefs:
- - HighBodyTemperature
+ - high-body-temperature
actions:
- functionRef:
- refName: sendTylenolOrder
+ refName: send-tylenol-order
arguments:
patientid: "${ .patientId }"
- eventRefs:
- - HighBloodPressure
+ - high-blood-pressure
actions:
- functionRef:
- refName: callNurse
+ refName: call-nurse
arguments:
patientid: "${ .patientId }"
- eventRefs:
- - HighRespirationRate
+ - high-respiration-rate
actions:
- functionRef:
- refName: callPulmonologist
+ refName: call-pulmonologist
arguments:
patientid: "${ .patientId }"
end:
@@ -2276,7 +2279,7 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Unique State name | string | yes |
+| name | Unique State name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| type | State type | string | yes |
| actionMode | Should actions be performed sequentially or in parallel. Default is `sequential` | enum | no |
| [actions](#Action-Definition) | Actions to be performed | array | yes |
@@ -2302,13 +2305,13 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
```json
{
- "name": "RejectApplication",
+ "name": "reject-application",
"type": "operation",
"actionMode": "sequential",
"actions": [
{
"functionRef": {
- "refName": "sendRejectionEmailFunction",
+ "refName": "send-rejection-email-function",
"arguments": {
"customer": "${ .customer }"
}
@@ -2323,12 +2326,12 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
```yaml
-name: RejectApplication
+name: reject-application
type: operation
actionMode: sequential
actions:
- functionRef:
- refName: sendRejectionEmailFunction
+ refName: send-rejection-email-function
arguments:
customer: "${ .customer }"
end: true
@@ -2351,7 +2354,7 @@ the [Workflow Timeouts](#Workflow-Timeouts) section.
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Unique State name | string | yes |
+| name | Unique State name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| type | State type | string | yes |
| [dataConditions](#Switch-state-Data-Conditions) | Defined if the Switch state evaluates conditions and transitions based on state data. | array | yes (if `eventConditions` is not defined) |
| [eventConditions](#Switch-State-Event-Conditions) | Defined if the Switch state evaluates conditions and transitions based on arrival of events. | array | yes (if `dataConditions` is not defined |
@@ -2376,23 +2379,23 @@ the [Workflow Timeouts](#Workflow-Timeouts) section.
```json
{
- "name":"CheckVisaStatus",
+ "name":"check-visa-status",
"type":"switch",
"eventConditions": [
{
- "eventRef": "visaApprovedEvent",
- "transition": "HandleApprovedVisa"
+ "eventRef": "visa-approved-event",
+ "transition": "handle-approved-visa"
},
{
- "eventRef": "visaRejectedEvent",
- "transition": "HandleRejectedVisa"
+ "eventRef": "visa-rejected-event",
+ "transition": "handle-rejected-visa"
}
],
"timeouts": {
"eventTimeout": "PT1H"
},
"defaultCondition": {
- "transition": "HandleNoVisaDecision"
+ "transition": "handle-no-visa-decision"
}
}
```
@@ -2401,17 +2404,17 @@ the [Workflow Timeouts](#Workflow-Timeouts) section.
|
```yaml
-name: CheckVisaStatus
+name: check-visa-status
type: switch
eventConditions:
-- eventRef: visaApprovedEvent
- transition: HandleApprovedVisa
-- eventRef: visaRejectedEvent
- transition: HandleRejectedVisa
+- eventRef: visa-approved-event
+ transition: handle-approved-visa
+- eventRef: visa-rejected-event
+ transition: handle-rejected-visa
timeouts:
eventTimeout: PT1H
defaultCondition:
- transition: HandleNoVisaDecision
+ transition: handle-no-visa-decision
```
|
@@ -2450,7 +2453,7 @@ The `timeouts` property can be used to define state specific timeout settings. S
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Unique State name | string | yes |
+| name | Unique State name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| type | State type | string | yes |
| duration | Duration (ISO 8601 duration format) to sleep. For example: "PT15M" (sleep 15 minutes), or "P2DT3H4M" (sleep 2 days, 3 hours and 4 minutes) | string | yes |
| [transition](#Transitions) | Next transition of the workflow after the sleep | string or object | yes (if `end` is not defined) |
@@ -2469,10 +2472,10 @@ The `timeouts` property can be used to define state specific timeout settings. S
```json
{
- "name": "SleepFiveSeconds",
+ "name": "sleep-five-seconds",
"type": "sleep",
"duration": "PT5S",
- "transition": "GetJobStatus"
+ "transition": "get-job-status"
}
```
@@ -2480,10 +2483,10 @@ The `timeouts` property can be used to define state specific timeout settings. S
```yaml
-name: SleepFiveSeconds
+name: sleep-five-seconds
type: sleep
duration: PT5S
-transition: GetJobStatus
+transition: get-job-status
```
|
@@ -2501,7 +2504,7 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Unique State name | string | yes |
+| name | Unique State name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| type | State type | string | yes |
| [branches](#Parallel-State-Branch) | List of branches for this parallel state| array | yes |
| completionType | Option types on how to complete branch execution. Default is "allOf" | enum | no |
@@ -2528,16 +2531,16 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
```json
{
- "name":"ParallelExec",
+ "name":"parallel-exec",
"type":"parallel",
"completionType": "allOf",
"branches": [
{
- "name": "Branch1",
+ "name": "branch-1",
"actions": [
{
"functionRef": {
- "refName": "functionNameOne",
+ "refName": "function-name-one",
"arguments": {
"order": "${ .someParam }"
}
@@ -2546,11 +2549,11 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
]
},
{
- "name": "Branch2",
+ "name": "branch-2",
"actions": [
{
"functionRef": {
- "refName": "functionNameTwo",
+ "refName": "function-name-two",
"arguments": {
"order": "${ .someParam }"
}
@@ -2567,20 +2570,20 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
```yaml
-name: ParallelExec
+name: parallel-exec
type: parallel
completionType: allOf
branches:
-- name: Branch1
+- name: branch-1
actions:
- functionRef:
- refName: functionNameOne
+ refName: function-name-one
arguments:
order: "${ .someParam }"
-- name: Branch2
+- name: branch-2
actions:
- functionRef:
- refName: functionNameTwo
+ refName: function-name-two
arguments:
order: "${ .someParam }"
end: true
@@ -2615,7 +2618,7 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Unique State name | string | yes |
+| name | Unique State name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| type | State type | string | yes |
| data | JSON object which can be set as state's data input and can be manipulated via filter | object | yes |
| [stateDataFilter](#state-data-filters) | State data filter | object | no |
@@ -2638,12 +2641,12 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
```json
{
- "name":"Hello",
+ "name":"hello",
"type":"inject",
"data": {
"result": "Hello"
},
- "transition": "World"
+ "transition": "world"
}
```
@@ -2651,11 +2654,11 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
|
```yaml
-name: Hello
+name: hello
type: inject
data:
result: Hello
-transition: World
+transition: world
```
|
@@ -2684,7 +2687,7 @@ as data output to the transition state:
```json
{
- "name":"SimpleInjectState",
+ "name":"simple-inject-state",
"type":"inject",
"data": {
"person": {
@@ -2694,7 +2697,7 @@ as data output to the transition state:
"age": 40
}
},
- "transition": "GreetPersonState"
+ "transition": "greet-person-state"
}
```
@@ -2702,7 +2705,7 @@ as data output to the transition state:
```yaml
- name: SimpleInjectState
+ name: simple-inject-state
type: inject
data:
person:
@@ -2710,7 +2713,7 @@ as data output to the transition state:
lname: Doe
address: 1234 SomeStreet
age: 40
- transition: GreetPersonState
+ transition: greet-person-state
```
|
@@ -2746,7 +2749,7 @@ You can also use the filter property to filter the state data after data is inje
```json
{
- "name":"SimpleInjectState",
+ "name":"simple-inject-state",
"type":"inject",
"data": {
"people": [
@@ -2773,7 +2776,7 @@ You can also use the filter property to filter the state data after data is inje
"stateDataFilter": {
"output": "${ {people: [.people[] | select(.age < 40)]} }"
},
- "transition": "GreetPersonState"
+ "transition": "greet-person-state"
}
```
@@ -2781,7 +2784,7 @@ You can also use the filter property to filter the state data after data is inje
```yaml
- name: SimpleInjectState
+ name: simple-inject-state
type: inject
data:
people:
@@ -2799,7 +2802,7 @@ You can also use the filter property to filter the state data after data is inje
age: 30
stateDataFilter:
output: "${ {people: [.people[] | select(.age < 40)]} }"
- transition: GreetPersonState
+ transition: greet-person-state
```
|
@@ -2841,7 +2844,7 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Unique State name | string | yes |
+| name | Unique State name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| type | State type | string | yes |
| inputCollection | Workflow expression selecting an array element of the states data | string | yes |
| outputCollection | Workflow expression specifying an array element of the states data to add the results of each iteration | string | no |
@@ -2871,7 +2874,7 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
```json
{
- "name": "ProvisionOrdersState",
+ "name": "provision-orders-state",
"type": "foreach",
"inputCollection": "${ .orders }",
"iterationParam": "singleorder",
@@ -2879,7 +2882,7 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
"actions": [
{
"functionRef": {
- "refName": "provisionOrderFunction",
+ "refName": "provision-order-function",
"arguments": {
"order": "${ $singleorder }"
}
@@ -2893,14 +2896,14 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
```yaml
-name: ProvisionOrdersState
+name: provision-orders-state
type: foreach
inputCollection: "${ .orders }"
iterationParam: "singleorder"
outputCollection: "${ .provisionresults }"
actions:
- functionRef:
- refName: provisionOrderFunction
+ refName: provision-order-function
arguments:
order: "${ $singleorder }"
```
@@ -2983,16 +2986,16 @@ and our workflow is defined as:
"name": "SendConfirmationForCompletedOrders",
"version": "1.0.0",
"specVersion": "0.8",
- "start": "SendConfirmState",
+ "start": "send-confirm-state",
"functions": [
{
- "name": "sendConfirmationFunction",
+ "name": "send-confirmation-function",
"operation": "file://confirmationapi.json#sendOrderConfirmation"
}
],
"states": [
{
- "name":"SendConfirmState",
+ "name":"send-confirm-state",
"type":"foreach",
"inputCollection": "${ [.orders[] | select(.completed == true)] }",
"iterationParam": "completedorder",
@@ -3000,7 +3003,7 @@ and our workflow is defined as:
"actions":[
{
"functionRef": {
- "refName": "sendConfirmationFunction",
+ "refName": "send-confirmation-function",
"arguments": {
"orderNumber": "${ $completedorder.orderNumber }",
"email": "${ $completedorder.email }"
@@ -3020,19 +3023,19 @@ id: sendConfirmWorkflow
name: SendConfirmationForCompletedOrders
version: '1.0.0'
specVersion: '0.8'
-start: SendConfirmState
+start: send-confirm-state
functions:
-- name: sendConfirmationFunction
+- name: send-confirmation-function
operation: file://confirmationapi.json#sendOrderConfirmation
states:
-- name: SendConfirmState
+- name: send-confirm-state
type: foreach
inputCollection: "${ [.orders[] | select(.completed == true)] }"
iterationParam: completedorder
outputCollection: "${ .confirmationresults }"
actions:
- functionRef:
- refName: sendConfirmationFunction
+ refName: send-confirmation-function
arguments:
orderNumber: "${ $completedorder.orderNumber }"
email: "${ $completedorder.email }"
@@ -3085,7 +3088,7 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Unique State name | string | yes |
+| name | Unique State name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| type | State type | string | yes |
| [action](#Action-Definition) | Defines the action to be executed | object | yes |
| eventRef | References an unique callback event name in the defined workflow [events](#Event-Definition) | string | yes |
@@ -3112,21 +3115,21 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
```json
{
- "name": "CheckCredit",
+ "name": "check-credit",
"type": "callback",
"action": {
"functionRef": {
- "refName": "callCreditCheckMicroservice",
+ "refName": "call-credit-check-microservice",
"arguments": {
"customer": "${ .customer }"
}
}
},
- "eventRef": "CreditCheckCompletedEvent",
+ "eventRef": "credit-check-completed-event",
"timeouts": {
"stateExecTimeout": "PT15M"
},
- "transition": "EvaluateDecision"
+ "transition": "evaluate-decision"
}
```
@@ -3134,17 +3137,17 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
|
```yaml
-name: CheckCredit
+name: check-credit
type: callback
action:
functionRef:
- refName: callCreditCheckMicroservice
+ refName: call-credit-check-microservice
arguments:
customer: "${ .customer }"
-eventRef: CreditCheckCompletedEvent
+eventRef: credit-check-completed-event
timeouts:
stateExecTimeout: PT15M
-transition: EvaluateDecision
+transition: evaluate-decision
```
|
@@ -3186,7 +3189,7 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Unique function name | string | yes |
+| name | Unique function name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| operation | If type is `rest`, #. If type is `asyncapi`, #. If type is `rpc`, ##. If type is `graphql`, ##. If type is `odata`, #. If type is `expression`, defines the workflow expression. | string | yes |
| type | Defines the function type. Can be either `rest`, `asyncapi`, `rpc`, `graphql`, `odata`, `expression`, or [`custom`](#defining-custom-function-types). Default is `rest` | enum | no |
| authRef | References an [auth definition](#Auth-Definition) name to be used to access to resource defined in the operation parameter | string | no |
@@ -3205,7 +3208,7 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
```json
{
- "name": "HelloWorldFunction",
+ "name": "hello-world-function",
"operation": "https://hellworldservice.api.com/api.json#helloWorld"
}
```
@@ -3214,7 +3217,7 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
```yaml
-name: HelloWorldFunction
+name: hello-world-function
operation: https://hellworldservice.api.com/api.json#helloWorld
```
@@ -3316,7 +3319,7 @@ It's worth noting that if an [auth definition](#Auth-Definition) has been define
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Unique event name | string | yes |
+| name | Unique event name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| source | CloudEvent source. If not set when `kind` is `produced`, runtimes are expected to use a default value, such as https://serverlessworkflow.io in order to comply with the [CloudEvent spec constraints](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1))| string | yes (if `type` is not defined. |
| type | CloudEvent type | string | yes (if `source` is not defined) |
| kind | Defines the event is either `consumed` or `produced` by the workflow. Default is `consumed` | enum | no |
@@ -3337,7 +3340,7 @@ It's worth noting that if an [auth definition](#Auth-Definition) has been define
```json
{
- "name": "ApplicantInfo",
+ "name": "applicant-info",
"type": "org.application.info",
"source": "applicationssource",
"kind": "consumed",
@@ -3353,7 +3356,7 @@ It's worth noting that if an [auth definition](#Auth-Definition) has been define
|
```yaml
-name: ApplicantInfo
+name: applicant-info
type: org.application.info
source: applicationssource
kind: consumed
@@ -3441,7 +3444,7 @@ type that have the **same** value of the `patientId` property to be correlated t
{
"events": [
{
- "name": "HeartRateReadingEvent",
+ "name": "heart-rate-reading-event",
"source": "hospitalMonitorSystem",
"type": "com.hospital.patient.heartRateMonitor",
"kind": "consumed",
@@ -3466,7 +3469,7 @@ and we want to make sure that both are correlated, as in the above example, with
{
"events": [
{
- "name": "HeartRateReadingEvent",
+ "name": "heart-rate-reading-event",
"source": "hospitalMonitorSystem",
"type": "com.hospital.patient.heartRateMonitor",
"kind": "consumed",
@@ -3477,7 +3480,7 @@ and we want to make sure that both are correlated, as in the above example, with
]
},
{
- "name": "BloodPressureReadingEvent",
+ "name": "blood-pressure-reading-event",
"source": "hospitalMonitorSystem",
"type": "com.hospital.patient.bloodPressureMonitor",
"kind": "consumed",
@@ -3498,7 +3501,7 @@ on comparing it to custom defined values (string, or expression). For example:
{
"events": [
{
- "name": "HeartRateReadingEvent",
+ "name": "heart-rate-reading-event",
"source": "hospitalMonitorSystem",
"type": "com.hospital.patient.heartRateMonitor",
"kind": "consumed",
@@ -3534,7 +3537,9 @@ It can be used for both the retrieval of the function's resource (as defined by
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Unique auth definition name | string | yes |
+| name | Unique auth definition name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
+| scheme | Auth scheme, can be "basic", "bearer", or "oauth2". Default is "basic" | enum | yes |
+| name | Unique auth definition name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| scheme | Auth scheme, can be "basic", "bearer", or "oauth2". Default is "basic" | enum | no |
| properties | Auth scheme properties. Can be one of ["Basic properties definition"](#basic-properties-definition), ["Bearer properties definition"](#bearer-properties-definition), or ["OAuth2 properties definition"](#oauth2-properties-definition) | object | yes |
@@ -3660,10 +3665,10 @@ The `contextAttributeValue` property defines the value of the defined CloudEvent
```json
{
- "eventRefs": ["HighBodyTemperature"],
+ "eventRefs": ["high-body-temperature"],
"actions": [{
"functionRef": {
- "refName": "sendTylenolOrder",
+ "refName": "send-tylenol-order",
"arguments": {
"patientid": "${ .patientId }"
}
@@ -3677,10 +3682,10 @@ The `contextAttributeValue` property defines the value of the defined CloudEvent
```yaml
eventRefs:
-- HighBodyTemperature
+- high-body-temperature
actions:
- functionRef:
- refName: sendTylenolOrder
+ refName: send-tylenol-order
arguments:
patientid: "${ .patientId }"
```
@@ -3706,10 +3711,10 @@ Let's look at the following JSON definition of 'onEvents' to show this:
```json
{
"onEvents": [{
- "eventRefs": ["HighBodyTemperature", "HighBloodPressure"],
+ "eventRefs": ["high-body-temperature", "high-blood-pressure"],
"actions": [{
"functionRef": {
- "refName": "SendTylenolOrder",
+ "refName": "send-tylenol-order",
"arguments": {
"patient": "${ .patientId }"
}
@@ -3717,7 +3722,7 @@ Let's look at the following JSON definition of 'onEvents' to show this:
},
{
"functionRef": {
- "refName": "CallNurse",
+ "refName": "call-nurse",
"arguments": {
"patient": "${ .patientId }"
}
@@ -3744,7 +3749,7 @@ This is visualized in the diagram below:
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Unique Action name | string | no |
+| name | Unique Action name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| [functionRef](#FunctionRef-Definition) | References a reusable function definition | object or string | yes (if `eventRef` & `subFlowRef` are not defined) |
| [eventRef](#EventRef-Definition) | References a `produce` and `consume` reusable event definitions | object | yes (if `functionRef` & `subFlowRef` are not defined) |
| [subFlowRef](#SubFlowRef-Definition) | References a workflow to be invoked | object or string | yes (if `eventRef` & `functionRef` are not defined) |
@@ -3768,9 +3773,9 @@ This is visualized in the diagram below:
```json
{
- "name": "Finalize Application Action",
+ "name": "finalize-application-action",
"functionRef": {
- "refName": "finalizeApplicationFunction",
+ "refName": "finalize-application-function",
"arguments": {
"applicantid": "${ .applicantId }"
}
@@ -3782,9 +3787,9 @@ This is visualized in the diagram below:
|
```yaml
-name: Finalize Application Action
+name: finalize-application-action
functionRef:
- refName: finalizeApplicationFunction
+ refName: finalize-application-function
arguments:
applicantid: "${ .applicantId }"
```
@@ -3860,7 +3865,7 @@ If `string` type, it defines the name of the referenced [function](#Function-Def
This can be used as a short-cut definition when you don't need to define any other parameters, for example:
```json
-"functionRef": "myFunction"
+"functionRef": "my-function"
```
Note that if used with `string` type, the invocation of the function is synchronous.
@@ -3870,7 +3875,7 @@ it with its `object` type which has the following properties:
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| refName | Name of the referenced [function](#Function-Definition) | string | yes |
+| refName | Name of the referenced [function](#Function-Definition). Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| arguments | Arguments (inputs) to be passed to the referenced function | object | yes (if function type is `graphql`, otherwise no) |
| selectionSet | Used if function type is `graphql`. String containing a valid GraphQL [selection set](https://spec.graphql.org/June2018/#sec-Selection-Sets) | string | yes (if function type is `graphql`, otherwise no) |
| invoke | Specifies if the function should be invoked `sync` or `async`. Default is `sync` | enum | no |
@@ -3888,7 +3893,7 @@ it with its `object` type which has the following properties:
```json
{
- "refName": "finalizeApplicationFunction",
+ "refName": "finalize-application-function",
"arguments": {
"applicantid": "${ .applicantId }"
}
@@ -3899,7 +3904,7 @@ it with its `object` type which has the following properties:
|
```yaml
-refName: finalizeApplicationFunction
+refName: finalize-application-function
arguments:
applicantid: "${ .applicantId }"
```
@@ -3917,7 +3922,7 @@ Here is an example of using the `arguments` property:
```json
{
- "refName": "checkFundsAvailabe",
+ "refName": "check-funds-available",
"arguments": {
"account": {
"id": "${ .accountId }"
@@ -3943,8 +3948,8 @@ Allows defining invocation of a function via event.
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| [produceEventRef](#Event-Definition) | Reference to the unique name of a `produced` event definition | string | yes |
-| [consumeEventRef](#Event-Definition) | Reference to the unique name of a `consumed` event definition | string | no |
+| [produceEventRef](#Event-Definition) | Reference to the unique name of a `produced` event definition. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
+| [consumeEventRef](#Event-Definition) | Reference to the unique name of a `consumed` event definition. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | no |
| consumeEventTimeout | Maximum amount of time (ISO 8601 format) to wait for the consume event. If not defined it be set to the [actionExecutionTimeout](#Workflow-Timeout-Definition) | string | no |
| data | If string type, an expression which selects parts of the states data output to become the data (payload) of the event referenced by `produceEventRef`. If object type, a custom object to become the data (payload) of the event referenced by `produceEventRef`. | string or object | no |
| contextAttributes | Add additional event extension context attributes to the trigger/produced event | object | no |
@@ -3964,9 +3969,9 @@ Allows defining invocation of a function via event.
```json
{
"eventRef": {
- "produceEventRef": "MakeVetAppointment",
+ "produceEventRef": "make-vet-appointment",
"data": "${ .patientInfo }",
- "consumeEventRef": "VetAppointmentInfo"
+ "consumeEventRef": "vet-appointment-info"
}
}
```
@@ -3976,9 +3981,9 @@ Allows defining invocation of a function via event.
```yaml
eventRef:
- produceEventRef: MakeVetAppointment
+ produceEventRef: make-vet-appointment
data: "${ .patientInfo }"
- consumeEventRef: VetAppointmentInfo
+ consumeEventRef: vet-appointment-info
```
|
@@ -4172,7 +4177,7 @@ For more information, see the [Workflow Error Handling](#Workflow-Error-Handling
```json
{
- "name": "TimeoutRetryStrat",
+ "name": "timeout-retry-strat",
"delay": "PT2M",
"maxAttempts": 3,
"jitter": "PT0.001S"
@@ -4183,7 +4188,7 @@ For more information, see the [Workflow Error Handling](#Workflow-Error-Handling
```yaml
-name: TimeoutRetryStrat
+name: timeout-retry-strat
delay: PT2M
maxAttempts: 3
jitter: PT0.001S
@@ -4208,7 +4213,7 @@ To explain this better, let's say we have the following retry definition:
```json
{
- "name": "Timeout Errors Strategy",
+ "name": "timeout-errors-strategy",
"delay": "PT10S",
"increment": "PT2S",
"maxAttempts": 4
@@ -4223,7 +4228,7 @@ To explain this better, let's say we have the following retry definition:
```json
{
- "name": "Timeout Errors Strategy",
+ "name": "timeout-errors-strategy",
"delay": "PT10S",
"multiplier": 2,
"maxAttempts": 4
@@ -4263,7 +4268,7 @@ To explain this better, let's say we have the following retry definition:
```json
{
- "name": "Timeout Errors Strategy",
+ "name": "timeout-errors-strategy",
"delay": "PT10S",
"maxDelay": "PT100S",
"multiplier": 4,
@@ -4287,7 +4292,7 @@ If `string`, it defines the name of the state to transition to.
This can be used as a short-cut definition when you don't need to define any other parameters, for example:
```json
-"transition": "myNextState"
+"transition": "my-next-state"
```
If you need to define additional parameters in your `transition` definition, you can define
@@ -4313,10 +4318,10 @@ it with its `object` type which has the following properties:
```json
{
"produceEvents": [{
- "eventRef": "produceResultEvent",
+ "eventRef": "produce-result-event",
"data": "${ .result.data }"
}],
- "nextState": "EvalResultState"
+ "nextState": "eval-result-state"
}
```
@@ -4325,9 +4330,9 @@ it with its `object` type which has the following properties:
```yaml
produceEvents:
-- eventRef: produceResultEvent
+- eventRef: produce-result-event
data: "${ .result.data }"
-nextState: EvalResultState
+nextState: eval-result-state
```
|
@@ -4347,7 +4352,7 @@ Transitions allow you to move from one state (control-logic block) to another. F
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Data condition name | string | no |
+| name | Data condition name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| [condition](#Workflow-Expressions) | Workflow expression evaluated against state data. Must evaluate to `true` or `false` | string | yes |
| [transition](#Transitions) | Transition to another state if condition is `true` | string or object | yes (if `end` is not defined) |
| [end](#End-Definition) | End workflow execution if condition is `true` | boolean or object | yes (if `transition` is not defined) |
@@ -4366,9 +4371,9 @@ Transitions allow you to move from one state (control-logic block) to another. F
```json
{
- "name": "Eighteen or older",
+ "name": "eighteen-or-older",
"condition": "${ .applicant | .age >= 18 }",
- "transition": "StartApplication"
+ "transition": "start-application"
}
```
@@ -4376,9 +4381,9 @@ Transitions allow you to move from one state (control-logic block) to another. F
```yaml
-name: Eighteen or older
+name: eighteen-or-older
condition: "${ .applicant | .age >= 18 }"
-transition: StartApplication
+transition: start-application
```
|
@@ -4400,7 +4405,7 @@ definitions are mutually exclusive, meaning that you can specify either one or t
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Event condition name | string | no |
+| name | Event condition name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| eventRef | References an unique event name in the defined workflow events | string | yes |
| [transition](#Transitions) | Transition to another state if condition is `true` | string or object | yes (if `end` is not defined) |
| [end](#End-Definition) | End workflow execution if condition is `true` | boolean or object | yes (if `transition` is not defined) |
@@ -4420,9 +4425,9 @@ definitions are mutually exclusive, meaning that you can specify either one or t
```json
{
- "name": "Visa approved",
- "eventRef": "visaApprovedEvent",
- "transition": "HandleApprovedVisa"
+ "name": "visa-approved",
+ "eventRef": "visa-approved-event",
+ "transition": "handle-approved-visa"
}
```
@@ -4430,9 +4435,9 @@ definitions are mutually exclusive, meaning that you can specify either one or t
```yaml
-name: Visa approved
-eventRef: visaApprovedEvent
-transition: HandleApprovedVisa
+name: visa-approved
+eventRef: visa-approved-event
+transition: handle-approved-visa
```
|
@@ -4457,7 +4462,7 @@ definitions are mutually exclusive, meaning that you can specify either one or t
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| name | Branch name | string | yes |
+| name | Branch name. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
| [actions](#Action-Definition) | Actions to be executed in this branch | array | yes |
| [timeouts](#Workflow-Timeouts) | Branch specific timeout settings | object | no |
@@ -4474,11 +4479,11 @@ definitions are mutually exclusive, meaning that you can specify either one or t
```json
{
- "name": "Branch1",
+ "name": "branch-1",
"actions": [
{
"functionRef": {
- "refName": "functionNameOne",
+ "refName": "function-name-one",
"arguments": {
"order": "${ .someParam }"
}
@@ -4486,7 +4491,7 @@ definitions are mutually exclusive, meaning that you can specify either one or t
},
{
"functionRef": {
- "refName": "functionNameTwo",
+ "refName": "function-name-two",
"arguments": {
"order": "${ .someParamTwo }"
}
@@ -4500,14 +4505,14 @@ definitions are mutually exclusive, meaning that you can specify either one or t
```yaml
-name: Branch1
+name: branch-1
actions:
- functionRef:
- refName: functionNameOne
+ refName: function-name-one
arguments:
order: "${ .someParam }"
- functionRef:
- refName: functionNameTwo
+ refName: function-name-two
arguments:
order: "${ .someParamTwo }"
```
@@ -4555,7 +4560,7 @@ For more information, see the [Workflow Error Handling](#Workflow-Error-Handling
Can be either `string` or `object` type. If type string, it defines the name of the workflow starting state.
```json
-"start": "MyStartingState"
+"start": "my-starting-state"
```
In this case it's assumed that the `schedule` property is not defined.
@@ -4564,7 +4569,7 @@ If the start definition is of type `object`, it has the following structure:
| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
-| stateName | Name of the starting workflow state | string | no |
+| stateName | Name of the starting workflow state. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | no |
| [schedule](#Schedule-Definition) | Define the recurring time intervals or cron expressions at which workflow instances should be automatically started. | string or object | yes |
Click to view example definition
@@ -4580,7 +4585,7 @@ If the start definition is of type `object`, it has the following structure:
```json
{
- "stateName": "MyStartingstate",
+ "stateName": "my-starting-state",
"schedule": "2020-03-20T09:00:00Z/PT2H"
}
```
@@ -4589,7 +4594,7 @@ If the start definition is of type `object`, it has the following structure:
```yaml
-stateName: MyStartingstate
+stateName: my-starting-state
schedule: 2020-03-20T09:00:00Z/PT2H
```
@@ -4823,7 +4828,7 @@ If the end definition is of type `object`, it has the following structure:
{
"terminate": true,
"produceEvents": [{
- "eventRef": "provisioningCompleteEvent",
+ "eventRef": "provisioning-complete-event",
"data": "${ .provisionedOrders }"
}]
}
@@ -4835,7 +4840,7 @@ If the end definition is of type `object`, it has the following structure:
```yaml
terminate: true
produceEvents:
-- eventRef: provisioningCompleteEvent
+- eventRef: provisioning-complete-event
data: "${ .provisionedOrders }"
```
@@ -4894,7 +4899,7 @@ before the workflow execution is stopped, and continued as a new workflow instan
```json
{
- "eventRef": "provisioningCompleteEvent",
+ "eventRef": "provisioning-complete-event",
"data": "${ .provisionedOrders }",
"contextAttributes": [{
"buyerId": "${ .buyerId }"
@@ -4906,7 +4911,7 @@ before the workflow execution is stopped, and continued as a new workflow instan
|
```yaml
-eventRef: provisioningCompleteEvent
+eventRef: provisioning-complete-event
data: "${ .provisionedOrders }"
contextAttributes:
- buyerId: "${ .buyerId }"
@@ -5145,12 +5150,12 @@ Let's take a look at an example. To start, let's define a workflow top-level `re
{
"retries": [
{
- "name": "FirstRetryStrategy",
+ "name": "first-retry-strategy",
"delay": "PT1M",
"maxAttempts": 5
},
{
- "name": "SecondRetryStrategy",
+ "name": "second-retry-strategy",
"delay": "PT10M",
"maxAttempts": 10
}
@@ -5163,10 +5168,10 @@ Let's take a look at an example. To start, let's define a workflow top-level `re
```yaml
retries:
- - name: FirstRetryStrategy
+ - name: first-retry-strategy
delay: PT1M
maxAttempts: 5
- - name: SecondRetryStrategy
+ - name: second-retry-strategy
delay: PT10M
maxAttempts: 10
@@ -5190,17 +5195,17 @@ Our `retries` definitions can be referenced by actions. For example:
{
"actions": [
{
- "functionRef": "MyFirstFunction",
- "retryRef": "FirstRetryStrategy",
+ "functionRef": "my-first-function",
+ "retryRef": "first-retry-strategy",
"retryableErrors": ["SomeErrorOne", "SomeErrorTwo"]
},
{
- "functionRef": "MySecondFunction",
- "retryRef": "SecondRetryStrategy",
+ "functionRef": "my-second-function",
+ "retryRef": "second-retry-strategy",
"retryableErrors": ["SomeErrorTwo", "SomeErrorThree"]
},
{
- "functionRef": "MyThirdFunction"
+ "functionRef": "my-third-function"
}
]
}
@@ -5211,17 +5216,17 @@ Our `retries` definitions can be referenced by actions. For example:
```yaml
actions:
- - functionRef: MyFirstFunction
- retryRef: FirstRetryStrategy
+ - functionRef: my-first-function
+ retryRef: first-retry-strategy
nonRetryableErrors:
- SomeErrorOne
- SomeErrorTwo
- - functionRef: MySecondFunction
- retryRef: SecondRetryStrategy
+ - functionRef: my-second-function
+ retryRef: second-retry-strategy
nonRetryableErrors:
- SomeErrorTwo
- SomeErrorThree
- - functionRef: MyThirdFunction
+ - functionRef: my-third-function
```
|
@@ -5283,17 +5288,17 @@ To start, let's define a workflow top-level `retries` definition:
{
"retries": [
{
- "name": "FirstRetryStrategy",
+ "name": "first-retry-strategy",
"delay": "PT1M",
"maxAttempts": 5
},
{
- "name": "SecondRetryStrategy",
+ "name": "second-retry-strategy",
"delay": "PT10M",
"maxAttempts": 10
},
{
- "name": "DoNotRetryStrategy",
+ "name": "no-retry-strategy",
"maxAttempts": 1
}
]
@@ -5305,13 +5310,13 @@ To start, let's define a workflow top-level `retries` definition:
```yaml
retries:
- - name: FirstRetryStrategy
+ - name: first-retry-strategy
delay: PT1M
maxAttempts: 5
- - name: SecondRetryStrategy
+ - name: second-retry-strategy
delay: PT10M
maxAttempts: 10
- - name: DoNotRetryStrategy
+ - name: no-retry-strategy
maxAttempts: 1
```
@@ -5334,21 +5339,21 @@ Our retry definitions can be referenced by state actions. For example:
{
"actions": [
{
- "functionRef": "MyFirstFunction",
- "retryRef": "FirstRetryStrategy",
+ "functionRef": "my-first-function",
+ "retryRef": "first-retry-strategy",
"nonRetryableErrors": ["SomeErrorOne", "SomeErrorTwo"]
},
{
- "functionRef": "MySecondFunction",
- "retryRef": "SecondRetryStrategy",
+ "functionRef": "my-second-function",
+ "retryRef": "second-retry-strategy",
"nonRetryableErrors": ["SomeErrorTwo", "SomeErrorThree"]
},
{
- "functionRef": "MyThirdFunction"
+ "functionRef": "my-thrid-function"
},
{
- "functionRef": "MyFourthFunction",
- "retryRef": "DoNotRetryStrategy"
+ "functionRef": "my-fourth-function",
+ "retryRef": "no-retry-strategy"
}
]
}
@@ -5359,19 +5364,19 @@ Our retry definitions can be referenced by state actions. For example:
```yaml
actions:
- - functionRef: MyFirstFunction
- retryRef: FirstRetryStrategy
+ - functionRef: my-first-function
+ retryRef: first-retry-strategy
nonRetryableErrors:
- SomeErrorOne
- SomeErrorTwo
- - functionRef: MySecondFunction
- retryRef: SecondRetryStrategy
+ - functionRef: my-second-function
+ retryRef: second-retry-strategy
nonRetryableErrors:
- SomeErrorTwo
- SomeErrorThree
- - functionRef: MyThirdFunction
- - functionRef: MyFourthFunction
- retryRef: DoNotRetryStrategy
+ - functionRef: my-third-function
+ - functionRef: my-fourth-function
+ retryRef: no-retry-strategy
```
@@ -5430,7 +5435,7 @@ Now let's say that we have worfklow states "A" and "B". State "A" does not defin
```json
{
- "name": "B",
+ "name": "b",
"type": "operation",
...
"timeouts": {
@@ -5592,7 +5597,7 @@ between arrival of specified events. To give an example, consider the following:
{
"states": [
{
- "name": "ExampleEventState",
+ "name": "example-event-state",
"type": "event",
"exclusive": false,
"timeouts": {
@@ -5601,8 +5606,8 @@ between arrival of specified events. To give an example, consider the following:
"onEvents": [
{
"eventRefs": [
- "ExampleEvent1",
- "ExampleEvent2"
+ "example-event-1",
+ "example-event-2"
],
"actions": [
...
@@ -5676,17 +5681,17 @@ state it references:
{
"states": [
{
- "name": "NewItemPurchase",
+ "name": "new-item-purchase",
"type": "event",
"onEvents": [
{
"eventRefs": [
- "NewPurchase"
+ "new-purchase"
],
"actions": [
{
"functionRef": {
- "refName": "DebitCustomerFunction",
+ "refName": "debit-customer-function",
"arguments": {
"customerid": "${ .purchase.customerid }",
"amount": "${ .purchase.amount }"
@@ -5695,7 +5700,7 @@ state it references:
},
{
"functionRef": {
- "refName": "SendPurchaseConfirmationEmailFunction",
+ "refName": "send-purchase-confirmation-email-function",
"arguments": {
"customerid": "${ .purchase.customerid }"
}
@@ -5704,17 +5709,17 @@ state it references:
]
}
],
- "compensatedBy": "CancelPurchase",
- "transition": "SomeNextWorkflowState"
+ "compensatedBy": "cancel-purchase",
+ "transition": "some-next-workflow-state"
},
{
- "name": "CancelPurchase",
+ "name": "cancel-purchase",
"type": "operation",
"usedForCompensation": true,
"actions": [
{
"functionRef": {
- "refName": "CreditCustomerFunction",
+ "refName": "credit-customer-function",
"arguments": {
"customerid": "${ .purchase.customerid }",
"amount": "${ .purchase.amount }"
@@ -5723,7 +5728,7 @@ state it references:
},
{
"functionRef": {
- "refName": "SendPurchaseCancellationEmailFunction",
+ "refName": "send-purchase-cancellation-email-function",
"arguments": {
"customerid": "${ .purchase.customerid }"
}
@@ -5740,34 +5745,34 @@ state it references:
```yaml
states:
-- name: NewItemPurchase
+- name: new-item-purchase
type: event
onEvents:
- eventRefs:
- - NewPurchase
+ - new-purchase
actions:
- functionRef:
- refName: DebitCustomerFunction
+ refName: debit-customer-function
arguments:
customerid: "${ .purchase.customerid }"
amount: "${ .purchase.amount }"
- functionRef:
- refName: SendPurchaseConfirmationEmailFunction
+ refName: send-purchase-confirmation-email-function
arguments:
customerid: "${ .purchase.customerid }"
- compensatedBy: CancelPurchase
- transition: SomeNextWorkflowState
+ compensatedBy: cancel-purchase
+ transition: some-next-workflow-state
- name: CancelPurchase
type: operation
usedForCompensation: true
actions:
- functionRef:
- refName: CreditCustomerFunction
+ refName: credit-customer-function
arguments:
customerid: "${ .purchase.customerid }"
amount: "${ .purchase.amount }"
- functionRef:
- refName: SendPurchaseCancellationEmailFunction
+ refName: send-purchase-cancellation-email-function
arguments:
customerid: "${ .purchase.customerid }"
```
@@ -5802,7 +5807,7 @@ Let's take a look at each:
{
"transition": {
"compensate": true,
- "nextState": "NextWorkflowState"
+ "nextState": "next-workflow-state"
}
}
```
@@ -5813,7 +5818,7 @@ Let's take a look at each:
```yaml
transition:
compensate: true
- nextState: NextWorkflowState
+ nextState: next-workflow-state
```
|
@@ -6020,18 +6025,18 @@ Here is an example of using constants in Workflow expressions:
...
"states":[
{
- "name":"CheckApplicant",
+ "name":"check-applicant",
"type":"switch",
"dataConditions": [
{
- "name": "Applicant is adult",
+ "name": "applicant-is-adult",
"condition": "${ .applicant | .age >= $CONST.AGE.MIN_ADULT }",
- "transition": "ApproveApplication"
+ "transition": "approve-application"
},
{
- "name": "Applicant is minor",
+ "name": "applicant-is-minor",
"condition": "${ .applicant | .age < $CONST.AGE.MIN_ADULT }",
- "transition": "RejectApplication"
+ "transition": "reject-application"
}
],
...
@@ -6048,12 +6053,12 @@ for example:
{
"functions": [
{
- "name": "isAdult",
+ "name": "is-adult",
"operation": ".applicant | .age >= $CONST.AGE.MIN_ADULT",
"type": "expression"
},
{
- "name": "isMinor",
+ "name": "is-minor",
"operation": ".applicant | .age < $CONST.AGE.MIN_ADULT",
"type": "expression"
}
@@ -6092,7 +6097,7 @@ Here is an example on how to use secrets and pass them as arguments to a functio
...
{
- "refName": "uploadToAzure",
+ "refName": "upload-to-azure",
"arguments": {
"account": "${ $SECRETS.AZURE_STORAGE_ACCOUNT }",
"account-key": "${ $SECRETS.AZURE_STORAGE_KEY }",
@@ -6168,17 +6173,17 @@ Implementations may use this keyword to give access to any relevant information
"name": "Process Sales Orders",
"version": "1.0.0",
"specVersion": "0.8",
- "start": "MyStartingState",
+ "start": "my-starting-state",
"functions": [{
- "name": "myFunction",
+ "name": "my-function",
"operation": "myopenapi.json#myFunction"
}],
"states":[
{
- "name":"MyStartingState",
+ "name":"my-starting-state",
"type":"operation",
"actions": [{
- "functionRef": "myFunction",
+ "functionRef": "my-function",
"args": {
"order": "${ .orderId }",
"callerId": "${ $WORKFLOW.instanceId }"
@@ -6193,6 +6198,14 @@ In this use case, a third-party service may require information from the caller
The specification doesn't define any specific variable within the `WORKFLOW` bucket, but it's considered a reserved keyword.
+### Naming Convention
+
+Identifiable components of a workflow definition, such as states, actions, branches, events and functions define a required non-null `name` property which is based on DNS label names as defined by [RFC 1123](https://datatracker.ietf.org/doc/html/rfc1123#page-13) with further restrictions.
+
+Specifically, `names` must be lowercase, start and end with an alphanumeric character, and consist entirely of alphanumeric characters with optional isolated medial dashes '-' (i.e., dashes must not be adjacent to each other).
+
+The regular expression used in [schemas](/schema/workflow.json) is: `^[a-z0-9](-?[a-z0-9])*$`.
+
## Extensions
The workflow extension mechanism allows you to enhance your model definitions with additional information useful for