From 58eed74e3ffd7debd85a7497f41d37988b49ba8a Mon Sep 17 00:00:00 2001 From: Yuri Zhao Date: Mon, 15 Jul 2024 11:03:39 -0400 Subject: [PATCH 01/12] Signed-off-by: Yuri Zhao fix task run hyperlinks and add allowing another workflow description Signed-off-by: Yuri Zhao Signed-off-by: Joost van Berkel --- dsl-reference.md | 2 +- dsl.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dsl-reference.md b/dsl-reference.md index 6eb5ff60..5ed78d47 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -233,7 +233,7 @@ The Serverless Workflow DSL defines a list of [tasks](#task) that **must be** su - [For](#for), used to iterate over a collection of items, and conditionally perform a task for each of them. - [Listen](#listen), used to listen for an [event](#event) or more. - [Raise](#raise), used to raise an [error](#error) and potentially fault the [workflow](#workflow). -- [Run](#run), used to run a [container](#container), a [script](#script) or event a [shell](#shell) command. +- [Run](#run), used to run a [container](#container-process), a [script](#script-process) , a [shell](#shell-process) command or even another [workflow](#workflow-process). - [Switch](#switch), used to dynamically select and execute one of multiple alternative paths based on specified conditions - [Set](#set), used to dynamically set or update the [workflow](#workflow)'s data during the its execution. - [Try](#try), used to attempt executing a specified [task](#task), and to handle any resulting [errors](#error) gracefully, allowing the [workflow](#workflow) to continue without interruption. diff --git a/dsl.md b/dsl.md index 71b3cdce..ae197c4c 100644 --- a/dsl.md +++ b/dsl.md @@ -107,7 +107,7 @@ The Serverless Workflow DSL defines several default [task](dsl-reference.md#task - [For](dsl-reference.md#for), used to iterate over a collection of items, and conditionally perform a task for each of them. - [Listen](dsl-reference.md#listen), used to listen for an [event](dsl-reference.md#event) or more. - [Raise](dsl-reference.md#raise), used to raise an [error](dsl-reference.md#error) and potentially fault the [workflow](dsl-reference.md#workflow). -- [Run](dsl-reference.md#run), used to run a [container](dsl-reference.md#container), a [script](dsl-reference.md#script) or event a [shell](dsl-reference.md#shell) command. +- [Run](dsl-reference.md#run), used to run a [container](dsl-reference.md#container-process), a [script](dsl-reference.md#script-process), a [shell](dsl-reference.md#shell-process) command or even another [workflow](#workflow-process). - [Switch](dsl-reference.md#switch), used to dynamically select and execute one of multiple alternative paths based on specified conditions - [Set](dsl-reference.md#set), used to dynamically set or update the [workflow](dsl-reference.md#workflow)'s data during the its execution. - [Try](dsl-reference.md#try), used to attempt executing a specified [task](dsl-reference.md#task), and to handle any resulting [errors](dsl-reference.md#error) gracefully, allowing the [workflow](dsl-reference.md#workflow) to continue without interruption. From 0c900ca92e0d97109d91936fdb528883ba7afda8 Mon Sep 17 00:00:00 2001 From: Yuri Zhao Date: Mon, 15 Jul 2024 11:11:23 -0400 Subject: [PATCH 02/12] missing dsl reference Signed-off-by: Yuri Zhao Signed-off-by: Joost van Berkel --- dsl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsl.md b/dsl.md index ae197c4c..f69bdcc1 100644 --- a/dsl.md +++ b/dsl.md @@ -107,7 +107,7 @@ The Serverless Workflow DSL defines several default [task](dsl-reference.md#task - [For](dsl-reference.md#for), used to iterate over a collection of items, and conditionally perform a task for each of them. - [Listen](dsl-reference.md#listen), used to listen for an [event](dsl-reference.md#event) or more. - [Raise](dsl-reference.md#raise), used to raise an [error](dsl-reference.md#error) and potentially fault the [workflow](dsl-reference.md#workflow). -- [Run](dsl-reference.md#run), used to run a [container](dsl-reference.md#container-process), a [script](dsl-reference.md#script-process), a [shell](dsl-reference.md#shell-process) command or even another [workflow](#workflow-process). +- [Run](dsl-reference.md#run), used to run a [container](dsl-reference.md#container-process), a [script](dsl-reference.md#script-process), a [shell](dsl-reference.md#shell-process) command or even another [workflow](dsl-reference.md#workflow-process). - [Switch](dsl-reference.md#switch), used to dynamically select and execute one of multiple alternative paths based on specified conditions - [Set](dsl-reference.md#set), used to dynamically set or update the [workflow](dsl-reference.md#workflow)'s data during the its execution. - [Try](dsl-reference.md#try), used to attempt executing a specified [task](dsl-reference.md#task), and to handle any resulting [errors](dsl-reference.md#error) gracefully, allowing the [workflow](dsl-reference.md#workflow) to continue without interruption. From fe6808c32b81dc36e707a21fc4ef3d00be5cf8e2 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Mon, 15 Jul 2024 09:38:28 +0000 Subject: [PATCH 03/12] feat: add titles to tasks Signed-off-by: Matthias Pichler Signed-off-by: Joost van Berkel --- schema/workflow.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 4ab258be..c1a0d749 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -103,6 +103,7 @@ properties: description: Schedules the workflow $defs: taskList: + title: TaskList type: array items: type: object @@ -314,6 +315,7 @@ $defs: additionalProperties: true description: A name/value mapping of the parameters, if any, to call the function with. forkTask: + title: ForkTask description: Allows workflows to execute multiple tasks concurrently and optionally race them against each other, with a single possible winner, which sets the task's output. $ref: '#/$defs/taskBase' type: object @@ -331,6 +333,7 @@ $defs: type: boolean default: false doTask: + title: DoTask description: Allows to execute a list of tasks in sequence $ref: '#/$defs/taskBase' type: object @@ -340,6 +343,7 @@ $defs: do: $ref: '#/$defs/taskList' emitTask: + title: EmitTask description: Allows workflows to publish events to event brokers or messaging systems, facilitating communication and coordination between different components and services. $ref: '#/$defs/taskBase' type: object @@ -377,6 +381,7 @@ $defs: additionalProperties: true required: [ event ] forTask: + title: ForTask description: Allows workflows to iterate over a collection of items, executing a defined set of subtasks for each item in the collection. This task type is instrumental in handling scenarios such as batch processing, data transformation, and repetitive operations across datasets. $ref: '#/$defs/taskBase' type: object @@ -404,6 +409,7 @@ $defs: do: $ref: '#/$defs/taskList' listenTask: + title: ListenTask description: Provides a mechanism for workflows to await and react to external events, enabling event-driven behavior within workflow systems. $ref: '#/$defs/taskBase' type: object @@ -418,6 +424,7 @@ $defs: description: Defines the event(s) to listen to. required: [ to ] raiseTask: + title: RaiseTask description: Intentionally triggers and propagates errors. $ref: '#/$defs/taskBase' type: object @@ -432,6 +439,7 @@ $defs: description: Defines the error to raise. required: [ error ] runTask: + title: RunTask description: Provides the capability to execute external containers, shell commands, scripts, or workflows. $ref: '#/$defs/taskBase' type: object @@ -540,6 +548,7 @@ $defs: required: [ workflow ] description: Enables the invocation and execution of nested workflows within a parent workflow, facilitating modularization, reusability, and abstraction of complex logic or business processes by encapsulating them into standalone workflow units. setTask: + title: SetTask description: A task used to set data $ref: '#/$defs/taskBase' type: object @@ -552,6 +561,7 @@ $defs: additionalProperties: true description: The data to set switchTask: + title: SwitchTask description: Enables conditional branching within workflows, allowing them to dynamically select different paths based on specified conditions or criteria $ref: '#/$defs/taskBase' type: object @@ -579,6 +589,7 @@ $defs: $ref: '#/$defs/flowDirective' description: The flow directive to execute when the case matches. tryTask: + title: TryTask description: Serves as a mechanism within workflows to handle errors gracefully, potentially retrying failed tasks before proceeding with alternate ones. $ref: '#/$defs/taskBase' type: object @@ -610,6 +621,7 @@ $defs: description: The definition of the task(s) to run when catching an error. $ref: '#/$defs/taskList' waitTask: + title: WaitTask description: Allows workflows to pause or delay their execution for a specified period of time. $ref: '#/$defs/taskBase' type: object From c1d420b49a614644786c22db13080559110365dc Mon Sep 17 00:00:00 2001 From: Joost van Berkel Date: Thu, 18 Jul 2024 15:22:24 +0200 Subject: [PATCH 04/12] Fixed typo RunWokflow Signed-off-by: Joost van Berkel --- schema/workflow.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/workflow.yaml b/schema/workflow.yaml index c1a0d749..370e9db1 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -523,7 +523,7 @@ $defs: required: [ command ] required: [ shell ] description: Enables the execution of shell commands within a workflow, enabling workflows to interact with the underlying operating system and perform system-level operations, such as file manipulation, environment configuration, or system administration tasks. - - title: RunWokflow + - title: RunWorkflow properties: workflow: title: RunWorkflowDescriptor From b30de593a655c777263e54580343b9a50c0d7d10 Mon Sep 17 00:00:00 2001 From: Yuri Zhao Date: Thu, 25 Jul 2024 14:02:55 -0400 Subject: [PATCH 05/12] Fix output examples from dsl reference and ctk feature Signed-off-by: Yuri Zhao --- ctk/features/call.feature | 4 ++-- dsl-reference.md | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/ctk/features/call.feature b/ctk/features/call.feature index cf3c591c..700c6de4 100644 --- a/ctk/features/call.feature +++ b/ctk/features/call.feature @@ -22,7 +22,7 @@ Feature: Call Task endpoint: uri: https://petstore.swagger.io/v2/pet/findByStatus?status={status} output: - from: .[0] + as: .[0] """ And given the workflow input is: """yaml @@ -108,7 +108,7 @@ Feature: Call Task parameters: status: ${ .status } output: - from: . | length + as: . | length """ And given the workflow input is: """yaml diff --git a/dsl-reference.md b/dsl-reference.md index 5ed78d47..51288840 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -1515,9 +1515,7 @@ schema: petId: type: string required: [ petId ] -from: - petId: '${ .pet.id }' -to: '.petList += [ . ]' +as: '.petList += [ . ]' ``` ### Export From ef679e11f39901babf19d83c82bf58c08519bdcc Mon Sep 17 00:00:00 2001 From: Yuri Zhao Date: Mon, 29 Jul 2024 12:09:15 -0400 Subject: [PATCH 06/12] Updated Output example Signed-off-by: Yuri Zhao --- dsl-reference.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/dsl-reference.md b/dsl-reference.md index 51288840..a8b37b35 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -1507,15 +1507,20 @@ When set, runtimes must validate output data against the defined schema, unless #### Examples ```yaml -schema: - format: json - document: - type: object - properties: - petId: - type: string - required: [ petId ] -as: '.petList += [ . ]' +output: + schema: + format: json + document: + type: object + properties: + petId: + type: string + required: [ petId ] + as: + petId: '${ .pet.id }' +export: + as: + '.petList += [ . ]' ``` ### Export From b5eb68ed518b9f12933e0734db6593d4bc445273 Mon Sep 17 00:00:00 2001 From: Charles d'Avernas Date: Wed, 31 Jul 2024 20:05:59 +0200 Subject: [PATCH 07/12] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ed61db4c..9502ade1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ - [About](#about) - [Ecosystem](#ecosystem) + [DSL](dsl.md) - + [CTK](/ctk/readme.md) + + [CTK](/ctk/README.md) + [SDKs](#sdks) + [Runtimes](#runtimes) + [Tooling](#Tooling) @@ -177,4 +177,4 @@ By becoming a sponsor, you'll not only demonstrate your commitment to advancing Sponsorship opportunities range from financial contributions to in-kind support, and every sponsorship makes a meaningful impact on the project's success and sustainability. -Support our project by [becoming a Sponsor](https://crowdfunding.lfx.linuxfoundation.org/projects/serverless-workflow). \ No newline at end of file +Support our project by [becoming a Sponsor](https://crowdfunding.lfx.linuxfoundation.org/projects/serverless-workflow). From fb6b96c759c491ccb2d92027988dae466bc217fa Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Fri, 26 Jul 2024 06:37:01 +0000 Subject: [PATCH 08/12] feat: add new failing example Signed-off-by: Matthias Pichler --- examples/star-wars-homeworld.yaml | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 examples/star-wars-homeworld.yaml diff --git a/examples/star-wars-homeworld.yaml b/examples/star-wars-homeworld.yaml new file mode 100644 index 00000000..c443feb0 --- /dev/null +++ b/examples/star-wars-homeworld.yaml @@ -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 } From 80280f3002e1db1569db80ccf0d0dbaccd0e1893 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Fri, 26 Jul 2024 06:38:26 +0000 Subject: [PATCH 09/12] refactor: move required field before $defs Signed-off-by: Matthias Pichler --- schema/workflow.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 370e9db1..49150760 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -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 @@ -1030,4 +1031,3 @@ $defs: description: The duration after which to timeout. required: [ after ] description: The definition of a timeout. -required: [ document, do ] \ No newline at end of file From ec487e275ae50e54d1e62d8fad3471e4da1b1758 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Fri, 26 Jul 2024 06:46:46 +0000 Subject: [PATCH 10/12] feat: allow runtime expressions Signed-off-by: Matthias Pichler --- schema/workflow.yaml | 51 +++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 49150760..b6990d79 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -253,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 @@ -361,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 ] @@ -773,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. @@ -794,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. @@ -1031,3 +1051,8 @@ $defs: description: The duration after which to timeout. required: [ after ] description: The definition of a timeout. + runtimeExpression: + title: RuntimeExpression + type: string + description: A runtime expression + pattern: "^\\s*\\$\\{.+\\}\\s*$" \ No newline at end of file From e605f67c5c52a657ee355c2a7ab25b28a81f9817 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti Date: Fri, 2 Aug 2024 13:53:35 +0200 Subject: [PATCH 11/12] Adding missing titles for better pojo generation Signed-off-by: Francisco Javier Tirado Sarti --- schema/workflow.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 370e9db1..2a95c9e7 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -664,7 +664,8 @@ $defs: basic: type: object oneOf: - - properties: + - title: BasicAuthInfo + properties: username: type: string description: The username to use. @@ -680,7 +681,8 @@ $defs: bearer: type: object oneOf: - - properties: + - title: BearerAuthInfo + properties: token: type: string description: The bearer token to use. @@ -693,7 +695,8 @@ $defs: oauth2: type: object oneOf: - - properties: + - title: OAuth2Info + properties: authority: type: string format: uri From 0579a9488df02f9a34e02ec1d61056de5c1508d2 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti Date: Fri, 2 Aug 2024 14:30:59 +0200 Subject: [PATCH 12/12] Charles comments Signed-off-by: Francisco Javier Tirado Sarti --- schema/workflow.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 2a95c9e7..6ecd4485 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -664,7 +664,7 @@ $defs: basic: type: object oneOf: - - title: BasicAuthInfo + - title: BasicAuthenticationData properties: username: type: string @@ -681,7 +681,7 @@ $defs: bearer: type: object oneOf: - - title: BearerAuthInfo + - title: BearerAuthenticationData properties: token: type: string @@ -695,7 +695,7 @@ $defs: oauth2: type: object oneOf: - - title: OAuth2Info + - title: OAuth2AutenthicationData properties: authority: type: string