Skip to content

Commit c9de3bb

Browse files
authored
Raise an error if Protobuf deprecated format is specified (#1986)
1 parent b1fa5d9 commit c9de3bb

File tree

1 file changed

+2
-40
lines changed

1 file changed

+2
-40
lines changed

src/confluent_kafka/schema_registry/_sync/protobuf.py

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
# limitations under the License.
1717

1818
import io
19-
import warnings
2019
from typing import Set, List, Union, Optional, Tuple
2120

2221
from google.protobuf import json_format, descriptor_pb2
@@ -147,18 +146,6 @@ class ProtobufSerializer(BaseSerializer):
147146
| ``schema.id.serializer`` | callable | Defines how the schema id/guid is serialized. |
148147
| | | Defaults to prefix_schema_id_serializer. |
149148
+-------------------------------------+----------+------------------------------------------------------+
150-
| ``use.deprecated.format`` | bool | Specifies whether the Protobuf serializer should |
151-
| | | serialize message indexes without zig-zag encoding. |
152-
| | | This option must be explicitly configured as older |
153-
| | | and newer Protobuf producers are incompatible. |
154-
| | | If the consumers of the topic being produced to are |
155-
| | | using confluent-kafka-python <1.8 then this property |
156-
| | | must be set to True until all old consumers have |
157-
| | | have been upgraded. |
158-
| | | |
159-
| | | Warning: This configuration property will be removed |
160-
| | | in a future version of the client. |
161-
+-------------------------------------+----------+------------------------------------------------------+
162149
163150
Schemas are registered against subject names in Confluent Schema Registry that
164151
define a scope in which the schemas can be evolved. By default, the subject name
@@ -258,14 +245,7 @@ def __init__(
258245
if not isinstance(self._use_deprecated_format, bool):
259246
raise ValueError("use.deprecated.format must be a boolean value")
260247
if self._use_deprecated_format:
261-
warnings.warn("ProtobufSerializer: the 'use.deprecated.format' "
262-
"configuration property, and the ability to use the "
263-
"old incorrect Protobuf serializer heading format "
264-
"introduced in confluent-kafka-python v1.4.0, "
265-
"will be removed in an upcoming release in 2021 Q2. "
266-
"Please migrate your Python Protobuf producers and "
267-
"consumers to 'use.deprecated.format':False as "
268-
"soon as possible")
248+
raise ValueError("use.deprecated.format is no longer supported")
269249

270250
self._subject_name_func = conf_copy.pop('subject.name.strategy')
271251
if not callable(self._subject_name_func):
@@ -496,17 +476,6 @@ class ProtobufDeserializer(BaseDeserializer):
496476
| ``schema.id.deserializer`` | callable | Defines how the schema id/guid is deserialized. |
497477
| | | Defaults to dual_schema_id_deserializer. |
498478
+-------------------------------------+----------+------------------------------------------------------+
499-
| ``use.deprecated.format`` | bool | Specifies whether the Protobuf deserializer should |
500-
| | | deserialize message indexes without zig-zag encoding.|
501-
| | | This option must be explicitly configured as older |
502-
| | | and newer Protobuf producers are incompatible. |
503-
| | | If Protobuf messages in the topic to consume were |
504-
| | | produced with confluent-kafka-python <1.8 then this |
505-
| | | property must be set to True until all old messages |
506-
| | | have been processed and producers have been upgraded.|
507-
| | | Warning: This configuration property will be removed |
508-
| | | in a future version of the client. |
509-
+-------------------------------------+----------+------------------------------------------------------+
510479
511480
512481
See Also:
@@ -563,14 +532,7 @@ def __init__(
563532
if not isinstance(self._use_deprecated_format, bool):
564533
raise ValueError("use.deprecated.format must be a boolean value")
565534
if self._use_deprecated_format:
566-
warnings.warn("ProtobufDeserializer: the 'use.deprecated.format' "
567-
"configuration property, and the ability to use the "
568-
"old incorrect Protobuf serializer heading format "
569-
"introduced in confluent-kafka-python v1.4.0, "
570-
"will be removed in an upcoming release in 2022 Q2. "
571-
"Please migrate your Python Protobuf producers and "
572-
"consumers to 'use.deprecated.format':False as "
573-
"soon as possible")
535+
raise ValueError("use.deprecated.format is no longer supported")
574536

575537
descriptor = message_type.DESCRIPTOR
576538
self._msg_class = GetMessageClass(descriptor)

0 commit comments

Comments
 (0)