diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 922af63..df40c4c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,31 @@ Changes ======= +0.33.0 (2024-03-29) +------------------- + +Deprecation release. We've deprecated more public API, but made sure to provide/offer +alternatives. This allows you to upgrade to newer versions of zgw-consumers already +while buying yourself enough time to update your project code. + +We published some of the deprecated utilities in a separate package: ``zgw-consumers-oas``. + +* Deprecated the OAS test utilities in ``zgw_consumers.test``: + + - ``read_schema``: Use ``zgw_consumers_oas.read_schema`` if you need to. + - ``generate_oas_component``: Use ``zgw_consumers_oas.generate_oas_component`` if + you need to. However, we recommend using `VCR`_ instead of manually + building API mocks, or leverage factory_boy_ to generate mock data. + - ``mock_service_oas_get``: there is no alternative because zgw-consumers no longer + fetches configured API schemas. + +* Deprecated ``zgw_consumers.drf.serializers.APIModelSerializer``. Instead, use + `djangorestframework-dataclasses`_. + +.. _VCR: https://vcrpy.readthedocs.io/en/latest/ +.. _factory_boy: https://factoryboy.readthedocs.io/en/stable/ +.. _djangorestframework-dataclasses: https://pypi.org/project/djangorestframework-dataclasses/ + 0.32.0 (2024-03-26) ------------------- diff --git a/zgw_consumers/drf/serializers.py b/zgw_consumers/drf/serializers.py index 45d399e..52a0f5f 100644 --- a/zgw_consumers/drf/serializers.py +++ b/zgw_consumers/drf/serializers.py @@ -14,10 +14,17 @@ from uuid import UUID from rest_framework import fields, serializers +from typing_extensions import deprecated from .utils import extract_model_field_type, get_field_kwargs +@deprecated( + "The APIModelSerializer is deprecated and will be removed in 1.0. " + "The package `djangorestframework-dataclasses` seems to be a drop-in replacement.", + category=DeprecationWarning, + stacklevel=2, +) class APIModelSerializer(serializers.Serializer): serializer_field_mapping = { str: fields.CharField, diff --git a/zgw_consumers/test/component_generation.py b/zgw_consumers/test/component_generation.py index da2f08e..244a58d 100644 --- a/zgw_consumers/test/component_generation.py +++ b/zgw_consumers/test/component_generation.py @@ -7,6 +7,7 @@ import yaml from faker import Faker +from typing_extensions import deprecated from .schema_mock import read_schema @@ -20,6 +21,13 @@ def load_schema(service: str): return yaml.safe_load(read_schema(service)) +@deprecated( + "OAS (test) tooling is deprecated and scheduled for removal in 1.0. We recommend " + "writing your own factories, or alternatively `pip install zgw-consumers-oas` " + "for a drop-in replacement.", + category=DeprecationWarning, + stacklevel=2, +) def generate_oas_component( service: str, component: str, diff --git a/zgw_consumers/test/schema_mock.py b/zgw_consumers/test/schema_mock.py index 17ed282..095af1c 100644 --- a/zgw_consumers/test/schema_mock.py +++ b/zgw_consumers/test/schema_mock.py @@ -8,6 +8,13 @@ _cache = {} +@deprecated( + "OAS (test) tooling is deprecated and scheduled for removal in 1.0. We recommend " + "writing your own factories, or alternatively `pip install zgw-consumers-oas` " + "for a drop-in replacement.", + category=DeprecationWarning, + stacklevel=2, +) def read_schema(service: str, extension=".yaml"): schema_dirs = get_setting("ZGW_CONSUMERS_TEST_SCHEMA_DIRS")