aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

(aws-events): `Match.exists()` and `Match.doesNotExist()` is swapped out

Open AlessandroVol23 opened this issue 3 years ago • 7 comments

Describe the issue

I think the documentation of both functions is somehow swapped.

Exists documentation explains:

Matches when the field is absent from the JSON of the event.

Doesn't exist documentation explains:

Matches when the field is present in the JSON of the event.

Either I get the functions completely wrong or the docs are wrong.

Also from the code

  /**
   * Matches when the field is absent from the JSON of the event
   */
  public static exists(): string[] {
    return this.fromObjects([{ exists: true }]);
  }

  /**
   * Matches when the field is present in the JSON of the event
   */
  public static doesNotExist(): string[] {
    return this.fromObjects([{ exists: false }]);
  }

I understand it should be vice-versa.

Links

Does not exist: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.Match.html#static-doeswbrnotwbrexist

Exist: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.Match.html#static-exists

AlessandroVol23 avatar Dec 27 '22 09:12 AlessandroVol23

Yeah, these should be swapped. Good catch! Thanks for calling it out @AlessandroVol23. Would you like to submit a PR to fix this yourself?

peterwoodworth avatar Dec 27 '22 21:12 peterwoodworth

If it's ok I'd like to pick this up 👍

HBobertz avatar Dec 28 '22 16:12 HBobertz

Go for it @HBobertz !

peterwoodworth avatar Dec 28 '22 20:12 peterwoodworth

If it's ok I'd like to pick this up 👍

Yes please do that :)! I checked it out briefly but I don't have the repo running locally so it would take me some more time 😉

Thanks!

AlessandroVol23 avatar Dec 29 '22 05:12 AlessandroVol23

When I went to pick this up I thought there might be an actual logic change to this 😅, or at least that it'd be more involved. Regardless change is out

HBobertz avatar Jan 04 '23 18:01 HBobertz

@HBobertz great, thanks! Be sure to remember to have fixes or closes before the issue number so that the issue gets autoclosed on merge like so: fixes #23469 🙂

peterwoodworth avatar Jan 04 '23 20:01 peterwoodworth

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Jan 04 '23 20:01 github-actions[bot]