mergeable icon indicating copy to clipboard operation
mergeable copied to clipboard

Tool assumes every event has an action

Open abid-mujtaba opened this issue 4 years ago • 2 comments

At multiple locations in the code base the tool assumes that every event has an action property in its payload (see example).

There a number of events which do not have an action, for example push, and status (which has a useful state property in the payload which would be useful to filter with when calculating supported events).

Proposed Solution

  1. Add a module for calculating the full event name.
  2. Refactor tool to use a function from the module wherever we construct the full event name using template strings.
  3. Modify this function to use payload.action where available, payload.state for status events, and nothing at all for push.

abid-mujtaba avatar Dec 12 '21 14:12 abid-mujtaba

@abid-mujtaba that's a great observation, do you have any specific use case where this might be useful? I understand that it'll be cleaner but i was also wondering if there are specific use cases that this opens up.

shine2lay avatar Dec 22 '21 21:12 shine2lay

When I was developing PR #602 I realized that the user must always target status.* and cannot target specific status states such as status.success because status events do not have action in the payload (but state instead). Because of this the baseRef validator will be triggered for all status events even though it is really only useful for success status events.

abid-mujtaba avatar Dec 23 '21 02:12 abid-mujtaba