feat(proto): Format protobuf files with buf (#2033)

Formats all protobuf files with buf format. This ensures
a consistent style across all our protobuf files, similar
to gofumpt.
This commit is contained in:
Johan Brandhorst-Satzkorn authored and GitHub committed 2022-05-04 11:10:21 -04:00
1 parent 0fb9b35498
commit f69fbf2255
131 files changed
+2329 -1618

No files matched your search

@@ -1,4 +1,5 @@
syntax = "proto3";
package controller.custom_options.v1;
import "google/protobuf/descriptor.proto";
@@ -6,32 +7,32 @@ import "google/protobuf/descriptor.proto";
option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions;protooptions";
extend google.protobuf.FieldOptions {
// mask_mapping is an option which tags a field with the expected field mask
// used by a companion proto if applied on the field this option is for.
// The value of this option should be for the field name itself and not for
// the json name.
MaskMapping mask_mapping = 85464;
// mask_mapping is an option which tags a field with the expected field mask
// used by a companion proto if applied on the field this option is for.
// The value of this option should be for the field name itself and not for
// the json name.
MaskMapping mask_mapping = 85464;
// generate_sdk_option is a directive used when generating the SDK to
// indicate that an option should be created for the field
bool generate_sdk_option = 85412;
// generate_sdk_option is a directive used when generating the SDK to
// indicate that an option should be created for the field
bool generate_sdk_option = 85412;
// subtype is used for oneOf attribute subtypes, to identify that we only need to parse attributes
// of oneOf once and not for each option when generating the API
// This will serve as a JSON key, used to transform that into the key the protobuf expects
string subtype = 85555;
// subtype is used for oneOf attribute subtypes, to identify that we only need to parse attributes
// of oneOf once and not for each option when generating the API
// This will serve as a JSON key, used to transform that into the key the protobuf expects
string subtype = 85555;
// subtype_source_id is used to indicate that a field provided an id that can be used
// to determine the subtype of a message.
bool subtype_source_id = 85556;
// subtype_source_id is used to indicate that a field provided an id that can be used
// to determine the subtype of a message.
bool subtype_source_id = 85556;
}
extend google.protobuf.FileOptions {
// domain is used to associate the messages in a file with a domain package.
string domain = 85556;
// domain is used to associate the messages in a file with a domain package.
string domain = 85556;
}
message MaskMapping {
string this = 1;
string that = 2;
string this = 1;
string that = 2;
}
@@ -1,51 +1,114 @@
syntax = "proto3";
package controller.custom_options.v1;
option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions;protooptions";
package controller.custom_options.v1;
import "controller/custom_options/v1/options.proto";
option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions;protooptions";
message TestBase {
string first_field = 1 [(mask_mapping) = {this: "first_field" that: "OtherFirstField"}];
string StrangeFormatField = 2 [(mask_mapping) = {this: "strangly_formatted_field" that: "other_second_field"}];
string field_with_different_json_name = 3 [json_name="json_name", (mask_mapping) = {this: "field3" that:"other_field_3"}];
string extra_field = 4;
string first_field = 1 [(mask_mapping) = {
this: "first_field"
that: "OtherFirstField"
}];
string StrangeFormatField = 2 [(mask_mapping) = {
this: "strangly_formatted_field"
that: "other_second_field"
}];
string field_with_different_json_name = 3 [
json_name = "json_name",
(mask_mapping) = {
this: "field3"
that: "other_field_3"
}
];
string extra_field = 4;
}
message TestBaseSplit1 {
string first_field = 1 [(mask_mapping) = {this: "first_field" that: "OtherFirstField"}];
string field_with_different_json_name = 2 [json_name="json_name", (mask_mapping) = {this: "field3" that:"other_field_3"}];
string extra_field = 3;
string first_field = 1 [(mask_mapping) = {
this: "first_field"
that: "OtherFirstField"
}];
string field_with_different_json_name = 2 [
json_name = "json_name",
(mask_mapping) = {
this: "field3"
that: "other_field_3"
}
];
string extra_field = 3;
}
message TestBaseSplit2 {
string split_field1 = 1 [(mask_mapping) = {this: "strangly_formatted_field" that: "other_second_field"}];
string split_field1 = 1 [(mask_mapping) = {
this: "strangly_formatted_field"
that: "other_second_field"
}];
}
message TestProperlyNamedFields {
string other_first_field = 1 [(mask_mapping) = {this: "OtherFirstField" that:"first_field"}];
string other_second_field = 2 [(mask_mapping) = {this: "other_second_field" that:"strangly_formatted_field"}];
string other_third_field = 3 [json_name="other_third_field", (mask_mapping) = {this: "other_field_3" that: "field3"}];
string another_extra_field = 4;
string other_first_field = 1 [(mask_mapping) = {
this: "OtherFirstField"
that: "first_field"
}];
string other_second_field = 2 [(mask_mapping) = {
this: "other_second_field"
that: "strangly_formatted_field"
}];
string other_third_field = 3 [
json_name = "other_third_field",
(mask_mapping) = {
this: "other_field_3"
that: "field3"
}
];
string another_extra_field = 4;
}
message TestNameDoesntMap {
string first_doesnt_map = 1 [(mask_mapping) = {this: "first_doesnt_map" that: "first_field"}];
string second_doesnt_map = 2 [(mask_mapping) = {this: "second_doesnt_map" that:"StrangeFormatField"}];
string third_doesnt_map = 3 [(mask_mapping) = {this: "third_doesnt_map" that:"field_with_different_json_name"}];
string another_extra_field = 4;
string first_doesnt_map = 1 [(mask_mapping) = {
this: "first_doesnt_map"
that: "first_field"
}];
string second_doesnt_map = 2 [(mask_mapping) = {
this: "second_doesnt_map"
that: "StrangeFormatField"
}];
string third_doesnt_map = 3 [(mask_mapping) = {
this: "third_doesnt_map"
that: "field_with_different_json_name"
}];
string another_extra_field = 4;
}
message TestNotEnoughFields {
string other_first_field = 1 [(mask_mapping) = {this: "OtherFirstField" that:"first_field"}];
string other_second_field = 2 [(mask_mapping) = {this: "other_second_field" that:"strangly_formatted_field"}];
string other_first_field = 1 [(mask_mapping) = {
this: "OtherFirstField"
that: "first_field"
}];
string other_second_field = 2 [(mask_mapping) = {
this: "other_second_field"
that: "strangly_formatted_field"
}];
}
message TestManyToOneMappings {
string other_first_field = 1 [(mask_mapping) = {this: "OtherFirstField" that:"first_field"}];
string other_second_field = 2 [(mask_mapping) = {this: "other_second_field" that:"strangly_formatted_field"}];
string other_third_field = 3 [(mask_mapping) = {this: "other_field_3" that: "field3"}];
// this field maps to the first_field like 'other_first_field'
string extra_field = 4 [(mask_mapping) = {this: "ExtraField" that:"first_field"}];
}
string other_first_field = 1 [(mask_mapping) = {
this: "OtherFirstField"
that: "first_field"
}];
string other_second_field = 2 [(mask_mapping) = {
this: "other_second_field"
that: "strangly_formatted_field"
}];
string other_third_field = 3 [(mask_mapping) = {
this: "other_field_3"
that: "field3"
}];
// this field maps to the first_field like 'other_first_field'
string extra_field = 4 [(mask_mapping) = {
this: "ExtraField"
that: "first_field"
}];
}