feat(proto): Add new field option to indicate a in id for subtypes

This allows for marking a field in a message as an id that can be used
to determine the message's subtype. When creating some resources, an id
from a related resource is used to indicate the resource's subtype,
since the resource must have the same subtype as the related resource.
pull/2031/head
Timothy Messier 4 years ago committed by Johan Brandhorst-Satzkorn
parent 760b090567
commit 8cbbfbe3a0

@ -20,6 +20,10 @@ extend google.protobuf.FieldOptions {
// 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;
}
extend google.protobuf.FileOptions {

@ -101,6 +101,14 @@ var file_controller_custom_options_v1_options_proto_extTypes = []protoimpl.Exten
Tag: "bytes,85555,opt,name=subtype",
Filename: "controller/custom_options/v1/options.proto",
},
{
ExtendedType: (*descriptorpb.FieldOptions)(nil),
ExtensionType: (*bool)(nil),
Field: 85556,
Name: "controller.custom_options.v1.subtype_source_id",
Tag: "varint,85556,opt,name=subtype_source_id",
Filename: "controller/custom_options/v1/options.proto",
},
{
ExtendedType: (*descriptorpb.FileOptions)(nil),
ExtensionType: (*string)(nil),
@ -131,6 +139,11 @@ var (
//
// optional string subtype = 85555;
E_Subtype = &file_controller_custom_options_v1_options_proto_extTypes[2]
// subtype_source_id is used to indicate that a field provided an id that can be used
// to determine the subtype of a message.
//
// optional bool subtype_source_id = 85556;
E_SubtypeSourceId = &file_controller_custom_options_v1_options_proto_extTypes[3]
)
// Extension fields to descriptorpb.FileOptions.
@ -138,7 +151,7 @@ var (
// domain is used to associate the messages in a file with a domain package.
//
// optional string domain = 85556;
E_Domain = &file_controller_custom_options_v1_options_proto_extTypes[3]
E_Domain = &file_controller_custom_options_v1_options_proto_extTypes[4]
)
var File_controller_custom_options_v1_options_proto protoreflect.FileDescriptor
@ -169,16 +182,21 @@ var file_controller_custom_options_v1_options_proto_rawDesc = []byte{
0x69, 0x6f, 0x6e, 0x3a, 0x39, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1d,
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb3, 0x9c,
0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x36,
0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb4, 0x9c, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x42, 0x4c, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62,
0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f,
0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x4b,
0x0a, 0x11, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x5f, 0x69, 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x18, 0xb4, 0x9c, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x74,
0x79, 0x70, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x3a, 0x36, 0x0a, 0x06, 0x64,
0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x18, 0xb4, 0x9c, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d,
0x61, 0x69, 0x6e, 0x42, 0x4c, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e,
0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e,
0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -203,12 +221,13 @@ var file_controller_custom_options_v1_options_proto_depIdxs = []int32{
1, // 0: controller.custom_options.v1.mask_mapping:extendee -> google.protobuf.FieldOptions
1, // 1: controller.custom_options.v1.generate_sdk_option:extendee -> google.protobuf.FieldOptions
1, // 2: controller.custom_options.v1.subtype:extendee -> google.protobuf.FieldOptions
2, // 3: controller.custom_options.v1.domain:extendee -> google.protobuf.FileOptions
0, // 4: controller.custom_options.v1.mask_mapping:type_name -> controller.custom_options.v1.MaskMapping
5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type
4, // [4:5] is the sub-list for extension type_name
0, // [0:4] is the sub-list for extension extendee
1, // 3: controller.custom_options.v1.subtype_source_id:extendee -> google.protobuf.FieldOptions
2, // 4: controller.custom_options.v1.domain:extendee -> google.protobuf.FileOptions
0, // 5: controller.custom_options.v1.mask_mapping:type_name -> controller.custom_options.v1.MaskMapping
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
5, // [5:6] is the sub-list for extension type_name
0, // [0:5] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
@ -238,7 +257,7 @@ func file_controller_custom_options_v1_options_proto_init() {
RawDescriptor: file_controller_custom_options_v1_options_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 4,
NumExtensions: 5,
NumServices: 0,
},
GoTypes: file_controller_custom_options_v1_options_proto_goTypes,

Loading…
Cancel
Save