userver: /data/code/userver/libraries/protobuf/include/userver/protobuf/json/convert_options.hpp Source File
Loading...
Searching...
No Matches
convert_options.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/protobuf/json/convert_options.hpp
4/// @brief Protobuf messages to/from JSON `ValueBuilder`/`Value` conversion options.
5
6USERVER_NAMESPACE_BEGIN
7
8namespace protobuf::json {
9
10/// @brief Options which affect how JSON `Value` is converted to a protobuf message.
12 /// @brief Ignore unknown JSON fields and enum value names.
13 /// If not set, conversion of a JSON object containing unknown field (i.e. field that is not mapped to any protobuf
14 /// message field) or unknown enum value name will fail.
16};
17
18/// @brief Options which affect how protobuf message is converted to a JSON `ValueBuilder`/`Value`.
20 /// @brief Always output protobuf message fields that do not have explicit presence.
21 /// This fields are:
22 /// * implicit presence fields set to default value
23 /// * empty repeated/map fields
25
26 /// @brief Output enum values as integers, not as their string names.
28
29 /// @brief Output field names exactly how specified in the proto file (usually *lower_snake_case*).
30 /// By default, protobuf message field names are converted to `lowerCamelCase` format.
31 /// @note If protobuf message field has `json_name` option attached, then it's value is used for the JSON key
32 /// name and this option does not have effect.
33 /// @warning According to protobuf rules this option **does not have effect** on the field names specified in the
34 /// `google.protobuf.FieldMask` paths during conversion. I.e., field names inside `FieldMask` are always
35 /// encoded in `lowerCamelCase` no matter whether `preserve_proto_field_names` is on or off. Moreover,
36 /// `json_name` option is also not taken into account for `FieldMask` paths.
38};
39
40} // namespace protobuf::json
41
42USERVER_NAMESPACE_END