Skip to content

Commit 16a331a

Browse files
authored
Merge pull request serverlessworkflow#975 from neuroglia-io/fix-930-endpoint-factoring
Consolidate `endpoint` and `externalResource` definitions
2 parents 996b0c4 + 65bf9e1 commit 16a331a

File tree

5 files changed

+59
-62
lines changed

5 files changed

+59
-62
lines changed

ctk/features/call.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Feature: Call Task
103103
call: openapi
104104
with:
105105
document:
106-
uri: "https://petstore.swagger.io/v2/swagger.json"
106+
endpoint: "https://petstore.swagger.io/v2/swagger.json"
107107
operation: findPetsByStatus
108108
parameters:
109109
status: ${ .status }
@@ -131,7 +131,7 @@ Feature: Call Task
131131
call: openapi
132132
with:
133133
document:
134-
uri: "https://petstore.swagger.io/v2/swagger.json"
134+
endpoint: "https://petstore.swagger.io/v2/swagger.json"
135135
operation: getPetById
136136
parameters:
137137
petId: ${ .petId }

dsl-reference.md

+16-12
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
+ [Export](#export)
5050
+ [Timeout](#timeout)
5151
+ [Duration](#duration)
52+
+ [Endpoint](#endpoint)
5253
+ [HTTP Response](#http-response)
5354
+ [HTTP Request](#http-request)
5455
+ [URI Template](#uri-template)
@@ -177,7 +178,7 @@ use:
177178
call: openapi
178179
with:
179180
document:
180-
uri: https://petstore.swagger.io/v2/swagger.json
181+
endpoint: https://petstore.swagger.io/v2/swagger.json
181182
operationId: findByStatus
182183
parameters:
183184
status: available
@@ -314,7 +315,8 @@ do:
314315
- findPet:
315316
call: asyncapi
316317
with:
317-
document: https://fake.com/docs/asyncapi.json
318+
document:
319+
endpoint: https://fake.com/docs/asyncapi.json
318320
operationRef: findPetsByStatus
319321
server: staging
320322
message: getPetByStatusQuery
@@ -351,7 +353,8 @@ do:
351353
- greet:
352354
call: grpc
353355
with:
354-
proto: file://app/greet.proto
356+
proto:
357+
endpoint: file://app/greet.proto
355358
service:
356359
name: GreeterApi.Greeter
357360
host: localhost
@@ -418,7 +421,8 @@ do:
418421
- findPet:
419422
call: openapi
420423
with:
421-
document: https://petstore.swagger.io/v2/swagger.json
424+
document:
425+
endpoint: https://petstore.swagger.io/v2/swagger.json
422426
operationId: findPetsByStatus
423427
parameters:
424428
status: available
@@ -1079,18 +1083,18 @@ Defines an external resource.
10791083
| Property | Type | Required | Description |
10801084
|----------|:----:|:--------:|-------------|
10811085
| name | `string` | `no` | The name, if any, of the defined resource. |
1082-
| uri | [`uri-template`](#uri-template) | `yes` | The URI at which to get the defined resource. |
1083-
| authentication | [`authentication`](#authentication) | `no` | The authentication policy, or the name of the authentication policy, to use when fecthing the resource. |
1086+
| endpoint | [`endpoint`](#endpoint) | `yes` | The endpoint at which to get the defined resource. |
10841087

10851088
##### Examples
10861089

10871090
```yaml
10881091
name: sample-resource
1089-
uri: https://fake.com/resource/0123
1090-
authentication:
1091-
basic:
1092-
username: admin
1093-
password: 1234
1092+
endpoint:
1093+
uri: https://fake.com/resource/0123
1094+
authentication:
1095+
basic:
1096+
username: admin
1097+
password: 1234
10941098
```
10951099

10961100
### Authentication
@@ -1611,7 +1615,7 @@ document:
16111615
```yaml
16121616
format: json
16131617
resource:
1614-
uri: https://test.com/fake/schema/json/document.json
1618+
endpoint: https://test.com/fake/schema/json/document.json
16151619
```
16161620

16171621
### Timeout

examples/accumulate-room-readings.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ do:
3131
call: openapi
3232
with:
3333
document:
34-
uri: http://myorg.io/ordersservices.json
34+
endpoint: http://myorg.io/ordersservices.json
3535
operationId: logreading
3636
- generateReport:
3737
call: openapi
3838
with:
3939
document:
40-
uri: http://myorg.io/ordersservices.json
40+
endpoint: http://myorg.io/ordersservices.json
4141
operationId: produceReport
4242
timeout:
4343
after:

examples/asyncapi.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ do:
88
call: asyncapi
99
with:
1010
document:
11-
uri: https://fake.com/docs/asyncapi.json
11+
endpoint: https://fake.com/docs/asyncapi.json
1212
operationRef: findPetsByStatus
1313
server: staging
1414
message: getPetByStatusQuery

schema/workflow.yaml

+38-45
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,7 @@ $defs:
314314
endpoint:
315315
title: WithHTTPEndpoint
316316
description: The HTTP endpoint to send the request to.
317-
oneOf:
318-
- $ref: '#/$defs/endpoint'
319-
- $ref: '#/$defs/runtimeExpression'
320-
- title: LiteralEndpoint
321-
type: string
322-
format: uri-template
317+
$ref: '#/$defs/endpoint'
323318
headers:
324319
type: object
325320
title: WithHTTPHeaders
@@ -1008,27 +1003,33 @@ $defs:
10081003
description: A human-readable explanation specific to this occurrence of the error.
10091004
required: [ type, status, instance ]
10101005
endpoint:
1011-
type: object
10121006
title: Endpoint
10131007
description: Represents an endpoint.
1014-
unevaluatedProperties: false
1015-
properties:
1016-
uri:
1017-
title: EndpointUri
1018-
description: The endpoint's URI.
1019-
oneOf:
1020-
- title: LiteralEndpointURI
1021-
description: The literal endpoint's URI.
1022-
type: string
1023-
format: uri-template
1024-
- $ref: '#/$defs/runtimeExpression'
1025-
title: ExpressionEndpointURI
1026-
description: An expression based endpoint's URI.
1027-
authentication:
1028-
$ref: '#/$defs/referenceableAuthenticationPolicy'
1029-
title: EndpointAuthentication
1030-
description: The authentication policy to use.
1031-
required: [ uri ]
1008+
oneOf:
1009+
- $ref: '#/$defs/runtimeExpression'
1010+
- title: LiteralEndpoint
1011+
type: string
1012+
format: uri-template
1013+
- title: EndpointConfiguration
1014+
type: object
1015+
unevaluatedProperties: false
1016+
properties:
1017+
uri:
1018+
title: EndpointUri
1019+
description: The endpoint's URI.
1020+
oneOf:
1021+
- title: LiteralEndpointURI
1022+
description: The literal endpoint's URI.
1023+
type: string
1024+
format: uri-template
1025+
- $ref: '#/$defs/runtimeExpression'
1026+
title: ExpressionEndpointURI
1027+
description: An expression based endpoint's URI.
1028+
authentication:
1029+
$ref: '#/$defs/referenceableAuthenticationPolicy'
1030+
title: EndpointAuthentication
1031+
description: The authentication policy to use.
1032+
required: [ uri ]
10321033
eventProperties:
10331034
type: object
10341035
title: EventProperties
@@ -1162,28 +1163,20 @@ $defs:
11621163
description: The task(s) to execute after the extended task, if any.
11631164
required: [ extend ]
11641165
externalResource:
1166+
type: object
11651167
title: ExternalResource
11661168
description: Represents an external resource.
1167-
oneOf:
1168-
- type: string
1169-
format: uri-template
1170-
- title: ExternalResourceURI
1171-
type: object
1172-
unevaluatedProperties: false
1173-
properties:
1174-
uri:
1175-
type: string
1176-
format: uri-template
1177-
title: ExternalResourceURIEndpoint
1178-
description: The endpoint's URI.
1179-
authentication:
1180-
$ref: '#/$defs/referenceableAuthenticationPolicy'
1181-
title: ExternalResourceURIAuthentication
1182-
description: The authentication policy to use.
1183-
name:
1184-
type: string
1185-
description: The external resource's name, if any.
1186-
required: [ uri ]
1169+
unevaluatedProperties: false
1170+
properties:
1171+
name:
1172+
type: string
1173+
title: ExternalResourceName
1174+
description: The name of the external resource, if any.
1175+
endpoint:
1176+
$ref: '#/$defs/endpoint'
1177+
title: ExternalResourceEndpoint
1178+
description: The endpoint of the external resource.
1179+
required: [ endpoint ]
11871180
input:
11881181
type: object
11891182
title: Input

0 commit comments

Comments
 (0)