field_mask.pb.swift 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /*
  2. * DO NOT EDIT.
  3. *
  4. * Generated by the protocol buffer compiler.
  5. * Source: google/protobuf/field_mask.proto
  6. *
  7. */
  8. /// `FieldMask` represents a set of symbolic field paths, for example:
  9. ///
  10. /// paths: "f.a"
  11. /// paths: "f.b.d"
  12. ///
  13. /// Here `f` represents a field in some root message, `a` and `b`
  14. /// fields in the message found in `f`, and `d` a field found in the
  15. /// message in `f.b`.
  16. ///
  17. /// Field masks are used to specify a subset of fields that should be
  18. /// returned by a get operation or modified by an update operation.
  19. /// Field masks also have a custom JSON encoding (see below).
  20. ///
  21. /// # Field Masks in Projections
  22. ///
  23. /// When used in the context of a projection, a response message or
  24. /// sub-message is filtered by the API to only contain those fields as
  25. /// specified in the mask. For example, if the mask in the previous
  26. /// example is applied to a response message as follows:
  27. ///
  28. /// f {
  29. /// a : 22
  30. /// b {
  31. /// d : 1
  32. /// x : 2
  33. /// }
  34. /// y : 13
  35. /// }
  36. /// z: 8
  37. ///
  38. /// The result will not contain specific values for fields x,y and z
  39. /// (their value will be set to the default, and omitted in proto text
  40. /// output):
  41. ///
  42. ///
  43. /// f {
  44. /// a : 22
  45. /// b {
  46. /// d : 1
  47. /// }
  48. /// }
  49. ///
  50. /// A repeated field is not allowed except at the last position of a
  51. /// field mask.
  52. ///
  53. /// If a FieldMask object is not present in a get operation, the
  54. /// operation applies to all fields (as if a FieldMask of all fields
  55. /// had been specified).
  56. ///
  57. /// Note that a field mask does not necessarily apply to the
  58. /// top-level response message. In case of a REST get operation, the
  59. /// field mask applies directly to the response, but in case of a REST
  60. /// list operation, the mask instead applies to each individual message
  61. /// in the returned resource list. In case of a REST custom method,
  62. /// other definitions may be used. Where the mask applies will be
  63. /// clearly documented together with its declaration in the API. In
  64. /// any case, the effect on the returned resource/resources is required
  65. /// behavior for APIs.
  66. ///
  67. /// # Field Masks in Update Operations
  68. ///
  69. /// A field mask in update operations specifies which fields of the
  70. /// targeted resource are going to be updated. The API is required
  71. /// to only change the values of the fields as specified in the mask
  72. /// and leave the others untouched. If a resource is passed in to
  73. /// describe the updated values, the API ignores the values of all
  74. /// fields not covered by the mask.
  75. ///
  76. /// If a repeated field is specified for an update operation, the existing
  77. /// repeated values in the target resource will be overwritten by the new values.
  78. /// Note that a repeated field is only allowed in the last position of a field
  79. /// mask.
  80. ///
  81. /// If a sub-message is specified in the last position of the field mask for an
  82. /// update operation, then the existing sub-message in the target resource is
  83. /// overwritten. Given the target message:
  84. ///
  85. /// f {
  86. /// b {
  87. /// d : 1
  88. /// x : 2
  89. /// }
  90. /// c : 1
  91. /// }
  92. ///
  93. /// And an update message:
  94. ///
  95. /// f {
  96. /// b {
  97. /// d : 10
  98. /// }
  99. /// }
  100. ///
  101. /// then if the field mask is:
  102. ///
  103. /// paths: "f.b"
  104. ///
  105. /// then the result will be:
  106. ///
  107. /// f {
  108. /// b {
  109. /// d : 10
  110. /// }
  111. /// c : 1
  112. /// }
  113. ///
  114. /// However, if the update mask was:
  115. ///
  116. /// paths: "f.b.d"
  117. ///
  118. /// then the result would be:
  119. ///
  120. /// f {
  121. /// b {
  122. /// d : 10
  123. /// x : 2
  124. /// }
  125. /// c : 1
  126. /// }
  127. ///
  128. /// In order to reset a field's value to the default, the field must
  129. /// be in the mask and set to the default value in the provided resource.
  130. /// Hence, in order to reset all fields of a resource, provide a default
  131. /// instance of the resource and set all fields in the mask, or do
  132. /// not provide a mask as described below.
  133. ///
  134. /// If a field mask is not present on update, the operation applies to
  135. /// all fields (as if a field mask of all fields has been specified).
  136. /// Note that in the presence of schema evolution, this may mean that
  137. /// fields the client does not know and has therefore not filled into
  138. /// the request will be reset to their default. If this is unwanted
  139. /// behavior, a specific service may require a client to always specify
  140. /// a field mask, producing an error if not.
  141. ///
  142. /// As with get operations, the location of the resource which
  143. /// describes the updated values in the request message depends on the
  144. /// operation kind. In any case, the effect of the field mask is
  145. /// required to be honored by the API.
  146. ///
  147. /// ## Considerations for HTTP REST
  148. ///
  149. /// The HTTP kind of an update operation which uses a field mask must
  150. /// be set to PATCH instead of PUT in order to satisfy HTTP semantics
  151. /// (PUT must only be used for full updates).
  152. ///
  153. /// # JSON Encoding of Field Masks
  154. ///
  155. /// In JSON, a field mask is encoded as a single string where paths are
  156. /// separated by a comma. Fields name in each path are converted
  157. /// to/from lower-camel naming conventions.
  158. ///
  159. /// As an example, consider the following message declarations:
  160. ///
  161. /// message Profile {
  162. /// User user = 1;
  163. /// Photo photo = 2;
  164. /// }
  165. /// message User {
  166. /// string display_name = 1;
  167. /// string address = 2;
  168. /// }
  169. ///
  170. /// In proto a field mask for `Profile` may look as such:
  171. ///
  172. /// mask {
  173. /// paths: "user.display_name"
  174. /// paths: "photo"
  175. /// }
  176. ///
  177. /// In JSON, the same mask is represented as below:
  178. ///
  179. /// {
  180. /// mask: "user.displayName,photo"
  181. /// }
  182. ///
  183. /// # Field Masks and Oneof Fields
  184. ///
  185. /// Field masks treat fields in oneofs just as regular fields. Consider the
  186. /// following message:
  187. ///
  188. /// message SampleMessage {
  189. /// oneof test_oneof {
  190. /// string name = 4;
  191. /// SubMessage sub_message = 9;
  192. /// }
  193. /// }
  194. ///
  195. /// The field mask can be:
  196. ///
  197. /// mask {
  198. /// paths: "name"
  199. /// }
  200. ///
  201. /// Or:
  202. ///
  203. /// mask {
  204. /// paths: "sub_message"
  205. /// }
  206. ///
  207. /// Note that oneof type names ("test_oneof" in this case) cannot be used in
  208. /// paths.
  209. public struct Google_Protobuf_FieldMask: ProtobufGeneratedMessage {
  210. public var swiftClassName: String {return "Google_Protobuf_FieldMask"}
  211. public var protoMessageName: String {return "FieldMask"}
  212. public var protoPackageName: String {return "google.protobuf"}
  213. public var jsonFieldNames: [String: Int] {return [
  214. "paths": 1,
  215. ]}
  216. public var protoFieldNames: [String: Int] {return [
  217. "paths": 1,
  218. ]}
  219. /// The set of field mask paths.
  220. public var paths: [String] = []
  221. public init() {}
  222. public init(paths: [String] = [])
  223. {
  224. if !paths.isEmpty {
  225. self.paths = paths
  226. }
  227. }
  228. public mutating func _protoc_generated_decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
  229. let handled: Bool
  230. switch protoFieldNumber {
  231. case 1: handled = try setter.decodeRepeatedField(fieldType: ProtobufString.self, value: &paths)
  232. default:
  233. handled = false
  234. }
  235. return handled
  236. }
  237. public func _protoc_generated_traverse(visitor: inout ProtobufVisitor) throws {
  238. if !paths.isEmpty {
  239. try visitor.visitRepeatedField(fieldType: ProtobufString.self, value: paths, protoFieldNumber: 1, protoFieldName: "paths", jsonFieldName: "paths", swiftFieldName: "paths")
  240. }
  241. }
  242. public var _protoc_generated_isEmpty: Bool {
  243. if !paths.isEmpty {return false}
  244. return true
  245. }
  246. public func _protoc_generated_isEqualTo(other: Google_Protobuf_FieldMask) -> Bool {
  247. if paths != other.paths {return false}
  248. return true
  249. }
  250. }