Commit 80dbb4d
committed
Add fieldmask rule to check for accept/reject paths
This adds support for the well-known type google.protobuf.FieldMask:
- accept: allowed paths (violation if unlisted paths are encountered)
- reject: disallowed paths (violation if any specified path is encountered)
```proto
message MyFieldMask {
// The `value` FieldMask must only contain paths listed in `accept`.
google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = {
accept: ["a", "b", "c.a"]
}];
}
```
```proto
message MyFieldMask {
// The `value` FieldMask shall not contain paths listed in `reject`.
google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = {
reject: ["forbidden", "immutable", "c.a"]
}];
}
```
Closes #428.
Signed-off-by: Christoph Hoopmann <[email protected]>1 parent 2b82469 commit 80dbb4d
File tree
7 files changed
+666
-112
lines changed- proto
- protovalidate-testing/buf/validate/conformance/cases
- protovalidate/buf/validate
- tools
- internal/gen/buf/validate
- conformance/cases
- protovalidate-conformance/internal/cases
7 files changed
+666
-112
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
316 | 317 | | |
317 | 318 | | |
318 | 319 | | |
| |||
4605 | 4606 | | |
4606 | 4607 | | |
4607 | 4608 | | |
| 4609 | + | |
| 4610 | + | |
| 4611 | + | |
| 4612 | + | |
| 4613 | + | |
| 4614 | + | |
| 4615 | + | |
| 4616 | + | |
| 4617 | + | |
| 4618 | + | |
| 4619 | + | |
| 4620 | + | |
| 4621 | + | |
| 4622 | + | |
| 4623 | + | |
| 4624 | + | |
| 4625 | + | |
| 4626 | + | |
| 4627 | + | |
| 4628 | + | |
| 4629 | + | |
| 4630 | + | |
| 4631 | + | |
| 4632 | + | |
| 4633 | + | |
| 4634 | + | |
| 4635 | + | |
| 4636 | + | |
| 4637 | + | |
| 4638 | + | |
| 4639 | + | |
| 4640 | + | |
| 4641 | + | |
| 4642 | + | |
| 4643 | + | |
| 4644 | + | |
| 4645 | + | |
| 4646 | + | |
| 4647 | + | |
| 4648 | + | |
| 4649 | + | |
| 4650 | + | |
| 4651 | + | |
| 4652 | + | |
| 4653 | + | |
| 4654 | + | |
| 4655 | + | |
4608 | 4656 | | |
4609 | 4657 | | |
4610 | 4658 | | |
| |||
0 commit comments