django_socio_grpc.protobuf.json_format

Module Contents

Functions

_is_field_optional

Checks if a field is optional.

message_to_dict

Converts a protobuf message to a dictionary. Uses the default google.protobuf.json_format.MessageToDict function. Adds None values for optional fields that are not set.

parse_dict

API

django_socio_grpc.protobuf.json_format._is_field_optional(field)

Checks if a field is optional.

Under the hood, Optional fields are OneOf fields with only one field with the name of the OneOf prefixed with an underscore.

django_socio_grpc.protobuf.json_format.message_to_dict(message, **kwargs)

Converts a protobuf message to a dictionary. Uses the default google.protobuf.json_format.MessageToDict function. Adds None values for optional fields that are not set.

django_socio_grpc.protobuf.json_format.parse_dict(js_dict, message, **kwargs)