webhook icon indicating copy to clipboard operation
webhook copied to clipboard

Reference to any array element with match

Open volcano1111 opened this issue 4 years ago • 1 comments

Hello. I'm trying to set up a webhook match rule for referencing to a nested value in the JSON payload. This is an example JSON: { "commits": [ {"title": "Test"}, {"title": "Merge"} ] } And here's part of my trigger-rule:

    - match:
        type: regex
        regex: ^Merge
        parameter:
          source: payload
          name: commits..title

The thing is there may be an uncertain number of commits in JSON and I need to match any of it. This is why I can't refer to specific JSON values. I was trying to set values like name: commits.title, name: commits..title or name: commits.[].title, but it doesn't work. The error from the log file: "parameter node not found". Is it a bug or a feature? Is there any way to match any nested value?

volcano1111 avatar Jan 29 '21 08:01 volcano1111

Unfortunately, this is not currently possible. References to array elements must be explicit.

So let's turn this into an enhancement request.

moorereason avatar Jan 29 '21 18:01 moorereason