test.proto 5.4 KB

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