blob: d672816b3065a641a9bff7e4296d0c7cf1c2aa7f [file] [log] [blame]
Herbie Ongcddf8192018-11-28 18:25:20 -08001// 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.
6syntax = "proto3";
7
8package pb3;
9option go_package = "github.com/golang/protobuf/v2/encoding/textpb/testprotos/pb3";
10
11// Scalars contains scalar field types.
12message Scalars {
13 bool s_bool = 1;
14
15 int32 s_int32 = 2;
16 int64 s_int64 = 3;
17 uint32 s_uint32 = 4;
18 uint64 s_uint64 = 5;
19 sint32 s_sint32 = 6;
20 sint64 s_sint64 = 7;
21 fixed32 s_fixed32 = 8;
22 fixed64 s_fixed64 = 9;
23 sfixed32 s_sfixed32 = 10;
24 sfixed64 s_sfixed64 = 11;
25
Herbie Ong800c9902018-12-06 15:28:53 -080026 // Textproto marshal outputs fields in the same order as this proto
27 // definition regardless of field number. Following fields are intended to
28 // test that assumption.
29
Herbie Ongcddf8192018-11-28 18:25:20 -080030 float s_float = 20;
31 double s_double = 21;
32
33 bytes s_bytes = 14;
34 string s_string = 13;
35}
36
37enum Enum {
38 ZERO = 0;
39 ONE = 1;
40 TWO = 2;
41 TEN = 10;
42}
43
44// Message contains enum fields.
45message Enums {
46 Enum s_enum = 1;
Herbie Ongcddf8192018-11-28 18:25:20 -080047
48 enum NestedEnum {
49 CERO = 0;
50 UNO = 1;
51 DOS = 2;
52 DIEZ = 10;
53 }
54 NestedEnum s_nested_enum = 3;
Herbie Ongcddf8192018-11-28 18:25:20 -080055}
56
Herbie Ong800c9902018-12-06 15:28:53 -080057// Message contains nested message field.
Herbie Ongcddf8192018-11-28 18:25:20 -080058message Nests {
59 Nested s_nested = 1;
Herbie Ongcddf8192018-11-28 18:25:20 -080060}
61
62// Message type used as submessage.
63message Nested {
64 string s_string = 1;
65 Nested s_nested = 2;
66}