Skip to content

Remove check on "use.deprecated.format" #1941

@0x26res

Description

@0x26res

The migration from the "deprecated format" happened a few years ago. I don't think it's necessary to force user to explicitly add {"use.deprecated.format": False} in their config.

Currently it's impossible to create a ProtobufSerializer / ProtobufDeserializer without specifying this property.

Maybe the check should be run after the given config is merged into the default config (which specify the flag), see

Steps to reproduce:

import pytest
from confluent_kafka.schema_registry.protobuf import (
    ProtobufDeserializer,
    ProtobufSerializer,
)
from google.protobuf.wrappers_pb2 import DoubleValue


def test_deprecated():
    ProtobufDeserializer(DoubleValue, {"use.deprecated.format": False})

    with pytest.raises(
        RuntimeError,
        match="the 'use.deprecated.format' configuration property must be explicitly"
        " set due to backward incompatibility with older confluent-kafka-python"
        " Protobuf producers and consumers."
        " See the release notes for more details",
    ):
        ProtobufDeserializer(DoubleValue, {})
    with pytest.raises(
        RuntimeError,
        match="the 'use.deprecated.format' configuration property must be explicitly"
        " set due to backward incompatibility with older confluent-kafka-python"
        " Protobuf producers and consumers."
        " See the release notes for more details",
    ):
        ProtobufDeserializer(DoubleValue)

    ProtobufSerializer(DoubleValue, None, {"use.deprecated.format": False})
    with pytest.raises(
        RuntimeError,
        match="the 'use.deprecated.format' configuration property must be explicitly"
        " set due to backward incompatibility with older confluent-kafka-python"
        " Protobuf producers and consumers."
        " See the release notes for more details",
    ):
        ProtobufSerializer(DoubleValue, None, {})
    with pytest.raises(
        RuntimeError,
        match="the 'use.deprecated.format' configuration property must be explicitly"
        " set due to backward incompatibility with older confluent-kafka-python"
        " Protobuf producers and consumers."
        " See the release notes for more details",
    ):
        ProtobufSerializer(DoubleValue, None)


if __name__ == "__main__":
    test_deprecated()

Metadata

Metadata

Assignees

No one assigned

    Labels

    component:schema-registryAny schema registry related isues rather than kafka isolated ones

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions