pluginlib_descriptor_test.proto 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // Protos/pluginlib_descriptor_test.proto - test proto
  2. //
  3. // This source file is part of the Swift.org open source project
  4. //
  5. // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
  6. // Licensed under Apache License v2.0 with Runtime Library Exception
  7. //
  8. // See http://swift.org/LICENSE.txt for license information
  9. // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
  10. //
  11. // -----------------------------------------------------------------------------
  12. ///
  13. /// Test proto for Tests/SwiftProtobufPluginLibraryTests/Test_Descriptor.swift
  14. ///
  15. // -----------------------------------------------------------------------------
  16. syntax = "proto2";
  17. package swift_descriptor_test;
  18. // Use the option to test swift name generation.
  19. option swift_prefix = "SDT";
  20. import "pluginlib_descriptor_test_import.proto";
  21. enum TopLevelEnum {
  22. VALUE_ZERO = 0;
  23. VALUE_ONE = 1;
  24. VALUE_TWO = 2;
  25. }
  26. message TopLevelMessage {
  27. enum SubEnum {
  28. SUB_VALUE_0 = 0;
  29. SUB_VALUE_1 = 1;
  30. SUB_VALUE_2 = 2;
  31. }
  32. message SubMessage {
  33. optional int32 field1 = 1;
  34. optional string field2 = 2;
  35. optional SubMessage field3 = 3;
  36. }
  37. optional string field1 = 1;
  38. optional int32 field2 = 2;
  39. oneof o {
  40. TopLevelEnum field3 = 3;
  41. SubEnum field4 = 4;
  42. SubMessage field5 = 5;
  43. TopLevelMessage2 field6 = 6;
  44. }
  45. }
  46. message TopLevelMessage2 {
  47. optional TopLevelMessage left = 1;
  48. optional TopLevelMessage2 right = 2;
  49. }
  50. message ExternalRefs {
  51. optional swift_descriptor_test.import.ExtendableOne one = 1;
  52. optional swift_descriptor_test.import.Version ver = 2;
  53. }
  54. extend swift_descriptor_test.import.ExtendableOne {
  55. optional string ext_str = 90000;
  56. }
  57. message ScoperForExt {
  58. extend swift_descriptor_test.import.ExtendableOne.ExtendableTwo {
  59. optional TopLevelEnum ext_enum = 99001;
  60. optional TopLevelMessage2 ext_msg = 99002;
  61. }
  62. }
  63. service SomeService {
  64. rpc Foo(swift_descriptor_test.import.ExtendableOne) returns (swift_descriptor_test.import.Version);
  65. rpc Bar(TopLevelMessage) returns (TopLevelMessage2);
  66. }
  67. message Proto2MessageForPresence {
  68. required string req_str_field = 1;
  69. required int32 req_int32_field = 2;
  70. required TopLevelEnum req_enum_field = 3;
  71. required TopLevelMessage req_message_field = 4;
  72. optional string opt_str_field = 11;
  73. optional int32 opt_int32_field = 12;
  74. optional TopLevelEnum opt_enum_field = 13;
  75. optional TopLevelMessage opt_message_field = 14;
  76. repeated string repeat_str_field = 21;
  77. repeated int32 repeat_int32_field = 22;
  78. repeated TopLevelEnum repeat_enum_field = 23;
  79. repeated TopLevelMessage repeat_message_field = 24;
  80. oneof o {
  81. string oneof_str_field = 31;
  82. int32 oneof_int32_field = 32;
  83. TopLevelEnum oneof_enum_field = 33;
  84. TopLevelMessage oneof_message_field = 34;
  85. }
  86. }