package ocaml-protoc-plugin
Plugin for protoc protobuf compiler to generate ocaml definitions from a .proto file
Install
Dune Dependency
Authors
Maintainers
Sources
ocaml-protoc-plugin-6.1.0.tbz
sha256=6254d1c7bf9e41f5fd52c1cf53f3dea93d302ed38cfaf604e8360601a368c57b
sha512=aa81ac6eacbf0dd6fea07c3e9e2eb0aebc8031853ef1cad770497501a2222794c61a1dca9f6b6711039fb49474e55daebf4ad73be9191d6a585f57de3e2d816b
doc/src/ocaml-protoc-plugin.google_types/field_mask.ml.html
Source file field_mask.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562
(********************************************************) (* AUTOGENERATED FILE - DO NOT EDIT! *) (********************************************************) (* Generated by: ocaml-protoc-plugin *) (* https://github.com/andersfugmann/ocaml-protoc-plugin *) (********************************************************) (* Source: google/protobuf/field_mask.proto Syntax: proto3 Parameters: debug=false annot='' opens=[] int64_as_int=true int32_as_int=true fixed_as_int=false singleton_record=false prefix_output_with_package=false *) [@@@ocaml.alert "-protobuf"] (* Disable deprecation warnings for protobuf*) (**/**) module Runtime' = Ocaml_protoc_plugin [@@warning "-33"] module Imported'modules = struct end (**/**) module rec Google : sig module rec Protobuf : sig (** `FieldMask` represents a set of symbolic field paths, for example: {v paths: "f.a" paths: "f.b.d" v} Here `f` represents a field in some root message, `a` and `b` fields in the message found in `f`, and `d` a field found in the message in `f.b`. Field masks are used to specify a subset of fields that should be returned by a get operation or modified by an update operation. Field masks also have a custom JSON encoding (see below). # Field Masks in Projections When used in the context of a projection, a response message or sub-message is filtered by the API to only contain those fields as specified in the mask. For example, if the mask in the previous example is applied to a response message as follows: {v f { a : 22 b { d : 1 x : 2 } y : 13 } z: 8 v} The result will not contain specific values for fields x,y and z (their value will be set to the default, and omitted in proto text output): {v f { a : 22 b { d : 1 } } v} A repeated field is not allowed except at the last position of a paths string. If a FieldMask object is not present in a get operation, the operation applies to all fields (as if a FieldMask of all fields had been specified). Note that a field mask does not necessarily apply to the top-level response message. In case of a REST get operation, the field mask applies directly to the response, but in case of a REST list operation, the mask instead applies to each individual message in the returned resource list. In case of a REST custom method, other definitions may be used. Where the mask applies will be clearly documented together with its declaration in the API. In any case, the effect on the returned resource/resources is required behavior for APIs. # Field Masks in Update Operations A field mask in update operations specifies which fields of the targeted resource are going to be updated. The API is required to only change the values of the fields as specified in the mask and leave the others untouched. If a resource is passed in to describe the updated values, the API ignores the values of all fields not covered by the mask. If a repeated field is specified for an update operation, new values will be appended to the existing repeated field in the target resource. Note that a repeated field is only allowed in the last position of a `paths` string. If a sub-message is specified in the last position of the field mask for an update operation, then new value will be merged into the existing sub-message in the target resource. For example, given the target message: {v f { b { d: 1 x: 2 } c: [1] } v} And an update message: {v f { b { d: 10 } c: [2] } v} then if the field mask is: {v paths: ["f.b", "f.c"] v} then the result will be: {v f { b { d: 10 x: 2 } c: [1, 2] } v} An implementation may provide options to override this default behavior for repeated and message fields. In order to reset a field's value to the default, the field must be in the mask and set to the default value in the provided resource. Hence, in order to reset all fields of a resource, provide a default instance of the resource and set all fields in the mask, or do not provide a mask as described below. If a field mask is not present on update, the operation applies to all fields (as if a field mask of all fields has been specified). Note that in the presence of schema evolution, this may mean that fields the client does not know and has therefore not filled into the request will be reset to their default. If this is unwanted behavior, a specific service may require a client to always specify a field mask, producing an error if not. As with get operations, the location of the resource which describes the updated values in the request message depends on the operation kind. In any case, the effect of the field mask is required to be honored by the API. ## Considerations for HTTP REST The HTTP kind of an update operation which uses a field mask must be set to PATCH instead of PUT in order to satisfy HTTP semantics (PUT must only be used for full updates). # JSON Encoding of Field Masks In JSON, a field mask is encoded as a single string where paths are separated by a comma. Fields name in each path are converted to/from lower-camel naming conventions. As an example, consider the following message declarations: {v message Profile { User user = 1; Photo photo = 2; } message User { string display_name = 1; string address = 2; } v} In proto a field mask for `Profile` may look as such: {v mask { paths: "user.display_name" paths: "photo" } v} In JSON, the same mask is represented as below: {v { mask: "user.displayName,photo" } v} # Field Masks and Oneof Fields Field masks treat fields in oneofs just as regular fields. Consider the following message: {v message SampleMessage { oneof test_oneof { string name = 4; SubMessage sub_message = 9; } } v} The field mask can be: {v mask { paths: "name" } v} Or: {v mask { paths: "sub_message" } v} Note that oneof type names ("test_oneof" in this case) cannot be used in paths. ## Field Mask Verification The implementation of any API method which has a FieldMask type field in the request should verify the included field paths, and return an `INVALID_ARGUMENT` error if any path is unmappable. *) module rec FieldMask : sig type t = (string list) (** The set of field mask paths. *) val make: ?paths:string list -> unit -> t (** Helper function to generate a message using default values *) val to_proto: t -> Runtime'.Writer.t (** Serialize the message to binary format *) val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result (** Deserialize from binary format *) val to_json: Runtime'.Json_options.t -> t -> Runtime'.Json.t (** Serialize to Json (compatible with Yojson.Basic.t) *) val from_json: Runtime'.Json.t -> (t, [> Runtime'.Result.error]) result (** Deserialize from Json (compatible with Yojson.Basic.t) *) val name: unit -> string (** Fully qualified protobuf name of this message *) (**/**) type make_t = ?paths:string list -> unit -> t val merge: t -> t -> t val to_proto': Runtime'.Writer.t -> t -> unit val from_proto_exn: Runtime'.Reader.t -> t val from_json_exn: Runtime'.Json.t -> t (**/**) end end end = struct module rec Protobuf : sig (** `FieldMask` represents a set of symbolic field paths, for example: {v paths: "f.a" paths: "f.b.d" v} Here `f` represents a field in some root message, `a` and `b` fields in the message found in `f`, and `d` a field found in the message in `f.b`. Field masks are used to specify a subset of fields that should be returned by a get operation or modified by an update operation. Field masks also have a custom JSON encoding (see below). # Field Masks in Projections When used in the context of a projection, a response message or sub-message is filtered by the API to only contain those fields as specified in the mask. For example, if the mask in the previous example is applied to a response message as follows: {v f { a : 22 b { d : 1 x : 2 } y : 13 } z: 8 v} The result will not contain specific values for fields x,y and z (their value will be set to the default, and omitted in proto text output): {v f { a : 22 b { d : 1 } } v} A repeated field is not allowed except at the last position of a paths string. If a FieldMask object is not present in a get operation, the operation applies to all fields (as if a FieldMask of all fields had been specified). Note that a field mask does not necessarily apply to the top-level response message. In case of a REST get operation, the field mask applies directly to the response, but in case of a REST list operation, the mask instead applies to each individual message in the returned resource list. In case of a REST custom method, other definitions may be used. Where the mask applies will be clearly documented together with its declaration in the API. In any case, the effect on the returned resource/resources is required behavior for APIs. # Field Masks in Update Operations A field mask in update operations specifies which fields of the targeted resource are going to be updated. The API is required to only change the values of the fields as specified in the mask and leave the others untouched. If a resource is passed in to describe the updated values, the API ignores the values of all fields not covered by the mask. If a repeated field is specified for an update operation, new values will be appended to the existing repeated field in the target resource. Note that a repeated field is only allowed in the last position of a `paths` string. If a sub-message is specified in the last position of the field mask for an update operation, then new value will be merged into the existing sub-message in the target resource. For example, given the target message: {v f { b { d: 1 x: 2 } c: [1] } v} And an update message: {v f { b { d: 10 } c: [2] } v} then if the field mask is: {v paths: ["f.b", "f.c"] v} then the result will be: {v f { b { d: 10 x: 2 } c: [1, 2] } v} An implementation may provide options to override this default behavior for repeated and message fields. In order to reset a field's value to the default, the field must be in the mask and set to the default value in the provided resource. Hence, in order to reset all fields of a resource, provide a default instance of the resource and set all fields in the mask, or do not provide a mask as described below. If a field mask is not present on update, the operation applies to all fields (as if a field mask of all fields has been specified). Note that in the presence of schema evolution, this may mean that fields the client does not know and has therefore not filled into the request will be reset to their default. If this is unwanted behavior, a specific service may require a client to always specify a field mask, producing an error if not. As with get operations, the location of the resource which describes the updated values in the request message depends on the operation kind. In any case, the effect of the field mask is required to be honored by the API. ## Considerations for HTTP REST The HTTP kind of an update operation which uses a field mask must be set to PATCH instead of PUT in order to satisfy HTTP semantics (PUT must only be used for full updates). # JSON Encoding of Field Masks In JSON, a field mask is encoded as a single string where paths are separated by a comma. Fields name in each path are converted to/from lower-camel naming conventions. As an example, consider the following message declarations: {v message Profile { User user = 1; Photo photo = 2; } message User { string display_name = 1; string address = 2; } v} In proto a field mask for `Profile` may look as such: {v mask { paths: "user.display_name" paths: "photo" } v} In JSON, the same mask is represented as below: {v { mask: "user.displayName,photo" } v} # Field Masks and Oneof Fields Field masks treat fields in oneofs just as regular fields. Consider the following message: {v message SampleMessage { oneof test_oneof { string name = 4; SubMessage sub_message = 9; } } v} The field mask can be: {v mask { paths: "name" } v} Or: {v mask { paths: "sub_message" } v} Note that oneof type names ("test_oneof" in this case) cannot be used in paths. ## Field Mask Verification The implementation of any API method which has a FieldMask type field in the request should verify the included field paths, and return an `INVALID_ARGUMENT` error if any path is unmappable. *) module rec FieldMask : sig type t = (string list) (** The set of field mask paths. *) val make: ?paths:string list -> unit -> t (** Helper function to generate a message using default values *) val to_proto: t -> Runtime'.Writer.t (** Serialize the message to binary format *) val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result (** Deserialize from binary format *) val to_json: Runtime'.Json_options.t -> t -> Runtime'.Json.t (** Serialize to Json (compatible with Yojson.Basic.t) *) val from_json: Runtime'.Json.t -> (t, [> Runtime'.Result.error]) result (** Deserialize from Json (compatible with Yojson.Basic.t) *) val name: unit -> string (** Fully qualified protobuf name of this message *) (**/**) type make_t = ?paths:string list -> unit -> t val merge: t -> t -> t val to_proto': Runtime'.Writer.t -> t -> unit val from_proto_exn: Runtime'.Reader.t -> t val from_json_exn: Runtime'.Json.t -> t (**/**) end end = struct module rec FieldMask : sig type t = (string list) (** The set of field mask paths. *) val make: ?paths:string list -> unit -> t (** Helper function to generate a message using default values *) val to_proto: t -> Runtime'.Writer.t (** Serialize the message to binary format *) val from_proto: Runtime'.Reader.t -> (t, [> Runtime'.Result.error]) result (** Deserialize from binary format *) val to_json: Runtime'.Json_options.t -> t -> Runtime'.Json.t (** Serialize to Json (compatible with Yojson.Basic.t) *) val from_json: Runtime'.Json.t -> (t, [> Runtime'.Result.error]) result (** Deserialize from Json (compatible with Yojson.Basic.t) *) val name: unit -> string (** Fully qualified protobuf name of this message *) (**/**) type make_t = ?paths:string list -> unit -> t val merge: t -> t -> t val to_proto': Runtime'.Writer.t -> t -> unit val from_proto_exn: Runtime'.Reader.t -> t val from_json_exn: Runtime'.Json.t -> t (**/**) end = struct module This'_ = FieldMask let name () = ".google.protobuf.FieldMask" type t = (string list) (** The set of field mask paths. *) type make_t = ?paths:string list -> unit -> t let make ?(paths = []) () = (paths) let merge = let merge_paths = Runtime'.Merge.merge Runtime'.Spec.( repeated ((1, "paths", "paths"), string, not_packed) ) in fun (t1_paths) (t2_paths) -> merge_paths t1_paths t2_paths let spec () = Runtime'.Spec.( repeated ((1, "paths", "paths"), string, not_packed) ^:: nil ) let to_proto' = let serialize = Runtime'.apply_lazy (fun () -> Runtime'.Serialize.serialize (spec ())) in fun writer (paths) -> serialize writer paths let to_proto t = let writer = Runtime'.Writer.init () in to_proto' writer t; writer let from_proto_exn = let constructor paths = (paths) in Runtime'.apply_lazy (fun () -> Runtime'.Deserialize.deserialize (spec ()) constructor) let from_proto writer = Runtime'.Result.catch (fun () -> from_proto_exn writer) let to_json options = let serialize = Runtime'.Serialize_json.serialize ~message_name:(name ()) (spec ()) options in fun (paths) -> serialize paths let from_json_exn = let constructor paths = (paths) in Runtime'.apply_lazy (fun () -> Runtime'.Deserialize_json.deserialize ~message_name:(name ()) (spec ()) constructor) let from_json json = Runtime'.Result.catch (fun () -> from_json_exn json) end end end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>