Skip to content

Commit f25a9f5

Browse files
Merge pull request serverlessworkflow#938 from matthias-pichler-warrify/runtime-expressions
Allow runtime-expressions for formatted strings
2 parents 4622e24 + a70e430 commit f25a9f5

File tree

2 files changed

+72
-14
lines changed

2 files changed

+72
-14
lines changed

examples/star-wars-homeworld.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# yaml-language-server: $schema=https://serverlessworkflow.io/schemas/1.0.0-alpha2/workflow.yaml
2+
document:
3+
dsl: 1.0.0-alpha2
4+
namespace: examples
5+
name: star-wars-homeplanet
6+
version: 1.0.0-alpha2
7+
input:
8+
schema:
9+
format: json
10+
document:
11+
type: object
12+
required:
13+
- id
14+
properties:
15+
id:
16+
type: integer
17+
description: The id of the star wars character to get
18+
minimum: 1
19+
do:
20+
- getStarWarsCharacter:
21+
call: http
22+
with:
23+
method: get
24+
endpoint: https://swapi.dev/api/people/{id}
25+
output: response
26+
export:
27+
as:
28+
homeworld: ${ .content.homeworld }
29+
- getStarWarsHomeworld:
30+
call: http
31+
with:
32+
method: get
33+
endpoint: ${ $context.homeworld }

schema/workflow.yaml

+39-14
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ $id: https://serverlessworkflow.io/schemas/1.0.0-alpha1/workflow.yaml
22
$schema: https://json-schema.org/draft/2020-12/schema
33
description: Serverless Workflow DSL - Workflow Schema
44
type: object
5+
required: [ document, do ]
56
properties:
67
document:
78
type: object
@@ -252,7 +253,9 @@ $defs:
252253
description: The HTTP endpoint to send the request to.
253254
oneOf:
254255
- $ref: '#/$defs/endpoint'
255-
- type: string
256+
- $ref: '#/$defs/runtimeExpression'
257+
- title: LiteralEndpoint
258+
type: string
256259
format: uri-template
257260
headers:
258261
type: object
@@ -360,23 +363,32 @@ $defs:
360363
type: string
361364
description: The event's unique identifier
362365
source:
363-
type: string
364-
format: uri
365366
description: Identifies the context in which an event happened
367+
oneOf:
368+
- title: LiteralSource
369+
type: string
370+
format: uri-template
371+
- $ref: '#/$defs/runtimeExpression'
366372
type:
367373
type: string
368374
description: This attribute contains a value describing the type of event related to the originating occurrence.
369375
time:
370-
type: string
371-
format: date-time
376+
oneOf:
377+
- title: LiteralTime
378+
type: string
379+
format: date-time
380+
- $ref: '#/$defs/runtimeExpression'
372381
subject:
373382
type: string
374383
datacontenttype:
375384
type: string
376385
description: Content type of data value. This attribute enables data to carry any type of content, whereby format and encoding might differ from that of the chosen event format.
377386
dataschema:
378-
type: string
379-
format: uri
387+
oneOf:
388+
- title: LiteralDataSchema
389+
type: string
390+
format: uri-template
391+
- $ref: '#/$defs/runtimeExpression'
380392
required: [ source, type ]
381393
additionalProperties: true
382394
required: [ event ]
@@ -772,16 +784,22 @@ $defs:
772784
type: object
773785
properties:
774786
type:
775-
type: string
776-
format: uri
777787
description: A URI reference that identifies the error type.
788+
oneOf:
789+
- title: LiteralErrorType
790+
type: string
791+
format: uri-template
792+
- $ref: '#/$defs/runtimeExpression'
778793
status:
779794
type: integer
780795
description: The status code generated by the origin for this occurrence of the error.
781796
instance:
782-
type: string
783-
format: json-pointer
784797
description: A JSON Pointer used to reference the component the error originates from.
798+
oneOf:
799+
- title: LiteralErrorInstance
800+
type: string
801+
format: json-pointer
802+
- $ref: '#/$defs/runtimeExpression'
785803
title:
786804
type: string
787805
description: A short, human-readable summary of the error.
@@ -793,9 +811,12 @@ $defs:
793811
type: object
794812
properties:
795813
uri:
796-
type: string
797-
format: uri-template
798814
description: The endpoint's URI.
815+
oneOf:
816+
- title: LiteralEndpointURI
817+
type: string
818+
format: uri-template
819+
- $ref: '#/$defs/runtimeExpression'
799820
authentication:
800821
$ref: '#/$defs/referenceableAuthenticationPolicy'
801822
description: The authentication policy to use.
@@ -1030,4 +1051,8 @@ $defs:
10301051
description: The duration after which to timeout.
10311052
required: [ after ]
10321053
description: The definition of a timeout.
1033-
required: [ document, do ]
1054+
runtimeExpression:
1055+
title: RuntimeExpression
1056+
type: string
1057+
description: A runtime expression
1058+
pattern: "^\\s*\\$\\{.+\\}\\s*$"

0 commit comments

Comments
 (0)