-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes inconsistencies between listen
and emit
#926
Fixes inconsistencies between listen
and emit
#926
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me, thank you so much! ❤️
Aside from a small typo, I'm wondering whether the term event
applies to with
.
IMHO, we should find a term that best describes it: as a matter of fact, it's not an event
, which is a term that could confuse users, but rather eventProperties
or something like that. WDYT?
Signed-off-by: Jean-Baptiste Bianchi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much bro! ❤️
@JBBianchi can you please rebase? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, @JBBianchi! Just left a few comments if you don't mind. Also, do you mind adding a few examples to validate the change? Thanks!
dsl-reference.md
Outdated
@@ -368,7 +369,7 @@ The [HTTP Call](#http-call) enables workflows to interact with external services | |||
| Name | Type | Required | Description| | |||
|:--|:---:|:---:|:---| | |||
| method | `string` | `yes` | The HTTP request method. | | |||
| endpoint | [`endpoint`](#endpoint) | `yes` | An URI or an object that describes the HTTP endpoint to call. | | |||
| endpoint | `string`\|[`endpoint`](#endpoint) | `yes` | An URI or an object that describes the HTTP endpoint to call. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this \
scape char here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise it breaks the table formatting (like adding an extra cell).
dsl-reference.md
Outdated
@@ -528,9 +530,9 @@ Allows workflows to iterate over a collection of items, executing a defined set | |||
| Name | Type | Required | Description| | |||
|:--|:---:|:---:|:---| | |||
| for.each | `string` | `no` | The name of the variable used to store the current item being enumerated.<br>Defaults to `item`. | | |||
| for.in | `string` | `yes` | A [runtime expression](#runtime-expressions) used to get the collection to enumerate. | | |||
| for.in | `string` | `yes` | A [runtime expression](dsl.md##runtime-expressions) used to get the collection to enumerate. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the double anchor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a mistake, good catch.
dsl-reference.md
Outdated
| for.at | `string` | `no` | The name of the variable used to store the index of the current item being enumerated.<br>Defaults to `index`. | | ||
| while | `string` | `no` | A [runtime expression](#runtime-expressions) that represents the condition, if any, that must be met for the iteration to continue. | | ||
| while | `string` | `no` | A [runtime expression](dsl.md##runtime-expressions) that represents the condition, if any, that must be met for the iteration to continue. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
dsl-reference.md
Outdated
@@ -1389,6 +1391,28 @@ Represents the configuration of an event consumption strategy. | |||
| any | [`eventFilter[]`](#event-filter) | `no` | Configures the workflow to wait for any of the defined events before resuming execution.<br>*Required if `all` and `one` have not been set.* | | |||
| one | [`eventFilter`](#event-filter) | `no` | Configures the workflow to wait for the defined event before resuming execution.<br>*Required if `all` and `any` have not been set.* | | |||
|
|||
### Event Properties | |||
|
|||
An event object typically includes details such as the event type, source, timestamp, and unique identifier, along with any relevant data payload. The [Cloud Events specification](https://cloudevents.io/), favored by Serveless Workflow, standardizes this structure to ensure interoperability across different systems and services. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An event object typically includes details such as the event type, source, timestamp, and unique identifier, along with any relevant data payload. The [Cloud Events specification](https://cloudevents.io/), favored by Serveless Workflow, standardizes this structure to ensure interoperability across different systems and services. | |
An event object typically includes details such as the event type, source, timestamp, and unique identifier along with any relevant data payload. The [Cloud Events specification](https://cloudevents.io/), favored by Serverless Workflow, standardizes this structure to ensure interoperability across different systems and services. |
dsl-reference.md
Outdated
|----------|:----:|:--------:|-------------| | ||
| id | `string` | `no` | Identifies the event. `source` + `id` is unique for each distinct event.<br>*Required when emitting an event using `emit.event.with`.* | | ||
| source | `string` | `no` | An URI formatted string that identifies the context in which an event happened. `source` + `id` is unique for each distinct event.<br>*Required when emitting an event using `emit.event.with`.* | | ||
| type | `string` | `no` | Describes the type of event related to the originating occurrence. `source` + `id` is unique for each distinct event.<br>*Required when emitting an event using `emit.event.with`.* | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| type | `string` | `no` | Describes the type of event related to the originating occurrence. `source` + `id` is unique for each distinct event.<br>*Required when emitting an event using `emit.event.with`.* | | |
| type | `string` | `no` | Describes the type of event related to the originating occurrence. <br>*Required when emitting an event using `emit.event.with`.* | |
dsl-reference.md
Outdated
| dataschema | `string` | `no` | An URI that identifies the schema that `data` adheres to. | | ||
| data | `object` | `no` | The event payload. | | ||
|
||
*Additional properties can be supplied.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth linking to https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md#extension-context-attributes. Any properties not listed in the CE spec are considered to be extensions.
dsl-reference.md
Outdated
@@ -1473,7 +1497,7 @@ When set, runtimes must validate input data against the defined schema, unless d | |||
| Property | Type | Required | Description | | |||
|----------|:----:|:--------:|-------------| | |||
| schema | [`schema`](#schema) | `no` | The [`schema`](#schema) used to describe and validate input data.<br>*Even though the schema is not required, it is strongly encouraged to document it, whenever feasible.* | | |||
| from | `string`<br>`object` | `no` | A [runtime expression](#runtime-expressions), if any, used to filter and/or mutate the workflow/task input. | | |||
| from | `string`<br>`object` | `no` | A [runtime expression](dsl.md##runtime-expressions), if any, used to filter and/or mutate the workflow/task input. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| from | `string`<br>`object` | `no` | A [runtime expression](dsl.md##runtime-expressions), if any, used to filter and/or mutate the workflow/task input. | | |
| from | `string`<br>`object` | `no` | A [runtime expression](dsl.md#runtime-expressions), if any, used to filter and/or mutate the workflow/task input. | |
dsl-reference.md
Outdated
@@ -1397,7 +1421,7 @@ An event filter is a mechanism used to selectively process or handle events base | |||
|
|||
| Property | Type | Required | Description | | |||
|----------|:----:|:--------:|-------------| | |||
| with | `object` | `yes` | A name/value mapping of the attributes filtered events must define. Supports both regular expressions and runtime expressions. | | |||
| with | [`eventProperties`](#event-properties) | `yes` | A name/value mapping of the attributes filtered events must define. Supports both regular expressions and runtime expressions. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this type in the schema can be the new definition introduced by @matthias-pichler-warrify and also a pattern? Maybe it's worth updating the schema?
dsl-reference.md
Outdated
@@ -1502,7 +1526,7 @@ When set, runtimes must validate output data against the defined schema, unless | |||
| Property | Type | Required | Description | | |||
|----------|:----:|:--------:|-------------| | |||
| schema | [`schema`](#schema) | `no` | The [`schema`](#schema) used to describe and validate output data.<br>*Even though the schema is not required, it is strongly encouraged to document it, whenever feasible.* | | |||
| as | `string`<br>`object` | `no` | A [runtime expression](#runtime-expressions), if any, used to filter and/or mutate the workflow/task output. | | |||
| as | `string`<br>`object` | `no` | A [runtime expression](dsl.md##runtime-expressions), if any, used to filter and/or mutate the workflow/task output. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| as | `string`<br>`object` | `no` | A [runtime expression](dsl.md##runtime-expressions), if any, used to filter and/or mutate the workflow/task output. | | |
| as | `string`<br>`object` | `no` | A [runtime expression](dsl.md#runtime-expressions), if any, used to filter and/or mutate the workflow/task output. | |
schema/workflow.yaml
Outdated
@@ -830,28 +837,8 @@ $defs: | |||
properties: | |||
with: | |||
title: WithEvent | |||
type: object | |||
$ref: '#/$defs/eventProperties' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one could be a OneOf
of expression, pattern, or eventProperties
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about that one. @cdavernas @fjtirado @matthias-pichler-warrify wdyt ?
2bab1f5
to
f25a9f5
Compare
Please specify parts of this PR update:
Discussion or Issue link:
Closes #917 (and other little minor typo)
What this PR does:
listen
andemit
event
section in the specification documentationemit
in the specification documentationevent
definition in the JSON schema and referenced it inemit.event.with
andeventFilter.with
endpoint
by addingstring
endpoint
section in the specification documentationhttps://https://
implictly
Additional information:
-