Understanding the protocol buffer language
The Google Protocol Buffer language (sometimes called protocol buffer language) is used to describe the structure of protocol buffer data. The language is currently in version 3 and the .proto
files should have directives at the top of the file specifying the version of the language used in the file (the current version is proto3). The file can also have a package name for sharing the files between applications.
The following code shows the basic directive definition of the file:
syntax = "proto3"; package grpc;
In the preceding code, we are using the syntax
directive to specify the version and the package
directive to specify the name of the package.
When we want to extend the package functionality, we can use the option
and import
directives:
option csharp_namespace = "MediaLibrary.Contracts"; import "different_file.proto";
In the preceding code, we are using the option
directive to specify...