Skip to content

Commit

Permalink
Merge pull request serverlessworkflow#938 from matthias-pichler-warri…
Browse files Browse the repository at this point in the history
…fy/runtime-expressions

Allow runtime-expressions for formatted strings
  • Loading branch information
ricardozanini authored Aug 1, 2024
2 parents 4622e24 + a70e430 commit f25a9f5
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 14 deletions.
33 changes: 33 additions & 0 deletions examples/star-wars-homeworld.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# yaml-language-server: $schema=https://serverlessworkflow.io/schemas/1.0.0-alpha2/workflow.yaml
document:
dsl: 1.0.0-alpha2
namespace: examples
name: star-wars-homeplanet
version: 1.0.0-alpha2
input:
schema:
format: json
document:
type: object
required:
- id
properties:
id:
type: integer
description: The id of the star wars character to get
minimum: 1
do:
- getStarWarsCharacter:
call: http
with:
method: get
endpoint: https://swapi.dev/api/people/{id}
output: response
export:
as:
homeworld: ${ .content.homeworld }
- getStarWarsHomeworld:
call: http
with:
method: get
endpoint: ${ $context.homeworld }
53 changes: 39 additions & 14 deletions schema/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ $id: https://serverlessworkflow.io/schemas/1.0.0-alpha1/workflow.yaml
$schema: https://json-schema.org/draft/2020-12/schema
description: Serverless Workflow DSL - Workflow Schema
type: object
required: [ document, do ]
properties:
document:
type: object
Expand Down Expand Up @@ -252,7 +253,9 @@ $defs:
description: The HTTP endpoint to send the request to.
oneOf:
- $ref: '#/$defs/endpoint'
- type: string
- $ref: '#/$defs/runtimeExpression'
- title: LiteralEndpoint
type: string
format: uri-template
headers:
type: object
Expand Down Expand Up @@ -360,23 +363,32 @@ $defs:
type: string
description: The event's unique identifier
source:
type: string
format: uri
description: Identifies the context in which an event happened
oneOf:
- title: LiteralSource
type: string
format: uri-template
- $ref: '#/$defs/runtimeExpression'
type:
type: string
description: This attribute contains a value describing the type of event related to the originating occurrence.
time:
type: string
format: date-time
oneOf:
- title: LiteralTime
type: string
format: date-time
- $ref: '#/$defs/runtimeExpression'
subject:
type: string
datacontenttype:
type: string
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.
dataschema:
type: string
format: uri
oneOf:
- title: LiteralDataSchema
type: string
format: uri-template
- $ref: '#/$defs/runtimeExpression'
required: [ source, type ]
additionalProperties: true
required: [ event ]
Expand Down Expand Up @@ -772,16 +784,22 @@ $defs:
type: object
properties:
type:
type: string
format: uri
description: A URI reference that identifies the error type.
oneOf:
- title: LiteralErrorType
type: string
format: uri-template
- $ref: '#/$defs/runtimeExpression'
status:
type: integer
description: The status code generated by the origin for this occurrence of the error.
instance:
type: string
format: json-pointer
description: A JSON Pointer used to reference the component the error originates from.
oneOf:
- title: LiteralErrorInstance
type: string
format: json-pointer
- $ref: '#/$defs/runtimeExpression'
title:
type: string
description: A short, human-readable summary of the error.
Expand All @@ -793,9 +811,12 @@ $defs:
type: object
properties:
uri:
type: string
format: uri-template
description: The endpoint's URI.
oneOf:
- title: LiteralEndpointURI
type: string
format: uri-template
- $ref: '#/$defs/runtimeExpression'
authentication:
$ref: '#/$defs/referenceableAuthenticationPolicy'
description: The authentication policy to use.
Expand Down Expand Up @@ -1030,4 +1051,8 @@ $defs:
description: The duration after which to timeout.
required: [ after ]
description: The definition of a timeout.
required: [ document, do ]
runtimeExpression:
title: RuntimeExpression
type: string
description: A runtime expression
pattern: "^\\s*\\$\\{.+\\}\\s*$"

0 comments on commit f25a9f5

Please sign in to comment.