vanus icon indicating copy to clipboard operation
vanus copied to clipboard

[Good First Issues]: implement new functions for Vanus transformer

Open JieDing opened this issue 3 years ago • 0 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

  • [x] #372

strings

  • [x] #373
  • [x] #374
  • [x] #375
  • [x] #376
  • [x] #438
  • [ ] #430
  • [ ] #462
  • [x] #428
  • [x] #427
  • [x] #426
  • [x] #425
  • [x] #422
  • [x] #421

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.

JieDing avatar Dec 20 '22 13:12 JieDing