Skip to content

Raise an error if Protobuf deprecated format is specified #1983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 2 additions & 40 deletions src/confluent_kafka/schema_registry/protobuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import io
import sys
import base64
import warnings
from collections import deque
from decimal import Context, Decimal, MAX_PREC
from typing import Set, List, Union, Optional, Any, Tuple
Expand Down Expand Up @@ -319,18 +318,6 @@ class ProtobufSerializer(BaseSerializer):
| ``schema.id.serializer`` | callable | Defines how the schema id/guid is serialized. |
| | | Defaults to prefix_schema_id_serializer. |
+-------------------------------------+----------+------------------------------------------------------+
| ``use.deprecated.format`` | bool | Specifies whether the Protobuf serializer should |
| | | serialize message indexes without zig-zag encoding. |
| | | This option must be explicitly configured as older |
| | | and newer Protobuf producers are incompatible. |
| | | If the consumers of the topic being produced to are |
| | | using confluent-kafka-python <1.8 then this property |
| | | must be set to True until all old consumers have |
| | | have been upgraded. |
| | | |
| | | Warning: This configuration property will be removed |
| | | in a future version of the client. |
+-------------------------------------+----------+------------------------------------------------------+

Schemas are registered against subject names in Confluent Schema Registry that
define a scope in which the schemas can be evolved. By default, the subject name
Expand Down Expand Up @@ -430,14 +417,7 @@ def __init__(
if not isinstance(self._use_deprecated_format, bool):
raise ValueError("use.deprecated.format must be a boolean value")
if self._use_deprecated_format:
warnings.warn("ProtobufSerializer: the 'use.deprecated.format' "
"configuration property, and the ability to use the "
"old incorrect Protobuf serializer heading format "
"introduced in confluent-kafka-python v1.4.0, "
"will be removed in an upcoming release in 2021 Q2. "
"Please migrate your Python Protobuf producers and "
"consumers to 'use.deprecated.format':False as "
"soon as possible")
raise ValueError("use.deprecated.format is no longer supported")

self._subject_name_func = conf_copy.pop('subject.name.strategy')
if not callable(self._subject_name_func):
Expand Down Expand Up @@ -665,17 +645,6 @@ class ProtobufDeserializer(BaseDeserializer):
| ``schema.id.deserializer`` | callable | Defines how the schema id/guid is deserialized. |
| | | Defaults to dual_schema_id_deserializer. |
+-------------------------------------+----------+------------------------------------------------------+
| ``use.deprecated.format`` | bool | Specifies whether the Protobuf deserializer should |
| | | deserialize message indexes without zig-zag encoding.|
| | | This option must be explicitly configured as older |
| | | and newer Protobuf producers are incompatible. |
| | | If Protobuf messages in the topic to consume were |
| | | produced with confluent-kafka-python <1.8 then this |
| | | property must be set to True until all old messages |
| | | have been processed and producers have been upgraded.|
| | | Warning: This configuration property will be removed |
| | | in a future version of the client. |
+-------------------------------------+----------+------------------------------------------------------+


See Also:
Expand Down Expand Up @@ -732,14 +701,7 @@ def __init__(
if not isinstance(self._use_deprecated_format, bool):
raise ValueError("use.deprecated.format must be a boolean value")
if self._use_deprecated_format:
warnings.warn("ProtobufDeserializer: the 'use.deprecated.format' "
"configuration property, and the ability to use the "
"old incorrect Protobuf serializer heading format "
"introduced in confluent-kafka-python v1.4.0, "
"will be removed in an upcoming release in 2022 Q2. "
"Please migrate your Python Protobuf producers and "
"consumers to 'use.deprecated.format':False as "
"soon as possible")
raise ValueError("use.deprecated.format is no longer supported")

descriptor = message_type.DESCRIPTOR
self._msg_class = GetMessageClass(descriptor)
Expand Down