-
Notifications
You must be signed in to change notification settings - Fork 341
Description
GitHub repository with your minimal reproducible example (do not leave this field blank or fill out this field with "github.com/bufbuild/buf" or we will automatically close your issue, see the instructions above!)
https://github.com/bufbuild/buf
Commands
buf {lint, breaking}
message GroupFoo {
// buf:lint:ignore FIELD_NOT_REQUIRED
required group Metadata = 1 { /* fields in group */ }
}Output
proto/test/foo.proto:8:12:field Foo.Metadata.id: field has no label; proto2 requires explicit 'optional' labelExpected Output
Expect the comment ignore to be respected.
Anything else?
I did some investigation and this has to do with the synthetic type produced for group fields. The leading comment is being attributed to the synthetic message declaration rather than the field declaration.
My suggested fix for the current implementation would be to resolve the descriptor from the given source path. This is tricky because we would need to parse the source path and effectively walk the descriptor tree, determine whether the source path is a field, check if it's a group field, and then finally resolve the associated synthetic message.
For now, there is a workaround, to apply the comment ignore to the containing message of the group field. This isn't great, since the comment ignore would apply to all fields in the containing message.