From a9428b5754250d105b20a6c283c53eba57c63000 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Mon, 3 Jun 2024 12:55:43 +0000 Subject: [PATCH 1/7] fix: use const for call tasks Signed-off-by: Matthias Pichler --- schema/workflow.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/schema/workflow.yaml b/schema/workflow.yaml index d98321f3..b678f76f 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -133,7 +133,7 @@ $defs: - properties: call: type: string - constant: asyncapi + const: asyncapi with: type: object properties: @@ -164,7 +164,7 @@ $defs: - properties: call: type: string - constant: grpc + const: grpc with: type: object properties: @@ -203,7 +203,7 @@ $defs: - properties: call: type: string - constant: http + const: http with: type: object properties: @@ -228,7 +228,7 @@ $defs: - properties: call: type: string - constant: openapi + const: openapi with: type: object properties: From 58fb86c09ab6a2b0dfbba656b31cf60db1677e04 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Mon, 3 Jun 2024 13:02:56 +0000 Subject: [PATCH 2/7] fix: replace ref with $ref 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 b678f76f..7ca8bdf7 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -156,7 +156,7 @@ $defs: type: object description: The payload to call the AsyncAPI operation with, if any. authentication: - ref: '#/$defs/authenticationPolicy' + $ref: '#/$defs/authenticationPolicy' description: The authentication policy, if any, to use when calling the AsyncAPI operation. required: [ document, operationRef ] description: Defines the AsyncAPI call to perform. From 672794a45a34cb5e2b1b9d13fd051ca63c9cf040 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Mon, 3 Jun 2024 13:07:03 +0000 Subject: [PATCH 3/7] fix: allow references to authentications in use Signed-off-by: Matthias Pichler --- schema/workflow.yaml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 7ca8bdf7..a65d6589 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -156,8 +156,10 @@ $defs: type: object description: The payload to call the AsyncAPI operation with, if any. authentication: - $ref: '#/$defs/authenticationPolicy' description: The authentication policy, if any, to use when calling the AsyncAPI operation. + oneOf: + - $ref: '#/$defs/authenticationPolicy' + - type: string required: [ document, operationRef ] description: Defines the AsyncAPI call to perform. required: [ call, with ] @@ -187,8 +189,10 @@ $defs: max: 65535 description: The port number of the GRPC service to call. authentication: - $ref: '#/$defs/authenticationPolicy' description: The endpoint's authentication policy, if any. + oneOf: + - $ref: '#/$defs/authenticationPolicy' + - type: string required: [ name, host ] method: type: string @@ -243,8 +247,10 @@ $defs: additionalProperties: true description: A name/value mapping of the parameters of the OpenAPI operation to call. authentication: - $ref: '#/$defs/authenticationPolicy' description: The authentication policy, if any, to use when calling the OpenAPI operation. + oneOf: + - $ref: '#/$defs/authenticationPolicy' + - type: string output: type: string enum: [ raw, content, response ] @@ -668,8 +674,10 @@ $defs: format: uri description: The endpoint's URI. authentication: - $ref: '#/$defs/authenticationPolicy' description: The authentication policy to use. + oneOf: + - $ref: '#/$defs/authenticationPolicy' + - type: string required: [ uri ] eventConsumptionStrategy: type: object @@ -761,8 +769,10 @@ $defs: format: uri description: The endpoint's URI. authentication: - $ref: '#/$defs/authenticationPolicy' description: The authentication policy to use. + oneOf: + - $ref: '#/$defs/authenticationPolicy' + - type: string name: type: string description: The external resource's name, if any. From b178a8f871879728ec4ad399d17efee868b0c5e6 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Mon, 3 Jun 2024 13:08:30 +0000 Subject: [PATCH 4/7] fix: add missing type directives to tasks Signed-off-by: Matthias Pichler --- schema/workflow.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/schema/workflow.yaml b/schema/workflow.yaml index a65d6589..6c8f2903 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -270,6 +270,7 @@ $defs: description: A name/value mapping of the parameters, if any, to call the function with. required: [ call ] compositeTask: + type: object properties: execute: type: object @@ -297,6 +298,7 @@ $defs: required: [ execute ] description: Serves as a pivotal orchestrator within workflow systems, enabling the seamless integration and execution of multiple subtasks to accomplish complex operations emitTask: + type: object properties: emit: type: object @@ -338,6 +340,7 @@ $defs: default: continue - type: string forTask: + type: object properties: for: type: object From 62e012ddf7c97dbd99d8ad70d08cc834fd56951e Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Mon, 3 Jun 2024 18:33:08 +0000 Subject: [PATCH 5/7] docs: add example of reusable auth Signed-off-by: Matthias Pichler --- examples/use-authentication.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 examples/use-authentication.yaml diff --git a/examples/use-authentication.yaml b/examples/use-authentication.yaml new file mode 100644 index 00000000..c8cd34fe --- /dev/null +++ b/examples/use-authentication.yaml @@ -0,0 +1,18 @@ +document: + dsl: 1.0.0-alpha1 + namespace: examples + name: bearer-auth + version: 1.0.0-alpha1 +use: + authentications: + petStoreAuth: + bearer: + token: ${ .token } +do: + getPetById: + call: http + with: + method: get + endpoint: + uri: https://petstore.swagger.io/v2/pet/{petId} + authentication: petStoreAuth From bd2aff41052cf47432444a1248f43bd2a24aa962 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Mon, 3 Jun 2024 18:36:15 +0000 Subject: [PATCH 6/7] docs: add async api example Signed-off-by: Matthias Pichler --- examples/asyncapi.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 examples/asyncapi.yaml diff --git a/examples/asyncapi.yaml b/examples/asyncapi.yaml new file mode 100644 index 00000000..8c02d90d --- /dev/null +++ b/examples/asyncapi.yaml @@ -0,0 +1,20 @@ +document: + dsl: 1.0.0-alpha1 + namespace: examples + name: bearer-auth + version: 1.0.0-alpha1 +do: + greetUser: + call: asyncapi + with: + document: + uri: https://fake.com/docs/asyncapi.json + operation: findPetsByStatus + server: staging + message: getPetByStatusQuery + binding: http + payload: + petId: ${ .pet.id } + authentication: + bearer: + token: ${ .token } From aeba879bd76a95de65d5a1877f713e42afc1d505 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Mon, 3 Jun 2024 18:39:54 +0000 Subject: [PATCH 7/7] fix: use operationRef Signed-off-by: Matthias Pichler --- examples/asyncapi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/asyncapi.yaml b/examples/asyncapi.yaml index 8c02d90d..9d442d08 100644 --- a/examples/asyncapi.yaml +++ b/examples/asyncapi.yaml @@ -9,7 +9,7 @@ do: with: document: uri: https://fake.com/docs/asyncapi.json - operation: findPetsByStatus + operationRef: findPetsByStatus server: staging message: getPetByStatusQuery binding: http