github.com/yimialmonte/fabric@v2.1.1+incompatible/common/tools/protolator/testprotos/sample.proto (about)

     1  /*
     2  Copyright IBM Corp. 2017 All Rights Reserved.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8                   http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  syntax = "proto3";
    18  
    19  option go_package = "github.com/hyperledger/fabric/common/tools/protolator/testprotos";
    20  
    21  package testprotos;
    22  
    23  // SimpleMsg is designed to test that all three types of message fields, plain, map,
    24  // and slice are handled by the protolator tool
    25  message SimpleMsg {
    26      string plain_field = 1;
    27      map<string, string> map_field = 2;
    28      repeated string slice_field = 3;
    29  }
    30  
    31  // NestedMsg is designed to test the nested message component
    32  message NestedMsg {
    33  	SimpleMsg plain_nested_field = 1;
    34  	map<string,SimpleMsg> map_nested_field = 2;
    35  	repeated SimpleMsg slice_nested_field = 3;
    36  }
    37  
    38  // StaticallyOpaqueMsg is designed to test the statically opaque message component
    39  // All fields are statically marshaled to the NestedMsg type
    40  message StaticallyOpaqueMsg {
    41  	bytes plain_opaque_field = 1;
    42  	map<string, bytes> map_opaque_field = 2;
    43  	repeated bytes slice_opaque_field = 3;
    44  }
    45  
    46  // VariablyOpaqueMsg is designed to test the staticaly opaque message component
    47  // The opaque type is determined by opaque_type
    48  message VariablyOpaqueMsg {
    49  	string opaque_type = 1;
    50  	bytes plain_opaque_field = 2;
    51  	map<string, bytes> map_opaque_field = 3;
    52  	repeated bytes slice_opaque_field = 4;
    53  }
    54  
    55  // DynamicMsg is designed to test the dynamic message component
    56  // The dynamic wrapper applied to ContextlessMsg is determined by
    57  // dynamic_type
    58  message DynamicMsg {
    59  	string dynamic_type = 1;
    60  	ContextlessMsg plain_dynamic_field = 2;
    61  	map<string,ContextlessMsg> map_dynamic_field = 3;
    62  	repeated ContextlessMsg slice_dynamic_field = 4;
    63  }
    64  
    65  // ContextlessMsg is designed to carry a message of completely arbitrary type
    66  // Because there is no context for the type embedded in the message, the opaque
    67  // type must be dynamically added at runtime
    68  message ContextlessMsg {
    69  	bytes opaque_field = 1;
    70  }
    71  
    72  // UnmarshalableDeepFields contains fields which are defined to be opaque, but will
    73  // return an error if they are asked to be deserialized.
    74  message UnmarshalableDeepFields {
    75  	bytes plain_opaque_field = 1;
    76  	map<string,bytes> map_opaque_field = 2;
    77  	repeated bytes slice_opaque_field = 3;
    78  }