This is my .proto file
syntax = "proto3";
package testing;
option java_multiple_files = true;
option java_package = "com.api.commons.proto";
option java_outer_classname = "SampleProto";
message Person {
string name = 1;
int32 id = 2;
string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
string number = 1;
PhoneType type = 2;
}
repeated PhoneNumber phones = 4;
map<string, string> map = 5;
}
When I try to compile the proto file, the proto related java files create successfully. but open that file I see the error method. I am given below to attach that error case.
Now I am changing all fields to optional this error case not reproduced... My doubt is in proto3 all fields by default optional then why this issue fixed, when I change all fields to optional. Thanks