userver: protobuf::json::PrintOptions Struct Reference
Loading...
Searching...
No Matches
protobuf::json::PrintOptions Struct Reference

#include </data/code/userver/libraries/protobuf/include/userver/protobuf/json/convert_options.hpp>

Detailed Description

Options which affect how protobuf message is converted to a JSON ValueBuilder/Value.

Definition at line 19 of file convert_options.hpp.

Public Attributes

bool always_print_fields_with_no_presence = false
 Always output protobuf message fields that do not have explicit presence. This fields are:
 
bool always_print_enums_as_ints = false
 Output enum values as integers, not as their string names.
 
bool preserve_proto_field_names = false
 Output field names exactly how specified in the proto file (usually lower_snake_case). By default, protobuf message field names are converted to lowerCamelCase format.
 

Member Data Documentation

◆ always_print_enums_as_ints

bool protobuf::json::PrintOptions::always_print_enums_as_ints = false

Output enum values as integers, not as their string names.

Definition at line 27 of file convert_options.hpp.

◆ always_print_fields_with_no_presence

bool protobuf::json::PrintOptions::always_print_fields_with_no_presence = false

Always output protobuf message fields that do not have explicit presence. This fields are:

  • implicit presence fields set to default value
  • empty repeated/map fields

Definition at line 24 of file convert_options.hpp.

◆ preserve_proto_field_names

bool protobuf::json::PrintOptions::preserve_proto_field_names = false

Output field names exactly how specified in the proto file (usually lower_snake_case). By default, protobuf message field names are converted to lowerCamelCase format.

Note
If protobuf message field has json_name option attached, then it's value is used for the JSON key name and this option does not have effect.
Warning
According to protobuf rules this option does not have effect on the field names specified in the google.protobuf.FieldMask paths during conversion. I.e., field names inside FieldMask are always encoded in lowerCamelCase no matter whether preserve_proto_field_names is on or off. Moreover, json_name option is also not taken into account for FieldMask paths.

Definition at line 37 of file convert_options.hpp.


The documentation for this struct was generated from the following file: