protocol-buffersgrpcgrpc-javagrpc-pythonprotobuf-python

I want to use "." in message field name of .proto file


I defined .proto file like:

syntax = "proto3";

message networkSliceArray
{

  int32 DRB.UEThpDl.SNSSAI = 1;

  int32 DRB.UEThpUl.SNSSAI = 2;

  string networkSliceIdentifier = 3;

}

I want to parse such type of file. is it possible? or if not possible is there any reference where i can find out why "." we can not used in protobuf. OR list of character that we can not defined in .proto file.


Solution

  • Your question is not really clear but I think you are asking why protoc outputs an error when processing the .proto file in your question.

    The language specification sets out what constitutes a valid proto3 file. Your question is about field names so the relevant parts are:

    field = [ "repeated" ] type fieldName "=" fieldNumber [ "[" fieldOptions "]" ] ";"
    fieldName = ident
    ident = letter { letter | decimalDigit | "_" }
    

    This shows that a field name must start with a letter which can be followed by a combination of letters, digits and underscores. A period (.) is not valid.