Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference to any array element with match #504

Open
volcano1111 opened this issue Jan 29, 2021 · 1 comment
Open

Reference to any array element with match #504

volcano1111 opened this issue Jan 29, 2021 · 1 comment

Comments

@volcano1111
Copy link

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?

@moorereason
Copy link
Collaborator

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

So let's turn this into an enhancement request.

@moorereason moorereason changed the title Reference to any nested value? Reference to any array element with match Jan 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants