[Good First Issues]: implement new functions for Vanus transformer
JieDing opened this issue · comments
Motivation
Vanus Functions are a series of pre-built functions worked within Vanus transformer. By choosing a function, users can specify the way that events will be changed.
It will be a good start if you decide to contribute to Vanus codes.
Details
For example, if users' original event looks like this:
{
"specversion" : "1.0",
"type" : "com.example.someevent",
"source" : "/mycontext",
"subject": null,
"id" : "C234-1234-1234",
"time" : "2018-04-05T17:31:00Z",
"comexampleextension1" : "value",
"comexampleothervalue" : 5,
"datacontenttype" : "application/json",
"data" : {
"appinfoA" : "abc",
"appinfoB" : 123,
"appinfoC" : true
}
}
Now we can make some changes to the original event by creating a function pipeline. All functions will be executed by the order of functions defined in the pipeline. Each function consists of a function name
and an array of function parameters
.
For example, the create
function below will create a new json node with the key "data.source", and the value of JSON node "$.source". And the delete
function below will delete the json node with the key "$.data.appinfoA".
"pipeline":[
{"command":["create","$.data.source","$.source"]},
{"command":["delete","$.data.appinfoA"]}
]
Function List
structs
strings
array
datetime
math
condition
How to join the event
If you want to implement a specific function, please leave a comment in corresponding issues like:
I'd like to implement this function, please assign this issue to me.
Vanus community will assign the issue to you on time.
Submit a pull request to suggest your changes.