[Good First Issues]: implement function "capitalize_word" - 8 points
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
This function is used to capitalize all words in a string of an existed json element.
Description
Function name: capitalize_word
Function args:
- path: the json path of the string which needs to be capitalized.
Function description: Capitalize all words in a string of an existed json element. The previous value of the json object will be replaced.
Example
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" : "this is jay ding",
"appinfoB" : 123,
"appinfoC" : true
}
}
After the function "capitalize_word":
"pipeline":[
{"command":["capitalize_word","$.data.appinfoA"]}
]
The transformed event should look like:
{
"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" : "This Is Jay Ding",
"appinfoB" : 123,
"appinfoC" : true
}
}
How to implement
- Fork the vanus repository.
- Create a branch
function-capitalize-word
- Create
capitalize_word.go
underinternal/primitive/transform/action/strings
, and then implement the function. - Create
capitalize_word_test.go
underinternal/primitive/transform/action/strings
for unit test. - Register your function in
internal/primitive/transform/runtime/init.go
. - Submit your PR
Contribution points
Each issue counts specific points based on its difficulty. Contributors earn the corresponding points if they solve that issue. Contribution points are used to describe the contributions contributors have made. They can also be used to get rewards when there are community events.
This issue counts 8 points.
How to claim to solve the issue
If you want to implement this function, please leave a comment in this issue like:
I'd like to implement this function, please assign this issue to me.
Vanus community will assign the issue to you on time.
I would like to implement this function. Please assign it to me.( I am a beginner and have not worked with go before, but really interested to learn go and want to contribute to the project )
I would like to implement this function. Please assign it to me.( I am a beginner and have not worked with go before, but really interested to learn go and want to contribute to the project )
Hi thanks you for your comment, I will assign it to you.
I would like to implement this function. Please assign it to me.( I am a beginner and have not worked with go before, but really interested to learn go and want to contribute to the project )
Hi @varuntumbe ,how is it going with this function? You may have some questions during implementation, Join the Slack channel to discuss with other developers. Also there you can know details about how to get contribution rewards.
I'd like to implement this function if no one else has made progress for this. I'm fairly new with go but I want to contribute.
I'd like to implement this function if no one else has made progress for this. I'm fairly new with go but I want to contribute.
@faculerena
Sure, glad to hear you wanna try this. I will assign it to you.
@faculerena how is it going? Its been a while now?