protobuf-go/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.proto
Lasse Folger 2caa6b02a2 all: format all .proto files
Change-Id: Ied684945de38ab1895c3ce8afaa1d84cda1e24f9
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/566037
Auto-Submit: Lasse Folger <lassefolger@google.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-23 09:30:28 +00:00

56 lines
1.8 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.fieldnames;
option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/fieldnames";
// Assorted edge cases in field name conflict resolution.
//
// Not all (or possibly any) of these behave in an easily-understood fashion.
// This exists to demonstrate the current behavior and catch unintended
// changes in it.
message Message {
// Various CamelCase conversions.
optional string field_one = 1;
optional string FieldTwo = 2;
optional string fieldThree = 3;
optional string field__four = 4;
// Field names that conflict with standard methods on the message struct.
optional string descriptor = 10;
optional string marshal = 11;
optional string unmarshal = 12;
optional string proto_message = 13;
// Field names that conflict with each other after CamelCasing.
optional string CamelCase = 20;
optional string CamelCase_ = 21;
optional string camel_case = 22; // conflicts with 20, 21
optional string CamelCase__ = 23; // conflicts with 21, 21, renamed 22
// Field with a getter that conflicts with another field.
optional string get_name = 30;
optional string name = 31;
// Oneof that conflicts with its first field: The oneof is renamed.
oneof oneof_conflict_a {
string OneofConflictA = 40;
}
// Oneof that conflicts with its second field: The field is renamed.
oneof oneof_conflict_b {
string oneof_no_conflict = 50;
string OneofConflictB = 51;
}
// Oneof with a field name that conflicts with a nested message.
oneof oneof_conflict_c {
string oneof_message_conflict = 60;
}
message OneofMessageConflict {}
}