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

Fix lint for repeated protovalidate CEL expression #2824

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

emcfarlane
Copy link
Contributor

This PR fixes linting for repeated fields with CEL expressions. Adds a new test case for lists (and maps) to ensure a valid expression passes. Small fix to set the type 'this' to the list element type.

Before:

testdata/protovalidate_rules/cel_field.proto:126:9:(buf.validate.field).repeated.items.cel.expression on field "allow_cidr" fails to compile: found no matching overload for 'isIpPrefix' applied to 'list(string).(int, bool)'
         | this.isIpPrefix(4, true)
         | ...............^

This PR fixes linting for repeated fiels with CEL expressions. Adds a
new test case for lists (and maps) to ensure a valid expression passes.
Small fix to set the type 'this' to the list element type.

Before:
```
testdata/protovalidate_rules/cel_field.proto:126:9:(buf.validate.field).repeated.items.cel.expression on field "allow_cidr" fails to compile: found no matching overload for 'isIpPrefix' applied to 'list(string).(int, bool)'
         | this.isIpPrefix(4, true)
         | ...............^
```
@emcfarlane emcfarlane merged commit 0912c7e into main Mar 19, 2024
10 checks passed
@emcfarlane emcfarlane deleted the ed/fixLintRepeatedCEL branch March 19, 2024 13:46
emcfarlane added a commit that referenced this pull request Apr 3, 2024
Add missing changelog updates.
- #2824
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants