test.proto 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. package NProtobufJsonTest;
  2. import "google/protobuf/any.proto";
  3. import "google/protobuf/duration.proto";
  4. import "google/protobuf/timestamp.proto";
  5. import "library/cpp/protobuf/json/proto/enum_options.proto";
  6. enum EEnum {
  7. E_0 = 0;
  8. E_1 = 1;
  9. E_2 = 2;
  10. E_3 = 3;
  11. };
  12. enum EJsonEnum {
  13. J_0 = 0 [(json_enum_value)="enum_0"];
  14. J_1 = 1 [(json_enum_value)="enum_1"];
  15. }
  16. message TFlatOptional {
  17. optional int32 I32 = 1;
  18. optional int64 I64 = 2;
  19. optional uint32 UI32 = 3;
  20. optional uint64 UI64 = 4;
  21. optional sint32 SI32 = 5;
  22. optional sint64 SI64 = 6;
  23. optional fixed32 FI32 = 7;
  24. optional fixed64 FI64 = 8;
  25. optional sfixed32 SFI32 = 9;
  26. optional sfixed64 SFI64 = 10;
  27. optional bool Bool = 11;
  28. optional string String = 12;
  29. optional bytes Bytes = 13;
  30. optional EEnum Enum = 14;
  31. optional float Float = 15;
  32. optional double Double = 16;
  33. optional string OneString = 17;
  34. optional string OneTwoString = 18;
  35. optional string ABC = 19;
  36. optional string UserID = 20;
  37. };
  38. message TFlatRequired {
  39. required int32 I32 = 1;
  40. required int64 I64 = 2;
  41. required uint32 UI32 = 3;
  42. required uint64 UI64 = 4;
  43. required sint32 SI32 = 5;
  44. required sint64 SI64 = 6;
  45. required fixed32 FI32 = 7;
  46. required fixed64 FI64 = 8;
  47. required sfixed32 SFI32 = 9;
  48. required sfixed64 SFI64 = 10;
  49. required bool Bool = 11;
  50. required string String = 12;
  51. required bytes Bytes = 13;
  52. required EEnum Enum = 14;
  53. required float Float = 15;
  54. required double Double = 16;
  55. required string OneString = 17;
  56. required string OneTwoString = 18;
  57. required string ABC = 19;
  58. required string UserID = 20;
  59. };
  60. message TFlatRepeated {
  61. repeated int32 I32 = 1;
  62. repeated int64 I64 = 2;
  63. repeated uint32 UI32 = 3;
  64. repeated uint64 UI64 = 4;
  65. repeated sint32 SI32 = 5;
  66. repeated sint64 SI64 = 6;
  67. repeated fixed32 FI32 = 7;
  68. repeated fixed64 FI64 = 8;
  69. repeated sfixed32 SFI32 = 9;
  70. repeated sfixed64 SFI64 = 10;
  71. repeated bool Bool = 11;
  72. repeated string String = 12;
  73. repeated bytes Bytes = 13;
  74. repeated EEnum Enum = 14;
  75. repeated float Float = 15;
  76. repeated double Double = 16;
  77. repeated string OneString = 17;
  78. repeated string OneTwoString = 18;
  79. repeated string ABC = 19;
  80. repeated string UserID = 20;
  81. };
  82. message TFlatDefault {
  83. optional int32 I32 = 1 [default = 132];
  84. optional int64 I64 = 2 [default = 164];
  85. optional uint32 UI32 = 3 [default = 232];
  86. optional uint64 UI64 = 4 [default = 264];
  87. optional sint32 SI32 = 5 [default = 332];
  88. optional sint64 SI64 = 6 [default = 364];
  89. optional fixed32 FI32 = 7 [default = 432];
  90. optional fixed64 FI64 = 8 [default = 464];
  91. optional sfixed32 SFI32 = 9 [default = 532];
  92. optional sfixed64 SFI64 = 10 [default = 564];
  93. optional bool Bool = 11 [default = true];
  94. optional string String = 12 [default = "string"];
  95. optional bytes Bytes = 13 [default = "bytes"];
  96. optional EEnum Enum = 14 [default = E_2];
  97. optional float Float = 15 [default = 0.123];
  98. optional double Double = 16 [default = 0.456];
  99. optional string OneString = 17 [default = "string"];
  100. optional string OneTwoString = 18 [default = "string"];
  101. optional string ABC = 19 [default = "abc"];
  102. optional string UserID = 20 [default = "some_id"];
  103. };
  104. message TFlatOneOfDefault {
  105. oneof Choice {
  106. string ChoiceOne = 1 [default = "one"];
  107. string ChoiceTwo = 2 [default = "two"];
  108. }
  109. }
  110. message TCompositeOptional {
  111. optional TFlatOptional Part = 1;
  112. };
  113. message TCompositeRequired {
  114. required TFlatRequired Part = 1;
  115. };
  116. message TCompositeRepeated {
  117. repeated TFlatOptional Part = 1;
  118. };
  119. message TMapType {
  120. map<string, string> Items = 1;
  121. };
  122. message TNameGeneratorType {
  123. optional int32 Field = 1;
  124. };
  125. message TEnumValueGeneratorType {
  126. enum EEnum {
  127. ENUM_42 = 1;
  128. };
  129. optional EEnum Enum = 1;
  130. };
  131. message TComplexMapType {
  132. map<int32, int32> I32 = 1;
  133. map<int64, int64> I64 = 2;
  134. map<uint32, uint32> UI32 = 3;
  135. map<uint64, uint64> UI64 = 4;
  136. map<sint32, sint32> SI32 = 5;
  137. map<sint64, sint64> SI64 = 6;
  138. map<fixed32, fixed32> FI32 = 7;
  139. map<fixed64, fixed64> FI64 = 8;
  140. map<sfixed32, sfixed32> SFI32 = 9;
  141. map<sfixed64, sfixed64> SFI64 = 10;
  142. map<bool, bool> Bool = 11;
  143. map<string, string> String = 12;
  144. map<string, EEnum> Enum = 13;
  145. map<string, float> Float = 14;
  146. map<string, double> Double = 15;
  147. map<string, TComplexMapType> Nested = 16;
  148. };
  149. message TWithJsonName {
  150. optional int32 my_upper = 1 [json_name = "My-Upper"];
  151. optional int32 My_lower = 2 [json_name = "my-lower"];
  152. optional int32 Def_upper = 3; // json_name = "DefUpper"
  153. optional int32 def_lower = 4; // json_name = "defLower"
  154. }
  155. message TSingleRequiredString {
  156. required string String = 1;
  157. }
  158. message TSingleDefaultString {
  159. optional string String = 1 [default = "value"];
  160. }
  161. message TSingleRepeatedString {
  162. repeated string RepeatedString = 1;
  163. }
  164. message TSingleRepeatedInt {
  165. repeated int32 RepeatedInt = 1;
  166. }
  167. message TSingleDuration {
  168. required google.protobuf.Duration Duration = 1;
  169. }
  170. message TSingleTimestamp {
  171. required google.protobuf.Timestamp Timestamp = 1;
  172. }
  173. message TExtensionField {
  174. extensions 100 to 199;
  175. }
  176. message TCustomJsonEnumValue {
  177. optional EJsonEnum JsonEnum = 1 [json_name="json_enum"];
  178. }
  179. extend TExtensionField {
  180. optional int32 bar = 123;
  181. }
  182. message TContainsAny {
  183. optional google.protobuf.Any Any = 1;
  184. }