protobuf-go/cmd/protoc-gen-go/testdata/proto2/enum.proto
Damien Neil a485fbd353 reflect/protoreflect: add FieldDescriptor.DefaultEnumValue method
Default values for enums are specified by name, not number. An enum
may contain multiple values with different names but the same number.
Representing the default as a protoreflect.Value containing an EnumNumber
can discard information.

Add a method returning the EnumValueDescriptor.

Change-Id: If8beee3f81d41c4f9af45423252603b86949c7a5
Reviewed-on: https://go-review.googlesource.com/c/145158
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2018-10-29 15:59:23 +00:00

51 lines
1.1 KiB
Protocol Buffer

// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
syntax = "proto2";
package goproto.protoc.proto2;
option go_package = "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/proto2";
// EnumType1 comment.
enum EnumType1 {
// EnumType1_ONE comment.
ONE = 1;
// EnumType1_TWO comment.
TWO = 2;
}
enum EnumType2 {
option allow_alias = true;
duplicate1 = 1;
duplicate2 = 1;
}
message EnumContainerMessage1 {
optional EnumType2 default_duplicate1 = 1 [default=duplicate1];
optional EnumType2 default_duplicate2 = 2 [default=duplicate2];
// NestedEnumType1A comment.
enum NestedEnumType1A {
// NestedEnumType1A_VALUE comment.
NESTED_1A_VALUE = 0;
}
enum NestedEnumType1B {
NESTED_1B_VALUE = 0;
}
message EnumContainerMessage2 {
// NestedEnumType2A comment.
enum NestedEnumType2A {
// NestedEnumType2A_VALUE comment.
NESTED_2A_VALUE = 0;
}
enum NestedEnumType2B {
NESTED_2B_VALUE = 0;
}
}
}