Home | History | Annotate | Download | only in jsonpb_test_proto
      1 // Go support for Protocol Buffers - Google's data interchange format
      2 //
      3 // Copyright 2015 The Go Authors.  All rights reserved.
      4 // https://github.com/golang/protobuf
      5 //
      6 // Redistribution and use in source and binary forms, with or without
      7 // modification, are permitted provided that the following conditions are
      8 // met:
      9 //
     10 //     * Redistributions of source code must retain the above copyright
     11 // notice, this list of conditions and the following disclaimer.
     12 //     * Redistributions in binary form must reproduce the above
     13 // copyright notice, this list of conditions and the following disclaimer
     14 // in the documentation and/or other materials provided with the
     15 // distribution.
     16 //     * Neither the name of Google Inc. nor the names of its
     17 // contributors may be used to endorse or promote products derived from
     18 // this software without specific prior written permission.
     19 //
     20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31 
     32 syntax = "proto2";
     33 
     34 import "google/protobuf/any.proto";
     35 import "google/protobuf/duration.proto";
     36 import "google/protobuf/struct.proto";
     37 import "google/protobuf/timestamp.proto";
     38 import "google/protobuf/wrappers.proto";
     39 
     40 package jsonpb;
     41 
     42 // Test message for holding primitive types.
     43 message Simple {
     44   optional bool o_bool = 1;
     45   optional int32 o_int32 = 2;
     46   optional int64 o_int64 = 3;
     47   optional uint32 o_uint32 = 4;
     48   optional uint64 o_uint64 = 5;
     49   optional sint32 o_sint32 = 6;
     50   optional sint64 o_sint64 = 7;
     51   optional float o_float = 8;
     52   optional double o_double = 9;
     53   optional string o_string = 10;
     54   optional bytes o_bytes = 11;
     55 }
     56 
     57 // Test message for holding special non-finites primitives.
     58 message NonFinites {
     59     optional float f_nan = 1;
     60     optional float f_pinf = 2;
     61     optional float f_ninf = 3;
     62     optional double d_nan = 4;
     63     optional double d_pinf = 5;
     64     optional double d_ninf = 6;
     65 }
     66 
     67 // Test message for holding repeated primitives.
     68 message Repeats {
     69   repeated bool r_bool = 1;
     70   repeated int32 r_int32 = 2;
     71   repeated int64 r_int64 = 3;
     72   repeated uint32 r_uint32 = 4;
     73   repeated uint64 r_uint64 = 5;
     74   repeated sint32 r_sint32 = 6;
     75   repeated sint64 r_sint64 = 7;
     76   repeated float r_float = 8;
     77   repeated double r_double = 9;
     78   repeated string r_string = 10;
     79   repeated bytes r_bytes = 11;
     80 }
     81 
     82 // Test message for holding enums and nested messages.
     83 message Widget {
     84   enum Color {
     85     RED = 0;
     86     GREEN = 1;
     87     BLUE = 2;
     88   };
     89   optional Color color = 1;
     90   repeated Color r_color = 2;
     91 
     92   optional Simple simple = 10;
     93   repeated Simple r_simple = 11;
     94 
     95   optional Repeats repeats = 20;
     96   repeated Repeats r_repeats = 21;
     97 }
     98 
     99 message Maps {
    100   map<int64, string> m_int64_str = 1;
    101   map<bool, Simple> m_bool_simple = 2;
    102 }
    103 
    104 message MsgWithOneof {
    105   oneof union {
    106     string title = 1;
    107     int64 salary = 2;
    108     string Country = 3;
    109     string home_address = 4;
    110   }
    111 }
    112 
    113 message Real {
    114   optional double value = 1;
    115   extensions 100 to max;
    116 }
    117 
    118 extend Real {
    119   optional string name = 124;
    120 }
    121 
    122 message Complex {
    123   extend Real {
    124     optional Complex real_extension = 123;
    125   }
    126   optional double imaginary = 1;
    127   extensions 100 to max;
    128 }
    129 
    130 message KnownTypes {
    131   optional google.protobuf.Any an = 14;
    132   optional google.protobuf.Duration dur = 1;
    133   optional google.protobuf.Struct st = 12;
    134   optional google.protobuf.Timestamp ts = 2;
    135   optional google.protobuf.ListValue lv = 15;
    136   optional google.protobuf.Value val = 16;
    137 
    138   optional google.protobuf.DoubleValue dbl = 3;
    139   optional google.protobuf.FloatValue flt = 4;
    140   optional google.protobuf.Int64Value i64 = 5;
    141   optional google.protobuf.UInt64Value u64 = 6;
    142   optional google.protobuf.Int32Value i32 = 7;
    143   optional google.protobuf.UInt32Value u32 = 8;
    144   optional google.protobuf.BoolValue bool = 9;
    145   optional google.protobuf.StringValue str = 10;
    146   optional google.protobuf.BytesValue bytes = 11;
    147 }
    148