JSON Echo Service with clean architecture based on Go-clean-template.
Service returns the JSON-document that was passed to it. When rewrite rules are active the document will be overwritten considering them.
- Overwriting recursion for JSON-documents & unit-tests
- Echo REST-HTTP & integration-tests
- Swagger Docs
Rewrite rules are stored in config/config.yaml
rewriter:
active: true
rules:
name: "pokemon"
value: "pikachu"
new: "bulbasaur"To activate rewriter - set active field to true, deactivate -false.
nameandvaluerepresents field name and field value of document which should be overwrittennewrepresents new field value for that pair
Example above will be rewritten like this:
"pokemon":"pikachu" -> "pokemon":"bulbasaur"
Pair of field name and field value will be found anywhere deep in document:
{
"pokemon": "pikachu",
"some_object": {
"pokemon":"pikachu"
},
"another_object": {
"in_object": {
"pokemon":"pikachu"
}
},
"some_array": [
{
"in_array": [
{
"pokemon": "pikachu"
}
]
}
]
}result:
{
"pokemon": "bulbasaur",
"some_object": {
"pokemon":"bulbasaur"
},
"another_object": {
"in_object": {
"pokemon": "bulbasaur"
}
},
"some_array": [
{
"in_array": [
{
"pokemon": "bulbasaur"
}
]
}
]
}# Run app
$ make run
# Or build docker container
$ make compose-up