addressbook.proto 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Licensed to the Apache Software Foundation (ASF) under one
  2. // or more contributor license agreements. See the NOTICE file
  3. // distributed with this work for additional information
  4. // regarding copyright ownership. The ASF licenses this file
  5. // to you under the Apache License, Version 2.0 (the
  6. // "License"); you may not use this file except in compliance
  7. // with the License. You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing,
  12. // software distributed under the License is distributed on an
  13. // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. // KIND, either express or implied. See the License for the
  15. // specific language governing permissions and limitations
  16. // under the License.
  17. syntax="proto2";
  18. package addressbook;
  19. message Person {
  20. required string name = 1;
  21. required int32 id = 2; // Unique ID number for this person.
  22. optional string email = 3;
  23. enum PhoneType {
  24. MOBILE = 0;
  25. HOME = 1;
  26. WORK = 2;
  27. }
  28. message PhoneNumber {
  29. required string number = 1;
  30. optional PhoneType type = 2 [default = HOME];
  31. }
  32. repeated PhoneNumber phone = 4;
  33. optional int64 data = 5;
  34. optional sint32 data32 = 6;
  35. optional sint64 data64 = 7;
  36. required double datadouble = 8;
  37. required float datafloat = 9;
  38. optional uint32 datau32 = 10;
  39. optional uint64 datau64 = 11;
  40. optional bool databool = 12;
  41. optional bytes databyte = 13;
  42. optional fixed32 datafix32 = 14;
  43. optional fixed64 datafix64 = 15;
  44. optional sfixed32 datasfix32 = 16;
  45. optional sfixed64 datasfix64 = 17;
  46. optional float datafloat_scientific = 18;
  47. optional double datadouble_scientific = 19;
  48. extensions 100 to 200;
  49. }
  50. extend Person {
  51. optional string hobby = 100;
  52. }
  53. message AddressBook {
  54. repeated Person person = 1;
  55. }