ricardozanini commented on code in PR #582:
URL: 
https://github.com/apache/incubator-kie-kogito-docs/pull/582#discussion_r1521750006


##########
serverlessworkflow/modules/ROOT/pages/core/understanding-jq-expressions.adoc:
##########
@@ -13,10 +13,27 @@ Each workflow instance is associated with a data model. A 
data model consists of
 
 The workflow expressions in the 
link:{spec_doc_url}#workflow-expressions[Serverless Workflow specification] are 
used to interact with the data model. The supported expression languages 
include link:{jsonpath_url}[JsonPath] and link:{jq_url}[jq]. jq expression 
language is the default language. However, you can change the expression 
language to JsonPath using the `expressionLang` property. 
 
-This document describes the usage of jq expressions in switch state 
conditions, action function arguments, and data filtering. 
+This document describes the usage of jq expressions in funtions, switch state 
conditions, action function arguments, data filtering and event publishing. 

Review Comment:
   ```suggestion
   This document describes the usage of jq expressions in functions, switch 
state conditions, action function arguments, data filtering, and event 
publishing. 
   ```



##########
serverlessworkflow/modules/ROOT/pages/core/understanding-jq-expressions.adoc:
##########
@@ -197,13 +214,37 @@ You can find an example of event data filtering in the 
link:{kogito_sw_examples_
 ----
 
 The previous example of the event filter copies the content of CloudEvent data 
`result` field into the workflow model `move` field.
+
+[[ref-example-jq-expression-event-publishing]]
+== Example of jq expressions in event publishing. 
+
+When publishing a Cloud Event, you can select the data that is being published 
using a jq expression that generates a json object. Note that in yaml double 
quotes are required to allow using `{}` characters. 

Review Comment:
   ```suggestion
   When publishing a Cloud Event, you can select the data that is being 
published using a jq expression that generates a JSON object. Note that in yaml 
double quotes are required to allow using `{}` characters. 
   ```



##########
serverlessworkflow/modules/ROOT/pages/core/understanding-jq-expressions.adoc:
##########
@@ -197,13 +214,37 @@ You can find an example of event data filtering in the 
link:{kogito_sw_examples_
 ----
 
 The previous example of the event filter copies the content of CloudEvent data 
`result` field into the workflow model `move` field.
+
+[[ref-example-jq-expression-event-publishing]]
+== Example of jq expressions in event publishing. 
+
+When publishing a Cloud Event, you can select the data that is being published 
using a jq expression that generates a json object. Note that in yaml double 
quotes are required to allow using `{}` characters. 
+
+.Example data expression returning an object
+[source,yaml]
+----
+transition:
+      nextState: WaitForSaveTransformationCompletionEvent
+      produceEvents:
+        - eventRef: saveTransformationEvent
+          data: "{gitRepo:.repositoryURL|sub(\"http(s)?://\";\"ssh://\"), 
branch: .targetBranch, token: .token, workspaceId: .workspaceId, projectId: 
.projectId, transformId: .transformId, workflowCallerId: $WORKFLOW.instanceId}" 
+----
+
+In previous example, a Cloud Event is published when the state transitioned. 
Its `data` field looks like 

Review Comment:
   ```suggestion
   In the previous example, a CloudEvent was published when the state 
transitioned. Its `data` field looks like 
   ```



##########
serverlessworkflow/modules/ROOT/pages/core/understanding-jq-expressions.adoc:
##########
@@ -212,6 +253,15 @@ So, assuming you have added to your 
`application.properties` a line with the `my
 }
 ----
 
+`$SECRET` always return a value of type string. If you want to use it into a 
comparison with a value that is not a string, you need to perform the 
conversion explicitly. In next example, `retries` property is a number, so we 
need to convert the property value accordingly by calling `tonumber` builtin jq 
function. 

Review Comment:
   ```suggestion
   `$SECRET` always returns a value of type string. If you want to use it in a 
comparison with a value that is not a string, you need to perform the 
conversion explicitly. In the next example, the `retries` property is a number, 
so we need to convert the property value accordingly by calling the `tonumber` 
built-in jq function. 
   ```



##########
serverlessworkflow/modules/ROOT/pages/core/understanding-jq-expressions.adoc:
##########
@@ -13,10 +13,27 @@ Each workflow instance is associated with a data model. A 
data model consists of
 
 The workflow expressions in the 
link:{spec_doc_url}#workflow-expressions[Serverless Workflow specification] are 
used to interact with the data model. The supported expression languages 
include link:{jsonpath_url}[JsonPath] and link:{jq_url}[jq]. jq expression 
language is the default language. However, you can change the expression 
language to JsonPath using the `expressionLang` property. 
 
-This document describes the usage of jq expressions in switch state 
conditions, action function arguments, and data filtering. 
+This document describes the usage of jq expressions in funtions, switch state 
conditions, action function arguments, data filtering and event publishing. 
 
 JQ expression might be tricky to master, for non trivial cases, it is 
recommended to use helper tools like link:{jq_play}[JQ Play] to validate the 
expression before including it in the workflow file. 
 
+[[ref-example-jq-expression-function]]
+== Example  of jq expression in functions
+
+Expressions can be used in functions of type `expression` to manipulate the 
workflow model. As any other function the result of the expression evaluation 
will be merged into the model

Review Comment:
   ```suggestion
   Expressions can be used in functions of type `expression` to manipulate the 
workflow model. As with any other function, the result of the expression 
evaluation will be merged into the model
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to