github.com/cloudwego/kitex@v0.9.0/pkg/generic/jsonpb_test/idl/example2.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 test;
     9  
    10  option go_package = "./example2";
    11  
    12  message TrafficEnv {
    13    bool Open = 1;
    14    string Env = 2;
    15  }
    16  
    17  message Base {
    18    string LogID = 1;
    19    string Caller = 2;
    20    string Addr = 3;
    21    string Client = 4;
    22    optional TrafficEnv TrafficEnv = 5;
    23    map<string, string> Extra = 6;
    24  }
    25  
    26  message BaseResp {
    27    string StatusMessage = 1;
    28    int32 StatusCode = 2;
    29    map<string, string> Extra = 3;
    30  }
    31  
    32  enum FOO {
    33    FOO_A = 0;
    34  }
    35  
    36  message InnerBase2 {
    37    bool Bool = 1;
    38    uint32 Uint32 = 2;
    39    uint64 Uint64 = 3;
    40    int32 Int32 = 4;
    41    int64 Int64 = 5;
    42    double Double = 6;
    43    string String = 7;
    44    repeated int32 ListInt32 = 8;
    45    map<string, string> MapStringString = 9;
    46    repeated int32 SetInt32 = 10;
    47    FOO Foo = 11;
    48    map<int32, string> MapInt32String = 12;
    49    bytes Binary = 13;
    50    map<uint32, string> MapUint32String = 14;
    51    map<uint64, string> MapUint64String = 15;
    52    map<int64, string> MapInt64String = 16;
    53    map<int64, Base> MapInt64Base = 17;
    54    map<string, Base> MapStringBase = 20;
    55  
    56    repeated Base ListBase = 19;
    57    repeated InnerBase2 ListInnerBase = 18;
    58    repeated string ListString = 21;
    59  
    60    Base Base = 255;
    61  }
    62  
    63  message InnerBasePartial {
    64    bool Bool = 1;
    65    repeated int32 ListInt32 = 8;
    66    map<string, string> MapStringString = 9;
    67    map<string, BasePartial> MapStringBase = 20;
    68    repeated InnerBasePartial ListInnerBase = 18;
    69    repeated BasePartial ListBase = 19;
    70  
    71    map<string, string> MapStringString2 = 127;
    72  }
    73  
    74  message BasePartial {
    75    TrafficEnv TrafficEnv = 5;
    76  }
    77  
    78  message ExampleReq {
    79    string Msg = 1;
    80    int32 A = 2;
    81    InnerBase2 InnerBase2 = 3;
    82    Base Base = 255;
    83    double Subfix = 32767;
    84  }
    85  
    86  message ExampleSuper {
    87    string Msg = 1;
    88    int32 A = 2;
    89    InnerBase2 InnerBase2 = 3;
    90    string Ex1 = 4;
    91    string Ex2 = 5;
    92    string Ex3 = 6;
    93    string Ex4 = 7;
    94    SelfRef SelfRef = 9;
    95    Base Base = 255;
    96    double Subfix = 32767;
    97  }
    98  
    99  message SelfRef {
   100    SelfRef self = 1;
   101  }
   102  
   103  message ExampleReqPartial {
   104    string Msg = 1;
   105    InnerBasePartial InnerBase2 = 3;
   106    BasePartial Base = 255;
   107  }
   108  
   109  
   110  message ExampleResp {
   111    string Msg = 1;
   112    string required_field = 2;
   113    BaseResp BaseResp = 255;
   114  }
   115  
   116  message ExampleRespPartial {
   117    string required_field = 2;
   118    BaseResp BaseResp = 255;
   119  }
   120  
   121  message Exception {
   122    int32 code = 1;
   123    string msg = 255;
   124  }
   125  
   126  message A {
   127    A self = 1;
   128  }
   129  
   130  message PingResponse {
   131    string message = 1;
   132  }
   133  
   134  message OnewayRequest {
   135    string msg = 1;
   136  }
   137  
   138  message VoidRequest {
   139    string msg = 1;
   140  }
   141  
   142  message VoidResponse {
   143  
   144  }
   145  
   146  message ExampleInt2Float {
   147    int32 Int32 = 1;
   148    double Float64 = 2;
   149    string String = 3;
   150    int64 Int64 = 4;
   151    double Subfix = 32767;
   152  }
   153  
   154  // Test that RPC services work.
   155  service TestService2 {
   156    rpc ExampleMethod(ExampleReq) returns (ExampleReq);
   157    rpc ExamplePartialMethod(ExampleReqPartial) returns (A);
   158    rpc ExamplePartialMethod2(ExampleReqPartial) returns (ExampleRespPartial);
   159    rpc ExampleSuperMethod(ExampleSuper) returns (A);
   160    rpc Int2FloatMethod(ExampleInt2Float) returns (ExampleInt2Float);
   161    rpc Foo(A) returns (A);
   162    rpc Ping(A) returns (PingResponse);
   163    rpc Oneway(OnewayRequest) returns (VoidResponse);
   164    rpc Void(VoidRequest) returns (VoidResponse);
   165  }