Skip to content

Commit f4b2c47

Browse files
authored
Merge branch 'main' into Adding_title_to_switch
2 parents 0d4d658 + 2c38baf commit f4b2c47

File tree

4 files changed

+119
-81
lines changed

4 files changed

+119
-81
lines changed

dsl-reference.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ do:
192192
method: post
193193
endpoint:
194194
uri: https://fake.smtp.service.com/email/send
195-
authentication: petStoreOAuth2
195+
authentication:
196+
use: petStoreOAuth2
196197
body:
197198
198199
to: ${ .order.client.email }
@@ -438,14 +439,24 @@ document:
438439
namespace: test
439440
name: do-example
440441
version: '0.1.0'
442+
use:
443+
authentications:
444+
fake-booking-agency-oauth2:
445+
oauth2:
446+
authority: https://fake-booking-agency.com
447+
grant: client_credentials
448+
client:
449+
id: serverless-workflow-runtime
450+
secret: secret0123456789
441451
do:
442452
- bookHotel:
443453
call: http
444454
with:
445455
method: post
446456
endpoint:
447457
uri: https://fake-booking-agency.com/hotels/book
448-
authentication: fake-booking-agency-oauth2
458+
authentication:
459+
use: fake-booking-agency-oauth2
449460
body:
450461
name: Four Seasons
451462
city: Antwerp
@@ -456,7 +467,8 @@ do:
456467
method: post
457468
endpoint:
458469
uri: https://fake-booking-agency.com/flights/book
459-
authentication: fake-booking-agency-oauth2
470+
authentication:
471+
use: fake-booking-agency-oauth2
460472
body:
461473
departure:
462474
date: '01/01/26'
@@ -1083,6 +1095,7 @@ Defines the mechanism used to authenticate users and workflows attempting to acc
10831095

