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
* feat(spec): add GraphQL service support
Signed-off-by: Nathan Ribeiro <[email protected]>
* feat(graphql): mention workflow expression support for arguments
Signed-off-by: Nathan Ribeiro <[email protected]>
* fix(graphql): add graphql to the type enum on the function definition
Signed-off-by: Nathan Ribeiro <[email protected]>
* fix(graphql): correctly label the JSON for the mutation function def and ref
Signed-off-by: Nathan Ribeiro <[email protected]>
* fix(graphql): removing the word caveat from the spec since we are defining proper usage in the first place
Signed-off-by: Nathan Ribeiro <[email protected]>
* fix(graphql): better wording on various points
Signed-off-by: Nathan Ribeiro <[email protected]>
* small updates to properties so can be validated
Signed-off-by: Tihomir Surdilovic <[email protected]>
Co-authored-by: Tihomir Surdilovic <[email protected]>
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
@@ -36,15 +36,16 @@
36
36
},
37
37
"operation": {
38
38
"type": "string",
39
-
"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
+
"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 `graphql`, <url_to_graphql_endpoint>#<literal \"mutation\" or \"query\">#<query_or_mutation_name>. If type is `expression`, defines the workflow expression.",
40
40
"minLength": 1
41
41
},
42
42
"type": {
43
43
"type": "string",
44
-
"description": "Defines the function type. Is either `rest`, `rpc` or `expression`. Default is `rest`",
44
+
"description": "Defines the function type. Is either `rest`, `rpc`, `graphql` or `expression`. Default is `rest`",
@@ -76,8 +76,8 @@ For more information on the history, development and design rationale behind the
76
76
<imgsrc="media/spec/spec-parts.png"width="600"alt="Serverless Workflow Specification Focus On Standards"/>
77
77
</p>
78
78
79
-
Serverless Workflow language takes advantage of well-established and known standards such as [CloudEvents](https://cloudevents.io/), [OpenApi](https://www.openapis.org/) specifications,
80
-
and [gRPC](https://grpc.io/).
79
+
Serverless Workflow language takes advantage of well-established and known standards such as [CloudEvents](https://cloudevents.io/), [OpenAPI](https://www.openapis.org/) specifications,
80
+
[gRPC](https://grpc.io/) and [GraphQL](https://graphql.org/).
81
81
82
82
## Project Components
83
83
@@ -950,12 +950,13 @@ Merging number types should be done by overwriting the data from events data/act
950
950
951
951
### Workflow Functions
952
952
953
-
Workflow [functions](#Function-Definition) are reusable definitions for RESTful service invocations and/or expression evaluation.
953
+
Workflow [functions](#Function-Definition) are reusable definitions for service invocations and/or expression evaluation.
954
954
They can be referenced by their domain-specific names inside workflow [states](#State-Definition).
955
955
956
956
Reference the following sections to learn more about workflow functions:
957
957
* [Using functions for RESTful service invocations](#Using-Functions-For-RESTful-Service-Invocations)
958
-
* [Using functions for RPC service invocation](#Using-Functions-For-RPC-Service-Invocations)
958
+
* [Using functions for gRPC service invocation](#Using-Functions-For-RPC-Service-Invocations)
959
+
* [Using functions for GraphQL service invocation](#Using-Functions-For-GraphQL-Service-Invocations)
959
960
* [Using functions for expression evaluations](#Using-Functions-For-Expression-Evaluation)
960
961
961
962
### Using Functions For RESTful Service Invocations
@@ -1069,6 +1070,7 @@ In our workflow definition, we can then use function definitions:
1069
1070
```
1070
1071
1071
1072
Note that the `operation` property has the following format:
Expressions must be evaluated before executing the operation.
1222
+
1223
+
Note that GraphQL Subscriptions are not supported at this time.
1224
+
1225
+
For more information about functions, reference the [Functions definitions](#Function-Definition) section.
1226
+
1080
1227
### Using Functions For Expression Evaluation
1081
1228
1082
-
In addition to defining RESTfuland RPC services and their operations, workflow [functions definitions](#Function-Definition)
1229
+
In addition to defining RESTful, RPC and GraphQL services and their operations, workflow [functions definitions](#Function-Definition)
1083
1230
can also be used to define expressions that should be evaluated during workflow execution.
1084
1231
1085
1232
Defining expressions as part of function definitions has the benefit of being able to reference
@@ -1713,7 +1860,7 @@ not obeyed in the workflow definition.
1713
1860
| Parameter | Description | Type | Required |
1714
1861
| --- | --- | --- | --- |
1715
1862
| name | Unique function name | string | yes |
1716
-
| 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 |
1863
+
| 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 `graphql`, <url_to_graphql_endpoint>#<literal \"mutation\" or \"query\">#<query_or_mutation_name>. If type is `expression`, defines the workflow expression. | string | no |
1717
1864
| type | Defines the function type. Is either `rest`, `rpc` or `expression`. Default is `rest` | enum | no |
1718
1865
| [metadata](#Workflow-Metadata) | Metadata information. Can be used to define custom function information | object | no |
1719
1866
@@ -1758,6 +1905,8 @@ Depending on the function `type`, the `operation` property can be:
1758
1905
For example `https://petstore.swagger.io/v2/swagger.json#getPetById`.
1759
1906
* 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 '#'.
1760
1907
For example `file://myuserservice.proto#UserService#ListUsers`.
1908
+
* If `type` is `graphql`, a combination of the GraphQL schema definition URI and the particular service name and service method name that needs to be invoked, separated by a '#'.
1909
+
For example `file://myuserservice.proto#UserService#ListUsers`.
1761
1910
* If `type` is `expression`, defines the expression syntax. Take a look at the [workflow expressions section](#Workflow-Expressions) for more information on this.
1762
1911
1763
1912
The [`metadata`](#Workflow-Metadata) property allows users to define custom information to function definitions.
@@ -2458,7 +2607,10 @@ it with its `object` type which has the following properties:
2458
2607
| Parameter | Description | Type | Required |
2459
2608
| --- | --- | --- | --- |
2460
2609
| refName | Name of the referenced [function](#Function-Definition) | string | yes |
2461
-
| arguments | Arguments to be passed to the referenced function | object | no |
2610
+
| arguments | Arguments (inputs) to be passed to the referenced function | object | yes if function type is `graphql`, otherwise no |
2611
+
| 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 |
2612
+
2613
+
tihomir
2462
2614
2463
2615
<details><summary><strong>Click to view example definition</strong></summary>
2464
2616
<p>
@@ -2496,15 +2648,18 @@ arguments:
2496
2648
</details>
2497
2649
2498
2650
The `refName` property is the name of the referenced [function](#Function-Definition).
2651
+
2499
2652
The `arguments` property defines the arguments that are to be passed to the referenced function.
2500
-
Values of the `arguments` property can be either static values, or an expression, for example:
2653
+
Here is an example of using the `arguments` property:
2501
2654
2502
2655
```json
2503
2656
{
2504
2657
"refName": "checkFundsAvailabe",
2505
2658
"arguments": {
2506
-
"account": "${ .accountId }",
2507
-
"forAmount": "${.payment.amount }",
2659
+
"account": {
2660
+
"id": "${ .accountId }"
2661
+
},
2662
+
"forAmount": "${ .payment.amount }",
2508
2663
"insufficientMessage": "The requested amount is not available."
0 commit comments