Skip to content
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

🗑️ Deprecate more things that don't belong in zgw-consumer… #90

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
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
25 changes: 25 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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)
-------------------

Expand Down
7 changes: 7 additions & 0 deletions zgw_consumers/drf/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions zgw_consumers/test/component_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import yaml
from faker import Faker
from typing_extensions import deprecated

from .schema_mock import read_schema

Expand All @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions zgw_consumers/test/schema_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Loading