From fb6b96c759c491ccb2d92027988dae466bc217fa Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Fri, 26 Jul 2024 06:37:01 +0000 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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