Home | History | Annotate | Download | only in protobuf
      1 syntax = "proto3";
      2 
      3 package protobuf_unittest;
      4 
      5 option csharp_namespace = "Google.Protobuf.TestProtos";
      6 option java_multiple_files = true;
      7 option java_package = "com.google.protobuf.test";
      8 
      9 import "google/protobuf/any.proto";
     10 import "google/protobuf/api.proto";
     11 import "google/protobuf/duration.proto";
     12 import "google/protobuf/empty.proto";
     13 import "google/protobuf/field_mask.proto";
     14 import "google/protobuf/source_context.proto";
     15 import "google/protobuf/struct.proto";
     16 import "google/protobuf/timestamp.proto";
     17 import "google/protobuf/type.proto";
     18 import "google/protobuf/wrappers.proto";
     19 
     20 // Test that we can include all well-known types.
     21 // Each wrapper type is included separately, as languages
     22 // map handle different wrappers in different ways.
     23 message TestWellKnownTypes {
     24   google.protobuf.Any any_field = 1;
     25   google.protobuf.Api api_field = 2;
     26   google.protobuf.Duration duration_field = 3;
     27   google.protobuf.Empty empty_field = 4;
     28   google.protobuf.FieldMask field_mask_field = 5;
     29   google.protobuf.SourceContext source_context_field = 6;
     30   google.protobuf.Struct struct_field = 7;
     31   google.protobuf.Timestamp timestamp_field = 8;
     32   google.protobuf.Type type_field = 9;
     33   google.protobuf.DoubleValue double_field = 10;
     34   google.protobuf.FloatValue float_field = 11;
     35   google.protobuf.Int64Value int64_field = 12;
     36   google.protobuf.UInt64Value uint64_field = 13;
     37   google.protobuf.Int32Value int32_field = 14;
     38   google.protobuf.UInt32Value uint32_field = 15;
     39   google.protobuf.BoolValue bool_field = 16;
     40   google.protobuf.StringValue string_field = 17;
     41   google.protobuf.BytesValue bytes_field = 18;
     42   // Part of struct, but useful to be able to test separately
     43   google.protobuf.Value value_field = 19;
     44 }
     45 
     46 // A repeated field for each well-known type.
     47 message RepeatedWellKnownTypes {
     48   repeated google.protobuf.Any any_field = 1;
     49   repeated google.protobuf.Api api_field = 2;
     50   repeated google.protobuf.Duration duration_field = 3;
     51   repeated google.protobuf.Empty empty_field = 4;
     52   repeated google.protobuf.FieldMask field_mask_field = 5;
     53   repeated google.protobuf.SourceContext source_context_field = 6;
     54   repeated google.protobuf.Struct struct_field = 7;
     55   repeated google.protobuf.Timestamp timestamp_field = 8;
     56   repeated google.protobuf.Type type_field = 9;
     57   // These don't actually make a lot of sense, but they're not prohibited...
     58   repeated google.protobuf.DoubleValue double_field = 10;
     59   repeated google.protobuf.FloatValue float_field = 11;
     60   repeated google.protobuf.Int64Value int64_field = 12;
     61   repeated google.protobuf.UInt64Value uint64_field = 13;
     62   repeated google.protobuf.Int32Value int32_field = 14;
     63   repeated google.protobuf.UInt32Value uint32_field = 15;
     64   repeated google.protobuf.BoolValue bool_field = 16;
     65   repeated google.protobuf.StringValue string_field = 17;
     66   repeated google.protobuf.BytesValue bytes_field = 18;
     67 }
     68 
     69 message OneofWellKnownTypes {
     70   oneof oneof_field {
     71     google.protobuf.Any any_field = 1;
     72     google.protobuf.Api api_field = 2;
     73     google.protobuf.Duration duration_field = 3;
     74     google.protobuf.Empty empty_field = 4;
     75     google.protobuf.FieldMask field_mask_field = 5;
     76     google.protobuf.SourceContext source_context_field = 6;
     77     google.protobuf.Struct struct_field = 7;
     78     google.protobuf.Timestamp timestamp_field = 8;
     79     google.protobuf.Type type_field = 9;
     80     google.protobuf.DoubleValue double_field = 10;
     81     google.protobuf.FloatValue float_field = 11;
     82     google.protobuf.Int64Value int64_field = 12;
     83     google.protobuf.UInt64Value uint64_field = 13;
     84     google.protobuf.Int32Value int32_field = 14;
     85     google.protobuf.UInt32Value uint32_field = 15;
     86     google.protobuf.BoolValue bool_field = 16;
     87     google.protobuf.StringValue string_field = 17;
     88     google.protobuf.BytesValue bytes_field = 18;
     89   }
     90 }
     91 
     92 // A map field for each well-known type. We only
     93 // need to worry about the value part of the map being the
     94 // well-known types, as messages can't be map keys.
     95 message MapWellKnownTypes {
     96   map<int32,google.protobuf.Any> any_field = 1;
     97   map<int32,google.protobuf.Api> api_field = 2;
     98   map<int32,google.protobuf.Duration> duration_field = 3;
     99   map<int32,google.protobuf.Empty> empty_field = 4;
    100   map<int32,google.protobuf.FieldMask> field_mask_field = 5;
    101   map<int32,google.protobuf.SourceContext> source_context_field = 6;
    102   map<int32,google.protobuf.Struct> struct_field = 7;
    103   map<int32,google.protobuf.Timestamp> timestamp_field = 8;
    104   map<int32,google.protobuf.Type> type_field = 9;
    105   map<int32,google.protobuf.DoubleValue> double_field = 10;
    106   map<int32,google.protobuf.FloatValue> float_field = 11;
    107   map<int32,google.protobuf.Int64Value> int64_field = 12;
    108   map<int32,google.protobuf.UInt64Value> uint64_field = 13;
    109   map<int32,google.protobuf.Int32Value> int32_field = 14;
    110   map<int32,google.protobuf.UInt32Value> uint32_field = 15;
    111   map<int32,google.protobuf.BoolValue> bool_field = 16;
    112   map<int32,google.protobuf.StringValue> string_field = 17;
    113   map<int32,google.protobuf.BytesValue> bytes_field = 18;
    114 }
    115