1// Copyright 2015 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
5syntax = "proto2";
6
7option go_package = "github.com/golang/protobuf/internal/testprotos/jsonpb_proto";
8
9import "google/protobuf/any.proto";
10import "google/protobuf/duration.proto";
11import "google/protobuf/struct.proto";
12import "google/protobuf/timestamp.proto";
13import "google/protobuf/wrappers.proto";
14
15package jsonpb_test;
16
17// Test message for holding primitive types.
18message Simple {
19  optional bool o_bool = 1;
20  optional int32 o_int32 = 2;
21  optional int32 o_int32_str = 3;
22  optional int64 o_int64 = 4;
23  optional int64 o_int64_str = 5;
24  optional uint32 o_uint32 = 6;
25  optional uint32 o_uint32_str = 7;
26  optional uint64 o_uint64 = 8;
27  optional uint64 o_uint64_str = 9;
28  optional sint32 o_sint32 = 10;
29  optional sint32 o_sint32_str = 11;
30  optional sint64 o_sint64 = 12;
31  optional sint64 o_sint64_str = 13;
32  optional float o_float = 14;
33  optional float o_float_str = 15;
34  optional double o_double = 16;
35  optional double o_double_str = 17;
36  optional string o_string = 18;
37  optional bytes o_bytes = 19;
38}
39
40// Test message for holding special non-finites primitives.
41message NonFinites {
42    optional float f_nan = 1;
43    optional float f_pinf = 2;
44    optional float f_ninf = 3;
45    optional double d_nan = 4;
46    optional double d_pinf = 5;
47    optional double d_ninf = 6;
48}
49
50// Test message for holding repeated primitives.
51message Repeats {
52  repeated bool r_bool = 1;
53  repeated int32 r_int32 = 2;
54  repeated int64 r_int64 = 3;
55  repeated uint32 r_uint32 = 4;
56  repeated uint64 r_uint64 = 5;
57  repeated sint32 r_sint32 = 6;
58  repeated sint64 r_sint64 = 7;
59  repeated float r_float = 8;
60  repeated double r_double = 9;
61  repeated string r_string = 10;
62  repeated bytes r_bytes = 11;
63}
64
65// Test message for holding enums and nested messages.
66message Widget {
67  enum Color {
68    RED = 0;
69    GREEN = 1;
70    BLUE = 2;
71  };
72  optional Color color = 1;
73  repeated Color r_color = 2;
74
75  optional Simple simple = 10;
76  repeated Simple r_simple = 11;
77
78  optional Repeats repeats = 20;
79  repeated Repeats r_repeats = 21;
80}
81
82message Maps {
83  map<int64, string> m_int64_str = 1;
84  map<bool, Simple> m_bool_simple = 2;
85}
86
87message MsgWithOneof {
88  oneof union {
89    string title = 1;
90    int64 salary = 2;
91    string Country = 3;
92    string home_address = 4;
93    MsgWithRequired msg_with_required = 5;
94  }
95}
96
97message Real {
98  optional double value = 1;
99  extensions 100 to max;
100}
101
102extend Real {
103  optional string name = 124;
104}
105
106message Complex {
107  extend Real {
108    optional Complex real_extension = 123;
109  }
110  optional double imaginary = 1;
111  extensions 100 to max;
112}
113
114message KnownTypes {
115  optional google.protobuf.Any an = 14;
116  optional google.protobuf.Duration dur = 1;
117  optional google.protobuf.Struct st = 12;
118  optional google.protobuf.Timestamp ts = 2;
119  optional google.protobuf.ListValue lv = 15;
120  optional google.protobuf.Value val = 16;
121
122  optional google.protobuf.DoubleValue dbl = 3;
123  optional google.protobuf.FloatValue flt = 4;
124  optional google.protobuf.Int64Value i64 = 5;
125  optional google.protobuf.UInt64Value u64 = 6;
126  optional google.protobuf.Int32Value i32 = 7;
127  optional google.protobuf.UInt32Value u32 = 8;
128  optional google.protobuf.BoolValue bool = 9;
129  optional google.protobuf.StringValue str = 10;
130  optional google.protobuf.BytesValue bytes = 11;
131}
132
133// Test messages for marshaling/unmarshaling required fields.
134message MsgWithRequired {
135  required string str = 1;
136}
137
138message MsgWithIndirectRequired {
139  optional MsgWithRequired subm = 1;
140  map<string, MsgWithRequired> map_field = 2;
141  repeated MsgWithRequired slice_field = 3;
142}
143
144message MsgWithRequiredBytes {
145  required bytes byts = 1;
146}
147
148message MsgWithRequiredWKT {
149  required google.protobuf.StringValue str = 1;
150}
151
152extend Real {
153  optional MsgWithRequired extm = 125;
154}
155