From e1d565ab7f2497b595d2bfce022f7404821297bc Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Thu, 18 Jul 2024 17:03:18 +0000 Subject: [PATCH 1/4] fix: restrict extra properties Signed-off-by: Matthias Pichler --- schema/workflow.yaml | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/schema/workflow.yaml b/schema/workflow.yaml index c1a0d749..7f45fcad 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -5,6 +5,7 @@ type: object properties: document: type: object + unevaluatedProperties: false properties: dsl: type: string @@ -39,6 +40,7 @@ properties: description: Configures the workflow's input. use: type: object + unevaluatedProperties: false properties: authentications: type: object @@ -87,6 +89,7 @@ properties: description: Configures the workflow's output. schedule: type: object + unevaluatedProperties: false properties: every: $ref: '#/$defs/duration' @@ -324,6 +327,7 @@ $defs: properties: fork: type: object + unevaluatedProperties: false required: [ branches ] properties: branches: @@ -352,6 +356,7 @@ $defs: properties: emit: type: object + unevaluatedProperties: false properties: event: type: object @@ -390,6 +395,7 @@ $defs: properties: for: type: object + unevaluatedProperties: false properties: each: type: string @@ -418,6 +424,7 @@ $defs: properties: listen: type: object + unevaluatedProperties: false properties: to: $ref: '#/$defs/eventConsumptionStrategy' @@ -433,6 +440,7 @@ $defs: properties: raise: type: object + unevaluatedProperties: false properties: error: $ref: '#/$defs/error' @@ -453,6 +461,7 @@ $defs: properties: container: type: object + unevaluatedProperties: false properties: image: type: string @@ -477,6 +486,7 @@ $defs: properties: script: type: object + unevaluatedProperties: false properties: language: type: string @@ -506,6 +516,7 @@ $defs: properties: shell: type: object + unevaluatedProperties: false properties: command: type: string @@ -528,6 +539,7 @@ $defs: workflow: title: RunWorkflowDescriptor type: object + unevaluatedProperties: false properties: namespace: type: string @@ -579,8 +591,8 @@ $defs: additionalProperties: type: object title: SwitchCase - required: - - then + unevaluatedProperties: false + required: [ then ] properties: when: type: string @@ -601,6 +613,7 @@ $defs: $ref: '#/$defs/taskList' catch: type: object + unevaluatedProperties: false properties: errors: title: CatchErrors @@ -639,6 +652,7 @@ $defs: - type: string referenceableAuthenticationPolicy: type: object + unevaluatedProperties: false oneOf: - title: AuthenticationPolicyReference properties: @@ -650,6 +664,7 @@ $defs: - $ref: '#/$defs/authenticationPolicy' secretBasedAuthenticationPolicy: type: object + unevaluatedProperties: false properties: use: type: string @@ -663,6 +678,7 @@ $defs: properties: basic: type: object + unevaluatedProperties: false oneOf: - properties: username: @@ -679,6 +695,7 @@ $defs: properties: bearer: type: object + unevaluatedProperties: false oneOf: - properties: token: @@ -692,6 +709,7 @@ $defs: properties: oauth2: type: object + unevaluatedProperties: false oneOf: - properties: authority: @@ -703,6 +721,7 @@ $defs: description: The grant type to use. client: type: object + unevaluatedProperties: false properties: id: type: string @@ -740,6 +759,7 @@ $defs: description: Defines an authentication policy. oauth2Token: type: object + unevaluatedProperties: false properties: token: type: string @@ -751,6 +771,7 @@ $defs: duration: type: object minProperties: 1 + unevaluatedProperties: false properties: days: type: integer @@ -770,6 +791,7 @@ $defs: description: The definition of a duration. error: type: object + unevaluatedProperties: false properties: type: type: string @@ -791,6 +813,7 @@ $defs: required: [ type, status, instance ] endpoint: type: object + unevaluatedProperties: false properties: uri: type: string @@ -802,6 +825,7 @@ $defs: required: [ uri ] eventConsumptionStrategy: type: object + unevaluatedProperties: false oneOf: - title: AllEventConsumptionStrategy properties: @@ -827,6 +851,7 @@ $defs: required: [ one ] eventFilter: type: object + unevaluatedProperties: false properties: with: title: WithEvent @@ -870,6 +895,7 @@ $defs: description: An event filter is a mechanism used to selectively process or handle events based on predefined criteria, such as event type, source, or specific attributes. extension: type: object + unevaluatedProperties: false properties: extend: type: string @@ -892,6 +918,7 @@ $defs: format: uri - title: ExternalResourceURI type: object + unevaluatedProperties: false properties: uri: type: string @@ -906,6 +933,7 @@ $defs: required: [ uri ] input: type: object + unevaluatedProperties: false properties: schema: $ref: '#/$defs/schema' @@ -918,6 +946,7 @@ $defs: description: Configures the input of a workflow or task. output: type: object + unevaluatedProperties: false properties: schema: $ref: '#/$defs/schema' @@ -930,6 +959,7 @@ $defs: description: Configures the output of a workflow or task. export: type: object + unevaluatedProperties: false properties: schema: $ref: '#/$defs/schema' @@ -942,6 +972,7 @@ $defs: description: Set the content of the context. retryPolicy: type: object + unevaluatedProperties: false properties: when: type: string @@ -954,6 +985,7 @@ $defs: description: The duration to wait between retry attempts. backoff: type: object + unevaluatedProperties: false oneOf: - title: ConstantBackoff properties: @@ -976,9 +1008,11 @@ $defs: description: The retry duration backoff. limit: type: object + unevaluatedProperties: false properties: attempt: type: object + unevaluatedProperties: false properties: count: type: integer @@ -992,6 +1026,7 @@ $defs: description: The retry limit, if any jitter: type: object + unevaluatedProperties: false properties: from: $ref: '#/$defs/duration' @@ -1004,6 +1039,7 @@ $defs: description: Defines a retry policy. schema: type: object + unevaluatedProperties: false properties: format: type: string @@ -1024,6 +1060,7 @@ $defs: description: Represents the definition of a schema. timeout: type: object + unevaluatedProperties: false properties: after: $ref: '#/$defs/duration' From ec69fd1e62499db19812dd8ee8086f7af1ed3075 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Thu, 18 Jul 2024 17:06:52 +0000 Subject: [PATCH 2/4] fix: move output to correct level Signed-off-by: Matthias Pichler --- examples/accumulate-room-readings.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/accumulate-room-readings.yaml b/examples/accumulate-room-readings.yaml index 09bdf4d3..3b51d0f2 100644 --- a/examples/accumulate-room-readings.yaml +++ b/examples/accumulate-room-readings.yaml @@ -14,16 +14,14 @@ do: correlate: roomId: from: .roomid - output: - as: .data.reading - with: source: https://my.home.com/sensor type: my.home.sensors.humidity correlate: roomId: from: .roomid - output: - as: .data.reading + output: + as: .data.reading - logReading: for: each: reading From cd7a0b992d6903948445acaf6e79c365bdbc4b60 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Thu, 18 Jul 2024 17:12:22 +0000 Subject: [PATCH 3/4] fix: examples in dsl-reference Signed-off-by: Matthias Pichler --- dsl-reference.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dsl-reference.md b/dsl-reference.md index 5ed78d47..2e4d16f1 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -555,8 +555,8 @@ do: one: with: type: com.fake.petclinic.pets.checkup.completed.v2 - output: - as: '.pets + [{ "id": $pet.id }]' + output: + as: '.pets + [{ "id": $pet.id }]' ``` #### Fork @@ -1113,7 +1113,7 @@ document: use: secrets: - usernamePasswordSecret - authentication: + authentications: sampleBasicFromSecret: basic: use: usernamePasswordSecret From 93dcd34581fb26c3e8400905a5bc1620c82170a8 Mon Sep 17 00:00:00 2001 From: Matthias Pichler Date: Thu, 18 Jul 2024 17:21:02 +0000 Subject: [PATCH 4/4] fix: add even more property checks Signed-off-by: Matthias Pichler --- dsl-reference.md | 4 ++-- schema/workflow.yaml | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dsl-reference.md b/dsl-reference.md index 2e4d16f1..29bf40a4 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -555,8 +555,8 @@ do: one: with: type: com.fake.petclinic.pets.checkup.completed.v2 - output: - as: '.pets + [{ "id": $pet.id }]' + output: + as: '.pets + [{ "id": $pet.id }]' ``` #### Fork diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 7f45fcad..26599899 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -188,7 +188,7 @@ $defs: $ref: '#/$defs/referenceableAuthenticationPolicy' description: The authentication policy, if any, to use when calling the AsyncAPI operation. required: [ document, operationRef ] - additionalProperties: false + unevaluatedProperties: false description: Defines the AsyncAPI call to perform. - title: CallGRPC $ref: '#/$defs/taskBase' @@ -208,6 +208,7 @@ $defs: description: The proto resource that describes the GRPC service to call. service: type: object + unevaluatedProperties: false properties: name: type: string @@ -233,7 +234,7 @@ $defs: additionalProperties: true description: The arguments, if any, to call the method with. required: [ proto, service, method ] - additionalProperties: false + unevaluatedProperties: false description: Defines the GRPC call to perform. - title: CallHTTP $ref: '#/$defs/taskBase' @@ -267,7 +268,7 @@ $defs: enum: [ raw, content, response ] description: The http call output format. Defaults to 'content'. required: [ method, endpoint ] - additionalProperties: false + unevaluatedProperties: false description: Defines the HTTP call to perform. - title: CallOpenAPI $ref: '#/$defs/taskBase' @@ -300,7 +301,7 @@ $defs: enum: [ raw, content, response ] description: The http call output format. Defaults to 'content'. required: [ document, operationId ] - additionalProperties: false + unevaluatedProperties: false description: Defines the OpenAPI call to perform. - title: CallFunction $ref: '#/$defs/taskBase'