You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: schema/functions.json
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -35,14 +35,15 @@
35
35
},
36
36
"operation": {
37
37
"type": "string",
38
-
"description": "If type `rest`, combination of the function/service OpenAPI definition URI and the operationID of the operation that needs to be invoked, separated by a '#'. If type is `expression` defines the workflow expression.",
38
+
"description": "If type is `rest`, <path_to_openapi_definition>#<operation_id>. If type is `rpc`, <path_to_grpc_proto_file>#<service_name>#<service_method>. If type is `expression`, defines the workflow expression.",
39
39
"minLength": 1
40
40
},
41
41
"type": {
42
42
"type": "string",
43
-
"description": "Defines the function type. Is either `rest` or `expression`. Default is `rest`",
43
+
"description": "Defines the function type. Is either `rest`, `rpc` or `expression`. Default is `rest`",
Copy file name to clipboardExpand all lines: specification.md
+75-18Lines changed: 75 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,8 @@ For more information on the history, development and design rationale behind the
75
75
<imgsrc="media/spec/spec-parts.png"width="600"alt="Serverless Workflow Specification Focus On Standards"/>
76
76
</p>
77
77
78
-
Serverless Workflow language takes advantage of well-established and known standards such as [CloudEvents](https://cloudevents.io/) and [OpenApi](https://www.openapis.org/) specifications.
78
+
Serverless Workflow language takes advantage of well-established and known standards such as [CloudEvents](https://cloudevents.io/), [OpenApi](https://www.openapis.org/) specifications,
79
+
and [gRPC](https://grpc.io/).
79
80
80
81
## Project Components
81
82
@@ -172,6 +173,7 @@ They can be referenced by their domain-specific names inside workflow [states](#
172
173
173
174
Reference the following sections to learn more about workflow functions:
174
175
*[Using functions for RESTful service invocations](#Using-Functions-For-RESTful-Service-Invocations)
176
+
*[Using functions for RPC service invocation](#Using-Functions-For-RPC-Service-Invocations)
175
177
*[Using functions for expression evaluations](#Using-Functions-For-Expression-Evaluation)
176
178
177
179
### Using Functions For RESTful Service Invocations
@@ -186,22 +188,17 @@ To learn more about that, please reference the [event definitions](#Event-Defini
186
188
as well as the [actions definitions](#Action-Definition)[eventRef](#EventRef-Definition) property.
187
189
188
190
Because of an overall lack of a common way to describe different services and their operations,
189
-
workflow markups typically chose to define custom function definitions.
190
-
This approach often runs into issues such as lack of markup portability, limited capabilities, as well as
191
-
forces non-workflow-specific information such as service authentication to be added inside workflow markup.
191
+
many workflow languages typically chose to define custom function definitions.
192
+
This approach however often runs into issues such as lack of portability, limited capabilities, as well as
193
+
forcing non-workflow-specific information, such as service authentication, to be added inside the workflow language.
192
194
193
195
To avoid these issues, the Serverless Workflow specification mandates that details about
194
196
RESTful services and their operations be described using the [OpenAPI Specification](https://www.openapis.org/) specification.
195
197
OpenAPI is a language-agnostic standard that describes discovery of RESTful services.
196
198
This allows Serverless Workflow language to describe RESTful services in a portable
197
199
way, as well as workflow runtimes to utilize OpenAPI tooling and APIs to invoke service operations.
198
200
199
-
The workflow markup allows defining non-restful services and their operations using the `metadata` property
200
-
of [functions definitions](#Function-Definition). Note that using the function definitions `metadata` to add proprietary
201
-
information about service execution can break the portability of the workflow language, meaning your
202
-
workflow model may not be executable on different platforms that do not understand it.
203
-
204
-
Here is an example function definition for a service operation.
201
+
Here is an example function definition for a RESTful service operation.
205
202
206
203
```json
207
204
{
@@ -234,14 +231,74 @@ For example:
234
231
```
235
232
236
233
Note that the referenced function definition type in this case must be `rest` (default type).
237
-
If the referenced function definition type is `expression`, this should be regarded as
238
-
an error during parsing of the workflow definition.
234
+
235
+
For more information about functions, reference the [Functions definitions](#Function-Definition) section.
236
+
237
+
### Using Functions For RPC Service Invocations
238
+
239
+
Similar to defining invocations of operations on RESTful services, you can also use the workflow
240
+
[functions definitions](#Function-Definition) that follow the remote procedure call (RPC) protocol.
241
+
For RPC invocations, the Serverless Workflow specification mandates that they are described using [gRPC](https://grpc.io/),
242
+
a widely used RPC system.
243
+
gRPC uses [Protocol Buffers](https://developers.google.com/protocol-buffers/docs/overview) to define messages, services,
244
+
and the methods on those services that can be invoked.
245
+
246
+
Let's look at an example of invoking a service method using RPC. For this example let's say we have the following
247
+
gRP prototocol buffer definition in a myuserservice.proto file:
Note that the referenced function definition type in this case must be `rpc`.
239
296
240
297
For more information about functions, reference the [Functions definitions](#Function-Definition) section.
241
298
242
299
### Using Functions For Expression Evaluation
243
300
244
-
In addition to defining RESTful service operations, workflow [functions definitions](#Function-Definition)
301
+
In addition to defining RESTful and RPC services and their operations, workflow [functions definitions](#Function-Definition)
245
302
can also be used to define expressions that should be evaluated during workflow execution.
246
303
247
304
Defining expressions as part of function definitions has the benefit of being able to reference
@@ -303,9 +360,7 @@ Our expression function definitions can now be referenced by workflow states whe
303
360
}
304
361
```
305
362
306
-
Note that the used function definition type in this case must be `expression` .
307
-
If the referenced function definition type is `rest` (default), this should be regarded as
308
-
an error during parsing of the workflow definition.
363
+
Note that the used function definition type in this case must be `expression`.
309
364
310
365
For more information about functions, reference the [Functions definitions](#Function-Definition) section.
311
366
@@ -695,8 +750,8 @@ not obeyed in the workflow definition.
695
750
| Parameter | Description | Type | Required |
696
751
| --- | --- | --- | --- |
697
752
| name | Unique function name | string | yes |
698
-
| operation | If type `rest`, combination of the function/service OpenAPI definition URI and the operationID of the operation that needs to be invoked, separated by a '#'. If type is `expression` defines the workflow expression. | string | no |
699
-
| type | Defines the function type. Is either `rest` or `expression`. Default is `rest` | enum | no |
753
+
| operation | If type is `rest`, <path_to_openapi_definition>#<operation_id>. If type is `rpc`, <path_to_grpc_proto_file>#<service_name>#<service_method>. If type is `expression`, defines the workflow expression. | string | no |
754
+
| type | Defines the function type. Is either `rest`, `rpc` or `expression`. Default is `rest` | enum | no |
700
755
| [metadata](#Workflow-Metadata) | Metadata information. Can be used to define custom function information | object | no |
701
756
702
757
<details><summary><strong>Click to view example definition</strong></summary>
@@ -738,6 +793,8 @@ The `type` property defines the function type. Its value can be either `rest` or
738
793
Depending on the function `type`, the `operation` property can be:
739
794
* If `type` is `rest`, a combination of the function/service OpenAPI definition document URI and the particular service operation that needs to be invoked, separated by a '#'.
740
795
For example `https://petstore.swagger.io/v2/swagger.json#getPetById`.
796
+
* If `type` is `rpc`, a combination of the gRPC proto document URI and the particular service name and service method name that needs to be invoked, separated by a '#'.
797
+
For example `file://myuserservice.proto#UserService#ListUsers`.
741
798
* If `type` is `expression`, defines the expression syntax. Take a look at the [workflow expressions section](#Workflow-Expressions) for more information on this.
742
799
743
800
The [`metadata`](#Workflow-Metadata) property allows users to define custom information to function definitions.
0 commit comments