opensearch-project / opensearch-project/alerting
[BUG][QUESTION] How to work around JSON templating for Webhooks?
@adityaj1107 is already working on this.
Since Jun 28, 2021.
- Dominant language
- Kotlin
- Stars
- 82
- Forks
- 133
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 9
Description
Issue by DandyDeveloper
Friday Apr 03, 2020 at 08:32 GMT
Originally opened as https://github.com/opendistro-for-elasticsearch/alerting/issues/196
I can't see a previous discussion on this, and I don't know how to workaround it. I don't consider this a bug in Open ES, but because of the inherent expectations for the recipients to receive JSON objects, how do we deal with this?
What do we do when dealing with JSON object on webhooks? Current templating with aggregations basically makes it impossible due to trailing commas.
For example, using any kind of templating requires iterations over an object in the ES response object. However, every json iteration that will be separated by a comma will always have a trailing comma like so:
{
"obj1": "val1",
"obj2": "val2",
"obj3": "val3",
"obj4": "val4", <- Sadface
}
The vast majority of JSON compliant webhooks will reject this / fail to decode the JSON object on the other end.
Any suggestions on how to get around this?
Discussion here: https://discuss.opendistrocommunity.dev/t/mustache-template-function-removing-trailing-comma/2528
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.