10841096
| Property | Type | Required | Description |
10851097
|----------|:----:|:--------:|-------------|
1098+
| use | `string` | `no` | The name of the top-level authentication definition to use. Cannot be used by authentication definitions defined at top level. |
10861099
| basic | [`basicAuthentication`](#basic-authentication) | `no` | The `basic` authentication scheme to use, if any.<br>Required if no other property has been set, otherwise ignored. |
10871100
| bearer | [`bearerAuthentication`](#bearer-authentication) | `no` | The `bearer` authentication scheme to use, if any.<br>Required if no other property has been set, otherwise ignored. |
10881101
| certificate | [`certificateAuthentication`](#certificate-authentication) | `no` | The `certificate` authentication scheme to use, if any.<br>Required if no other property has been set, otherwise ignored. |
@@ -1102,15 +1115,17 @@ use:
11021115
- usernamePasswordSecret
11031116
authentication:
11041117
sampleBasicFromSecret:
1105-
basic: usernamePasswordSecret
1118+
basic:
1119+
use: usernamePasswordSecret
11061120
do:
11071121
- sampleTask:
11081122
call: http
11091123
with:
11101124
method: get
11111125
endpoint:
11121126
uri: https://secured.fake.com/sample
1113-
authentication: sampleBasicFromSecret
1127+
authentication:
1128+
use: sampleBasicFromSecret
11141129
```
11151130

11161131
#### Basic Authentication
@@ -1133,19 +1148,20 @@ document:
11331148
name: basic-authentication-example
11341149
version: '0.1.0'
11351150
use:
1136-
authentication:
1151+
authentications:
11371152
sampleBasic:
11381153
basic:
11391154
username: admin
1140-
password: 123
1155+
password: password123
11411156
do:
11421157
- sampleTask:
11431158
call: http
11441159
with:
11451160
method: get
11461161
endpoint:
11471162
uri: https://secured.fake.com/sample
1148-
authentication: sampleBasic
1163+
authentication:
1164+
use: sampleBasic
11491165
```
11501166

11511167
#### Bearer Authentication
@@ -1486,8 +1502,7 @@ When set, runtimes must validate output data against the defined schema, unless
14861502
| Property | Type | Required | Description |
14871503
|----------|:----:|:--------:|-------------|
14881504
| schema | [`schema`](#schema) | `no` | The [`schema`](#schema) used to describe and validate output data.<br>*Even though the schema is not required, it is strongly encouraged to document it, whenever feasible.* |
1489-
| from | `string`<br>`object` | `no` | A [runtime expression](#runtime-expressions), if any, used to filter and/or mutate the workflow/task output. |
1490-
| to | `string`<br>`object` | `no` | A [runtime expression](#runtime-expressions), if any, used to update the context, using both output and context data. |
1505+
| as | `string`<br>`object` | `no` | A [runtime expression](#runtime-expressions), if any, used to filter and/or mutate the workflow/task output. |
14911506

14921507
#### Examples
14931508

dsl.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ When the evaluation of an expression fails, runtimes **must** raise an error wit
204204
|:-----|:----:|:------------|
205205
| context | `map` | The task's context data. |
206206
| input | `any` | The task's filtered input. |
207+
| secrets | `map` | A key/value map of the workflow secrets.<br>To avoid unintentional bleeding, secrets can only be used in the `input.from` runtime expression. |
207208
| task | [`taskDescriptor`](#task-descriptor) | Describes the current task. |
208209
| workflow | [`workflowDescritor`](#workflow-descriptor) | Describes the current workflow. |
209210

examples/use-authentication.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ do:
1515
method: get
1616
endpoint:
1717
uri: https://petstore.swagger.io/v2/pet/{petId}
18-
authentication: petStoreAuth
18+
authentication:
19+
use: petStoreAuth

schema/workflow.yaml

Lines changed: 91 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,8 @@ $defs:
181181
type: object
182182
description: The payload to call the AsyncAPI operation with, if any.
183183
authentication:
184+
$ref: '#/$defs/referenceableAuthenticationPolicy'
184185
description: The authentication policy, if any, to use when calling the AsyncAPI operation.
185-
oneOf:
186-
- $ref: '#/$defs/authenticationPolicy'
187-
- type: string
188186
required: [ document, operationRef ]
189187
additionalProperties: false
190188
description: Defines the AsyncAPI call to perform.
@@ -220,10 +218,8 @@ $defs:
220218
max: 65535
221219
description: The port number of the GRPC service to call.
222220
authentication:
221+
$ref: '#/$defs/referenceableAuthenticationPolicy'
223222
description: The endpoint's authentication policy, if any.
224-
oneOf:
225-
- $ref: '#/$defs/authenticationPolicy'
226-
- type: string
227223
required: [ name, host ]
228224
method:
229225
type: string
@@ -293,10 +289,8 @@ $defs:
293289
additionalProperties: true
294290
description: A name/value mapping of the parameters of the OpenAPI operation to call.
295291
authentication:
292+
$ref: '#/$defs/referenceableAuthenticationPolicy'
296293
description: The authentication policy, if any, to use when calling the OpenAPI operation.
297-
oneOf:
298-
- $ref: '#/$defs/authenticationPolicy'
299-
- type: string
300294
output:
301295
type: string
302296
enum: [ raw, content, response ]
@@ -633,79 +627,104 @@ $defs:
633627
enum: [ continue, exit, end ]
634628
default: continue
635629
- type: string
630+
referenceableAuthenticationPolicy:
631+
type: object
632+
oneOf:
633+
- title: AuthenticationPolicyReference
634+
properties:
635+
use:
636+
type: string
637+
minLength: 1
638+
description: The name of the authentication policy to use
639+
required: [use]
640+
- $ref: '#/$defs/authenticationPolicy'
641+
secretBasedAuthenticationPolicy:
642+
type: object
643+
properties:
644+
use:
645+
type: string
646+
minLength: 1
647+
description: The name of the authentication policy to use
648+
required: [use]
636649
authenticationPolicy:
637650
type: object
638651
oneOf:
639652
- title: BasicAuthenticationPolicy
640653
properties:
641654
basic:
642655
type: object
643-
properties:
644-
username:
645-
type: string
646-
description: The username to use.
647-
password:
648-
type: string
649-
description: The password to use.
650-
required: [ username, password ]
656+
oneOf:
657+
- properties:
658+
username:
659+
type: string
660+
description: The username to use.
661+
password:
662+
type: string
663+
description: The password to use.
664+
required: [ username, password ]
665+
- $ref: '#/$defs/secretBasedAuthenticationPolicy'
651666
required: [ basic ]
652667
description: Use basic authentication.
653668
- title: BearerAuthenticationPolicy
654669
properties:
655670
bearer:
656671
type: object
657-
properties:
658-
token:
659-
type: string
660-
description: The bearer token to use.
661-
required: [ token ]
672+
oneOf:
673+
- properties:
674+
token:
675+
type: string
676+
description: The bearer token to use.
677+
required: [ token ]
678+
- $ref: '#/$defs/secretBasedAuthenticationPolicy'
662679
required: [ bearer ]
663680
description: Use bearer authentication.
664681
- title: OAuth2AuthenticationPolicy
665682
properties:
666683
oauth2:
667684
type: object
668-
properties:
669-
authority:
670-
type: string
671-
format: uri
672-
description: The URI that references the OAuth2 authority to use.
673-
grant:
674-
type: string
675-
description: The grant type to use.
676-
client:
677-
type: object
678-
properties:
679-
id:
685+
oneOf:
686+
- properties:
687+
authority:
680688
type: string
681-
description: The client id to use.
682-
secret:
689+
format: uri
690+
description: The URI that references the OAuth2 authority to use.
691+
grant:
683692
type: string
684-
description: The client secret to use, if any.
685-
required: [ id ]
686-
scopes:
687-
type: array
688-
items:
689-
type: string
690-
description: The scopes, if any, to request the token for.
691-
audiences:
692-
type: array
693-
items:
694-
type: string
695-
description: The audiences, if any, to request the token for.
696-
username:
697-
type: string
698-
description: The username to use. Used only if the grant type is Password.
699-
password:
700-
type: string
701-
description: The password to use. Used only if the grant type is Password.
702-
subject:
703-
$ref: '#/$defs/oauth2Token'
704-
description: The security token that represents the identity of the party on behalf of whom the request is being made.
705-
actor:
706-
$ref: '#/$defs/oauth2Token'
707-
description: The security token that represents the identity of the acting party.
708-
required: [ authority, grant, client ]
693+
description: The grant type to use.
694+
client:
695+
type: object
696+
properties:
697+
id:
698+
type: string
699+
description: The client id to use.
700+
secret:
701+
type: string
702+
description: The client secret to use, if any.
703+
required: [ id ]
704+
scopes:
705+
type: array
706+
items:
707+
type: string
708+
description: The scopes, if any, to request the token for.
709+
audiences:
710+
type: array
711+
items:
712+
type: string
713+
description: The audiences, if any, to request the token for.
714+
username:
715+
type: string
716+
description: The username to use. Used only if the grant type is Password.
717+
password:
718+
type: string
719+
description: The password to use. Used only if the grant type is Password.
720+
subject:
721+
$ref: '#/$defs/oauth2Token'
722+
description: The security token that represents the identity of the party on behalf of whom the request is being made.
723+
actor:
724+
$ref: '#/$defs/oauth2Token'
725+
description: The security token that represents the identity of the acting party.
726+
required: [ authority, grant, client ]
727+
- $ref: '#/$defs/secretBasedAuthenticationPolicy'
709728
required: [ oauth2 ]
710729
description: Use OAUTH2 authentication.
711730
description: Defines an authentication policy.
@@ -768,10 +787,8 @@ $defs:
768787
format: uri-template
769788
description: The endpoint's URI.
770789
authentication:
790+
$ref: '#/$defs/referenceableAuthenticationPolicy'
771791
description: The authentication policy to use.
772-
oneOf:
773-
- $ref: '#/$defs/authenticationPolicy'
774-
- type: string
775792
required: [ uri ]
776793
eventConsumptionStrategy:
777794
type: object
@@ -871,10 +888,8 @@ $defs:
871888
format: uri
872889
description: The endpoint's URI.
873890
authentication:
891+
$ref: '#/$defs/referenceableAuthenticationPolicy'
874892
description: The authentication policy to use.
875-
oneOf:
876-
- $ref: '#/$defs/authenticationPolicy'
877-
- type: string
878893
name:
879894
type: string
880895
description: The external resource's name, if any.
@@ -886,7 +901,9 @@ $defs:
886901
$ref: '#/$defs/schema'
887902
description: The schema used to describe and validate the input of the workflow or task.
888903
from:
889-
type: string
904+
oneOf:
905+
- type: string
906+
- type: object
890907
description: A runtime expression, if any, used to mutate and/or filter the input of the workflow or task.
891908
description: Configures the input of a workflow or task.
892909
output:
@@ -896,7 +913,9 @@ $defs:
896913
$ref: '#/$defs/schema'
897914
description: The schema used to describe and validate the output of the workflow or task.
898915
as:
899-
type: string
916+
oneOf:
917+
- type: string
918+
- type: object
900919
description: A runtime expression, if any, used to mutate and/or filter the output of the workflow or task.
901920
description: Configures the output of a workflow or task.
902921
export:
@@ -906,7 +925,9 @@ $defs:
906925
$ref: '#/$defs/schema'
907926
description: The schema used to describe and validate the workflow context.
908927
as:
909-
type: string
928+
oneOf:
929+
- type: string
930+
- type: object
910931
description: A runtime expression, if any, used to export the output data to the context.
911932
description: Set the content of the context.
912933
retryPolicy:

0 commit comments

Comments
 (0)