fieldnames.proto 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // 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. syntax = "proto2";
  5. package goproto.protoc.fieldnames;
  6. option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/fieldnames";
  7. // Assorted edge cases in field name conflict resolution.
  8. //
  9. // Not all (or possibly any) of these behave in an easily-understood fashion.
  10. // This exists to demonstrate the current behavior and catch unintended
  11. // changes in it.
  12. message Message {
  13. // Various CamelCase conversions.
  14. optional string field_one = 1;
  15. optional string FieldTwo = 2;
  16. optional string fieldThree = 3;
  17. optional string field__four = 4;
  18. // Field names that conflict with standard methods on the message struct.
  19. optional string descriptor = 10;
  20. optional string marshal = 11;
  21. optional string unmarshal = 12;
  22. optional string proto_message = 13;
  23. // Field names that conflict with each other after CamelCasing.
  24. optional string CamelCase = 20;
  25. optional string CamelCase_ = 21;
  26. optional string camel_case = 22; // conflicts with 20, 21
  27. optional string CamelCase__ = 23; // conflicts with 21, 21, renamed 22
  28. // Field with a getter that conflicts with another field.
  29. optional string get_name = 30;
  30. optional string name = 31;
  31. // Oneof that conflicts with its first field: The oneof is renamed.
  32. oneof oneof_conflict_a {
  33. string OneofConflictA = 40;
  34. }
  35. // Oneof that conflicts with its second field: The field is renamed.
  36. oneof oneof_conflict_b {
  37. string oneof_no_conflict = 50;
  38. string OneofConflictB = 51;
  39. }
  40. // Oneof with a field name that conflicts with a nested message.
  41. oneof oneof_conflict_c {
  42. string oneof_message_conflict = 60;
  43. }
  44. message OneofMessageConflict {}
  45. }