diff --git a/.ci/validation/test/fixtures/invalid/listen-any-empty-no-until.yaml b/.ci/validation/test/fixtures/invalid/listen-any-empty-no-until.yaml deleted file mode 100644 index 5c9aef15..00000000 --- a/.ci/validation/test/fixtures/invalid/listen-any-empty-no-until.yaml +++ /dev/null @@ -1,10 +0,0 @@ -document: - dsl: '1.0.0-alpha1' - namespace: test - name: listen-to-any - version: '0.1.0' -do: - - callDoctor: - listen: - to: - any: [] \ No newline at end of file diff --git a/dsl-reference.md b/dsl-reference.md index b10f3b3f..6358db78 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -1591,9 +1591,9 @@ Represents the configuration of an event consumption strategy. | Property | Type | Required | Description | |----------|:----:|:--------:|-------------| | all | [`eventFilter[]`](#event-filter) | `no` | Configures the workflow to wait for all defined events before resuming execution.
*Required if `any` and `one` have not been set.* | -| any | [`eventFilter[]`](#event-filter) | `no` | Configures the workflow to wait for any of the defined events before resuming execution.
*Required if `all` and `one` have not been set.*
*If empty, listens to all incoming events, and requires `until` to be set.* | +| any | [`eventFilter[]`](#event-filter) | `no` | Configures the workflow to wait for any of the defined events before resuming execution.
*Required if `all` and `one` have not been set.*
*If empty, listens to all incoming events* | | one | [`eventFilter`](#event-filter) | `no` | Configures the workflow to wait for the defined event before resuming execution.
*Required if `all` and `any` have not been set.* | -| until | `string`
[`eventConsumptionStrategy`](#event-consumption-strategy) | `no` | Configures the [runtime expression](dsl.md#runtime-expressions) condition or the events that must be consumed to stop listening.
*Only applies if `any` has been set, otherwise ignored.* | +| until | `string`
[`eventConsumptionStrategy`](#event-consumption-strategy) | `no` | Configures the [runtime expression](dsl.md#runtime-expressions) condition or the events that must be consumed to stop listening.
*Only applies if `any` has been set, otherwise ignored.*
*If not present, once any event is received, it proceeds to the next task.* | ### Event Properties diff --git a/examples/listen-to-any-filter.yaml b/examples/listen-to-any-filter.yaml new file mode 100644 index 00000000..677e8e51 --- /dev/null +++ b/examples/listen-to-any-filter.yaml @@ -0,0 +1,16 @@ +document: + dsl: '1.0.0-alpha5' + namespace: test + name: listen-to-any-filter + version: '0.1.0' +do: + - callDoctor: + listen: + to: + any: + - with: + type: com.fake-hospital.vitals.measurements.temperature + data: ${ .temperature > 38 } + - with: + type: com.fake-hospital.vitals.measurements.bpm + data: ${ .bpm < 60 or .bpm > 100 } \ No newline at end of file diff --git a/examples/listen-to-any.yaml b/examples/listen-to-any.yaml index fa8794d3..b4a9fcb9 100644 --- a/examples/listen-to-any.yaml +++ b/examples/listen-to-any.yaml @@ -7,10 +7,4 @@ do: - callDoctor: listen: to: - any: - - with: - type: com.fake-hospital.vitals.measurements.temperature - data: ${ .temperature > 38 } - - with: - type: com.fake-hospital.vitals.measurements.bpm - data: ${ .bpm < 60 or .bpm > 100 } \ No newline at end of file + any: [] \ No newline at end of file diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 59565a6d..54a8f7ad 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -1325,47 +1325,25 @@ $defs: $ref: '#/$defs/eventFilter' required: [ all ] - title: AnyEventConsumptionStrategy - oneOf: - - properties: - any: - type: array - title: AnyEventConsumptionStrategyConfiguration - description: A list containing any of the events to consume. - items: - $ref: '#/$defs/eventFilter' - minItems: 1 - until: - oneOf: - - type: string - title: AnyEventUntilCondition - description: A runtime expression condition evaluated after consuming an event and which determines whether or not to continue listening. - - allOf: - - $ref: '#/$defs/eventConsumptionStrategy' - title: AnyEventUntilConsumed - description: The strategy that defines the event(s) to consume to stop listening. - - properties: - until: false - required: [ any ] - - properties: - any: - type: array - title: AnyEventConsumptionStrategyConfiguration - description: A list containing any of the events to consume. - items: - $ref: '#/$defs/eventFilter' - maxItems: 0 - until: - oneOf: - - type: string - title: AnyEventUntilCondition - description: A runtime expression condition evaluated after consuming an event and which determines whether or not to continue listening. - - allOf: - - $ref: '#/$defs/eventConsumptionStrategy' - title: AnyEventUntilConsumed - description: The strategy that defines the event(s) to consume to stop listening. - - properties: - until: false - required: [ any, until ] + properties: + any: + type: array + title: AnyEventConsumptionStrategyConfiguration + description: A list containing any of the events to consume. + items: + $ref: '#/$defs/eventFilter' + until: + oneOf: + - type: string + title: AnyEventUntilCondition + description: A runtime expression condition evaluated after consuming an event and which determines whether or not to continue listening. + - allOf: + - $ref: '#/$defs/eventConsumptionStrategy' + description: The strategy that defines the event(s) to consume to stop listening. + - properties: + until: false + title: AnyEventUntilConsumed + required: [ any ] - title: OneEventConsumptionStrategy properties: one: