From e7cd73fa0286e43ff1fb79dd5cdc3e871f2a324c Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Mon, 3 Jun 2024 13:24:10 +0000 Subject: [PATCH 1/4] fix: update use endpoint in examples Signed-off-by: Matthias Pichler --- dsl-reference.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/dsl-reference.md b/dsl-reference.md index f4fd9ad0..036fd872 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -149,14 +149,14 @@ use: call: http with: method: post - uri: https://fake.log.collector.com + endpoint: https://fake.log.collector.com body: message: "${ \"Executing task '\($task.reference)'...\" }" after: call: http with: method: post - uri: https://fake.log.collector.com + endpoint: https://fake.log.collector.com body: message: "${ \"Executed task '\($task.reference)'...\" }" functions: @@ -259,7 +259,7 @@ do: call: http with: method: get - uri: https://petstore.swagger.io/v2/pet/{petId} + endpoint: https://petstore.swagger.io/v2/pet/{petId} ``` Serverless Workflow defines several default functions that **MUST** be supported by all implementations and runtimes: @@ -371,7 +371,7 @@ do: call: http with: method: get - uri: https://petstore.swagger.io/v2/pet/{petId} + endpoint: https://petstore.swagger.io/v2/pet/{petId} ``` ##### OpenAPI Call @@ -481,7 +481,7 @@ do: call: http with: method: put - uri: https://fake-hospital.com/api/v3/alert/nurses + endpoint: https://fake-hospital.com/api/v3/alert/nurses body: patientId: ${ .patient.fullName } room: ${ .room.number } @@ -489,7 +489,7 @@ do: call: http with: method: put - uri: https://fake-hospital.com/api/v3/alert/doctor + endpoint: https://fake-hospital.com/api/v3/alert/doctor body: patientId: ${ .patient.fullName } room: ${ .room.number } @@ -917,7 +917,7 @@ do: call: http with: method: get - uri: https:// + endpoint: https:// catch: errors: with: @@ -1203,14 +1203,14 @@ use: call: http with: method: post - uri: https://fake.log.collector.com + endpoint: https://fake.log.collector.com body: message: "${ \"Executing task '\($task.reference)'...\" }" after: call: http with: method: post - uri: https://fake.log.collector.com + endpoint: https://fake.log.collector.com body: message: "${ \"Executed task '\($task.reference)'...\" }" do: @@ -1218,7 +1218,7 @@ do: call: http with: method: get - uri: https://fake.com/sample + endpoint: https://fake.com/sample ``` *Intercept HTTP calls to 'https://mocked.service.com' and mock its response:* @@ -1247,7 +1247,7 @@ do: call: http with: method: get - uri: https://fake.com/sample + endpoint: https://fake.com/sample ``` ### Error From a07afc02d52257c8bcc8c0af88424b7053428948 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Mon, 3 Jun 2024 13:28:33 +0000 Subject: [PATCH 2/4] fix: allow to specify endpoint as string as described in dsl Signed-off-by: Matthias Pichler --- schema/workflow.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schema/workflow.yaml b/schema/workflow.yaml index d98321f3..5088fe4c 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -211,8 +211,11 @@ $defs: type: string description: The HTTP method of the HTTP request to perform. endpoint: - $ref: '#/$defs/endpoint' description: The HTTP endpoint to send the request to. + oneOf: + - $ref: '#/$defs/endpoint' + - type: string + format: uri headers: type: object description: A name/value mapping of the headers, if any, of the HTTP request to perform. From 4425b0f80933cc5fc6a2e119db859a613be8a6e3 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Mon, 3 Jun 2024 17:51:12 +0000 Subject: [PATCH 3/4] docs: add shorthand endpoint example Signed-off-by: Matthias Pichler --- examples/call-http-shorthand-endpoint.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 examples/call-http-shorthand-endpoint.yaml diff --git a/examples/call-http-shorthand-endpoint.yaml b/examples/call-http-shorthand-endpoint.yaml new file mode 100644 index 00000000..35a8c81d --- /dev/null +++ b/examples/call-http-shorthand-endpoint.yaml @@ -0,0 +1,11 @@ +document: + dsl: 1.0.0-alpha1 + namespace: examples + name: call-http-shorthand-endpoint + version: 1.0.0-alpha1 +do: + getPetById: + call: http + with: + method: get + endpoint: https://petstore.swagger.io/v2/pet/1 \ No newline at end of file From fe884219a28f6fbe199ccf991cda0a65f30f7bb3 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Mon, 3 Jun 2024 19:13:45 +0000 Subject: [PATCH 4/4] fix: use uri-template Signed-off-by: Matthias Pichler --- examples/call-http-shorthand-endpoint.yaml | 2 +- schema/workflow.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/call-http-shorthand-endpoint.yaml b/examples/call-http-shorthand-endpoint.yaml index 35a8c81d..f682ed30 100644 --- a/examples/call-http-shorthand-endpoint.yaml +++ b/examples/call-http-shorthand-endpoint.yaml @@ -8,4 +8,4 @@ do: call: http with: method: get - endpoint: https://petstore.swagger.io/v2/pet/1 \ No newline at end of file + endpoint: https://petstore.swagger.io/v2/pet/{petId} diff --git a/schema/workflow.yaml b/schema/workflow.yaml index e39171d5..75c2093e 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -219,7 +219,7 @@ $defs: oneOf: - $ref: '#/$defs/endpoint' - type: string - format: uri + format: uri-template headers: type: object description: A name/value mapping of the headers, if any, of the HTTP request to perform.