Skip to content

Fix lint for repeated protovalidate CEL expression#2824

Merged
emcfarlane merged 1 commit intomainfrom
ed/fixLintRepeatedCEL
Mar 19, 2024
Merged

Fix lint for repeated protovalidate CEL expression#2824
emcfarlane merged 1 commit intomainfrom
ed/fixLintRepeatedCEL

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
@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