Skip to content

Commit 473ebd3

Browse files
author
Tihomir Surdilovic
authored
Merge pull request #18 from tsurdilo/functionsdefupdate
Update for function definitions (openapi)
2 parents eab70b0 + 341be6f commit 473ebd3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+94
-124
lines changed

api/src/main/resources/schema/functions/functiondef.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,16 @@
77
"description": "Function unique name",
88
"minLength": 1
99
},
10-
"resource": {
10+
"operation": {
1111
"type": "string",
12-
"description": "Function resource (URI)"
13-
},
14-
"type": {
15-
"type": "string",
16-
"description": "Type of function to implement. Can be defined by implementations",
12+
"description": "Combination of the function/service OpenAPI definition URI and the operationID of the operation that needs to be invoked, separated by a '#'. For example 'https://petstore.swagger.io/v2/swagger.json#getPetById'",
1713
"minLength": 1
1814
},
1915
"metadata": {
2016
"$ref": "../metadata/metadata.json"
2117
}
2218
},
2319
"required": [
24-
"name",
25-
"resource"
20+
"name"
2621
]
2722
}

api/src/main/resources/schema/states/switchstate.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"description": "If eventConditions is used, defines the time period to wait for events (ISO 8601 format)"
3131
},
3232
"default": {
33+
"description": "Default transition of the workflow if there is no matching data conditions. Can include a transition or end definition",
3334
"$ref": "../default/defaultdef.json"
3435
}
3536
},

api/src/test/java/io/serverlessworkflow/api/test/WorkflowToMarkupTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public void testSingleFunction() {
6363

6464
Workflow workflow = new Workflow().withId("test-workflow").withName("test-workflow-name").withVersion("1.0")
6565
.withFunctions(new Functions(Arrays.asList(
66-
new FunctionDefinition().withName("testFunction").withResource("testResource").withType("testType")))
66+
new FunctionDefinition().withName("testFunction")
67+
.withOperation("testSwaggerDef#testOperationId")))
6768
)
6869
.withStates(Arrays.asList(
6970
new DelayState().withName("delayState").withType(DELAY)
@@ -98,7 +99,8 @@ public void testSingleEvent() {
9899
.withKind(EventDefinition.Kind.PRODUCED)))
99100
)
100101
.withFunctions(new Functions(Arrays.asList(
101-
new FunctionDefinition().withName("testFunction").withResource("testResource").withType("testType")))
102+
new FunctionDefinition().withName("testFunction")
103+
.withOperation("testSwaggerDef#testOperationId")))
102104
)
103105
.withStates(Arrays.asList(
104106
new DelayState().withName("delayState").withType(DELAY)

api/src/test/resources/examples/applicantrequest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"functions": [
77
{
88
"name": "sendRejectionEmailFunction",
9-
"resource": "functionResourse"
9+
"operation": "http://myapis.org/applicationapi.json#emailRejection"
1010
}
1111
],
1212
"states":[

api/src/test/resources/examples/applicantrequest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Applicant Request Decision Workflow
55
description: Determine if applicant request is valid
66
functions:
77
- name: sendRejectionEmailFunction
8-
resource: functionResourse
8+
operation: http://myapis.org/applicationapi.json#emailRejection
99
states:
1010
- name: CheckApplication
1111
type: switch

api/src/test/resources/examples/carauctionbids.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"functions": [
77
{
88
"name": "StoreBidFunction",
9-
"resource": "storeBidResource",
10-
"type": "function"
9+
"operation": "http://myapis.org/carauctionapi.json#storeBid"
1110
}
1211
],
1312
"events": [

api/src/test/resources/examples/carauctionbids.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ name: Car Auction Bidding Workflow
44
description: Store a single bid whole the car auction is active
55
functions:
66
- name: StoreBidFunction
7-
resource: storeBidResource
8-
type: function
7+
operation: http://myapis.org/carauctionapi.json#storeBid
98
events:
109
- name: CarBidEvent
1110
type: carBidMadeType

api/src/test/resources/examples/creditcheck.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
"description": "Perform Customer Credit Check",
66
"functions": [
77
{
8-
"name": "callCreditCheckMicroservice",
9-
"resource": "creditCheckResource",
10-
"type": "microservice"
8+
"name": "creditCheckFunction",
9+
"operation": "http://myapis.org/creditcheckapi.json#doCreditCheck"
1110
},
1211
{
1312
"name": "sendRejectionEmailFunction",
14-
"resource": "rejectEmailResource"
13+
"operation": "http://myapis.org/creditcheckapi.json#rejectionEmail"
1514
}
1615
],
1716
"events": [

api/src/test/resources/examples/creditcheck.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ version: '1.0'
44
name: Customer Credit Check Workflow
55
description: Perform Customer Credit Check
66
functions:
7-
- name: callCreditCheckMicroservice
8-
resource: creditCheckResource
9-
type: microservice
7+
- name: creditCheckFunction
8+
operation: http://myapis.org/creditcheckapi.json#doCreditCheck
109
- name: sendRejectionEmailFunction
11-
resource: rejectEmailResource
10+
operation: http://myapis.org/creditcheckapi.json#rejectionEmail
1211
events:
1312
- name: CreditCheckCompletedEvent
1413
type: creditCheckCompleteType

api/src/test/resources/examples/eventbasedgreeting.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"functions": [
1414
{
1515
"name": "greetingFunction",
16-
"resource": "functionResourse"
16+
"operation": "file://myapis/greetingapis.json#greeting"
1717
}
1818
],
1919
"states":[

0 commit comments

Comments
 (0)