Skip to content

Conversation

@pi-sigma
Copy link
Contributor

@pi-sigma pi-sigma commented Dec 3, 2025

  • The Client.get_objects method used the non-existent attribute self.objects_api_client to fetch objects, which was removed in an earlier refactor. The LazyTypeObjectField had the same defect.
  • Added various tests for the Client class and LazyTypeObjectField, including regression tests for two bugs
  • Added check for missing migrations to CI
  • Removed default_app_config, which is deprecated sind Django 3.2
  • added ape_pie to dependencies to support type hints (it was already a transitive dependency through zgw-consumers)

@pi-sigma pi-sigma force-pushed the fix/client-requests branch from 7425f0a to d05f8c0 Compare December 3, 2025 20:05
The 'Client' class is renamed to 'ObjectsAPIService' as it's more
descriptive and less confusing.

The 'get_objects()' method used the non-existent attribute
self.objects_api_client to fetch objects, which was removed in
an earlier refactor. Also added tests for the Objects API and
Objecttypes API clients. The LazyTypeObjectField had the same defect.
Since Django 3.2 it is not necessary anymore to declare a
default_app_config in the __init__. We support Django >= 4.2,
so this can be removed.

The get_object_type_choices() utility function had an unused
parameter and made a useless None-check when instantiating the
Client.
The project already had a transitive dependency on ape_pie through
zgw_consumers. ape_pie is added as first-class dependency to add
type hints in the Client class.
Dataclasses are replaced with pydantic models which allow runtime
validation. The models accord with the API specs (the dataclasses
were not correct) and have comprehensive test coverage.
Automating all aspects of version upgrade (in particular, updating the
changelog) turns out to be more hassle than it's worth for this
library. We revert to manual updates.

The CHANGELOG is updated and now distinguishes between features,
bug fixes, and maintenance work.
ObjectsAPIService would crash in case malformed response from the API,
and the admin would crash in case of missing configurations.

We also now use custom exceptions ('ObjectsAPIClientException' and
'ObjectsAPIClientValidationError') to abstract the Pydantic validation
logic from users of the library.
@pi-sigma pi-sigma force-pushed the fix/client-requests branch from d05f8c0 to 224c7ba Compare December 8, 2025 08:54
@pi-sigma pi-sigma requested a review from swrichards December 8, 2025 08:57
Copy link

@swrichards swrichards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better! Few nitpicks but nothing major.

@pi-sigma pi-sigma force-pushed the fix/client-requests branch from 224c7ba to c7318bd Compare December 10, 2025 09:59
…nfiguration'

The naming of the configuration class was confusing. Also changed the field
names for the ZGW API client configurations for the same reason.
'default_auto_field' is added to the app config and 'DEFAULT_AUTO_FIELD'
to the testapp settings in order to silence warnings from Django.
@pi-sigma pi-sigma force-pushed the fix/client-requests branch from c7318bd to affcf8d Compare December 10, 2025 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants