github.com/whiteCcinn/protobuf-go@v1.0.9/internal/testprotos/textpb3/test.proto (about)

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Test Protobuf definitions with proto3 syntax.
     6  syntax = "proto3";
     7  
     8  package pb3;
     9  option go_package = "github.com/whiteCcinn/protobuf-go/internal/testprotos/textpb3";
    10  
    11  // Scalars contains scalar field types.
    12  message Scalars {
    13    bool s_bool = 1;
    14    int32 s_int32 = 2;
    15    int64 s_int64 = 3;
    16    uint32 s_uint32 = 4;
    17    uint64 s_uint64 = 5;
    18    sint32 s_sint32 = 6;
    19    sint64 s_sint64 = 7;
    20    fixed32 s_fixed32 = 8;
    21    fixed64 s_fixed64 = 9;
    22    sfixed32 s_sfixed32 = 10;
    23    sfixed64 s_sfixed64 = 11;
    24  
    25    // Textproto marshal outputs fields in the same order as this proto
    26    // definition regardless of field number. Following fields are intended to
    27    // test that assumption.
    28  
    29    float s_float = 20;
    30    double s_double = 21;
    31  
    32    bytes s_bytes = 14;
    33    string s_string = 13;
    34  }
    35  
    36  // Message contains repeated fields.
    37  message Repeats {
    38    repeated bool rpt_bool = 1;
    39    repeated int32 rpt_int32 = 2;
    40    repeated int64 rpt_int64 = 3;
    41    repeated uint32 rpt_uint32 = 4;
    42    repeated uint64 rpt_uint64 = 5;
    43    repeated float rpt_float = 6;
    44    repeated double rpt_double = 7;
    45    repeated string rpt_string = 8;
    46    repeated bytes rpt_bytes = 9;
    47  }
    48  
    49  message Proto3Optional {
    50    optional bool opt_bool = 1;
    51    optional int32 opt_int32 = 2;
    52    optional int64 opt_int64 = 3;
    53    optional uint32 opt_uint32 = 4;
    54    optional uint64 opt_uint64 = 5;
    55    optional float opt_float = 6;
    56    optional double opt_double = 7;
    57    optional string opt_string = 8;
    58    optional bytes opt_bytes = 9;
    59    optional Enum opt_enum = 10;
    60    optional Nested opt_message = 11;
    61  }
    62  
    63  enum Enum {
    64    ZERO = 0;
    65    ONE = 1;
    66    TWO = 2;
    67    TEN = 10;
    68  }
    69  
    70  // Message contains enum fields.
    71  message Enums {
    72    Enum s_enum = 1;
    73  
    74    enum NestedEnum {
    75    	CERO = 0;
    76  	UNO = 1;
    77  	DOS = 2;
    78  	DIEZ = 10;
    79    }
    80    NestedEnum s_nested_enum = 3;
    81  }
    82  
    83  // Message contains nested message field.
    84  message Nests {
    85    Nested s_nested = 2;
    86  }
    87  
    88  // Message type used as submessage.
    89  message Nested {
    90    string s_string = 1;
    91    Nested s_nested = 2;
    92  }
    93  
    94  // Message contains oneof field.
    95  message Oneofs {
    96    oneof union {
    97      Enum oneof_enum = 1;
    98      string oneof_string = 2;
    99      Nested oneof_nested = 3;
   100    }
   101  }
   102  
   103  // Message contains map fields.
   104  message Maps {
   105    map<int32, string> int32_to_str = 1;
   106    map<bool, uint32> bool_to_uint32 = 2;
   107    map<uint64, Enum> uint64_to_enum = 3;
   108    map<string, Nested> str_to_nested = 4;
   109    map<string, Oneofs> str_to_oneofs = 5;
   110  }
   111  
   112  // Message for testing json_name option.
   113  message JSONNames {
   114    string s_string = 1 [json_name = "foo_bar"];
   115  }