You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GitHub repository with your minimal reproducible example (do not fill out this field with "github.com/bufbuild/buf" or we will automatically close your issue, see the instructions above!)
syntax = 'proto3';
package module;
import "google/api/annotations.proto";
service Service {
rpc Method(Message) returns (Message) {
option (google.api.http) = {
additional_bindings: []
additional_bindings: [] /* This comment is safe */
additional_bindings: []
body: "*" // but this one is
};
}
}
message Message {}
Expected Output
syntax = 'proto3';
package module;
import "google/api/annotations.proto";
service Service {
rpc Method(Message) returns (Message) {
option (google.api.http) = {
additional_bindings: [] /* This comment will get deleted */
additional_bindings: [] /* This comment is safe */
additional_bindings: [] /* this one is not */
body: "*" // but this one is
};
}
}
message Message {}
Anything else?
This issue seems to occur only under specific circumstances. We noticed it only after empty repeated options with a trailing comma, like my_option: [], // this comment gets deleted. If you remove the trailing comma, or the comment is after a different type (string, int), the comment is safe.
We have not tested much further, like what if the repeated field is populated, or after a nested message, or if the option occurs in a message options, field options, service options, file options.
The text was updated successfully, but these errors were encountered:
Hi @anzboi, really appreciate the repro, it was extremely helpful and we were able to figure out the issue and a fix is on the way. There are a couple of details related to the fix that we need to iron out, but I'll keep this issue updated!
GitHub repository with your minimal reproducible example (do not fill out this field with "github.com/bufbuild/buf" or we will automatically close your issue, see the instructions above!)
https://github.com/anzboi/buf-bugs
Commands
Output
Expected Output
Anything else?
This issue seems to occur only under specific circumstances. We noticed it only after empty repeated options with a trailing comma, like
my_option: [], // this comment gets deleted
. If you remove the trailing comma, or the comment is after a different type (string, int), the comment is safe.We have not tested much further, like what if the repeated field is populated, or after a nested message, or if the option occurs in a message options, field options, service options, file options.
The text was updated successfully, but these errors were encountered: