| 1 |
// Copyright 2024 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 |
edition = "2023"; |
| 6 |
|
| 7 |
package goproto.protoc.protoeditions; |
| 8 |
|
| 9 |
import "google/protobuf/go_features.proto"; |
| 10 |
|
| 11 |
option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/protoeditions"; |
| 12 |
option features.enum_type = CLOSED; |
| 13 |
|
| 14 |
// EnumType1 comment. |
| 15 |
enum EnumType1 { |
| 16 |
// EnumType1_ONE comment. |
| 17 |
ONE = 1; |
| 18 |
// EnumType1_TWO comment. |
| 19 |
TWO = 2; |
| 20 |
} |
| 21 |
|
| 22 |
enum EnumType2 { |
| 23 |
option allow_alias = true; |
| 24 |
|
| 25 |
duplicate1 = 1; |
| 26 |
duplicate2 = 1; |
| 27 |
|
| 28 |
reserved RESERVED1; |
| 29 |
reserved RESERVED2; |
| 30 |
reserved 2, 3; |
| 31 |
} |
| 32 |
|
| 33 |
message EnumContainerMessage1 { |
| 34 |
EnumType2 default_duplicate1 = 1 [default = duplicate1]; |
| 35 |
EnumType2 default_duplicate2 = 2 [default = duplicate2]; |
| 36 |
|
| 37 |
// NestedEnumType1A comment. |
| 38 |
enum NestedEnumType1A { |
| 39 |
// NestedEnumType1A_VALUE comment. |
| 40 |
NESTED_1A_VALUE = 0; |
| 41 |
} |
| 42 |
|
| 43 |
enum NestedEnumType1B { |
| 44 |
NESTED_1B_VALUE = 0; |
| 45 |
} |
| 46 |
|
| 47 |
message EnumContainerMessage2 { |
| 48 |
// NestedEnumType2A comment. |
| 49 |
enum NestedEnumType2A { |
| 50 |
// NestedEnumType2A_VALUE comment. |
| 51 |
NESTED_2A_VALUE = 0; |
| 52 |
} |
| 53 |
|
| 54 |
enum NestedEnumType2B { |
| 55 |
NESTED_2B_VALUE = 0; |
| 56 |
} |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
enum LegacyUnmarshalJSONTest { |
| 61 |
option features.(pb.go).legacy_unmarshal_json_enum = true; |
| 62 |
|
| 63 |
FOO = 0; |
| 64 |
BAR = 1; |
| 65 |
BAZ = 4; |
| 66 |
} |