package ocaml-protoc
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=88533848ee8ad662bfb063f34932286405977fa3810515b997119b06f05105e4
sha512=df12c71f7181eafc94cd0fc400edf7f258cdd3740a5badafce097f771b7828fed9a9a9c0a457e7e118848a8b1ddd87fe3134a5bdf88d4adcb0d0e04ba6808c5f
doc/ocaml-protoc.compiler-lib/Ocaml_protoc_compiler_lib/Pb_option/index.html
Module Ocaml_protoc_compiler_lib.Pb_optionSource
Protobuf File/Message/Field options
This module represents "compiled" option set, which is high level representation, as opposed to low-level representation in Pb_raw_option module.
For the following "raw" set of options:
option (google.api.http).custom.kind = "FETCH";
option (google.api.http).custom.path = "/foo/bar/baz/{id}";
option (google.api.http).additional_bindings = {
get: "/foo/bar/baz/{id}"
};
option (google.api.http).additional_bindings = {
post: "/foo/bar/baz/"
body: "*"
};The "compiled" representation will have only one option (google.api.http), which is a message:
option (google.api.http) = {
custom: {
kind: "FETCH"
path: "/foo/bar/baz/{id}"
}
additional_bindings: [
{
get: "/foo/bar/baz/{id}"
},
{
post: "/foo/bar/baz/"
body: "*"
}
]
};Option normalization is happening in Pb_typing_validation.normalize_option, destructured field assigments are normalized back to nested messages. See Pb_typing_validation.compile_option to see the full process of option compilation.
Protobuf constant
As defined in: Protobuf Language Spec.
and value = Pbrt_options.value = | Scalar_value of constant| Message_literal of message_literal| List_literal of list_literal
Top level option name
add set name value adds option (name, value) into the set. Option name and value are expected to be normalized (see Pb_typing_validation.normalize_option). add is merging nested message literals within option value with the ones that were previously added to the set.
get_ext set name is a helper that retrieves Extension_name name option from set