-
Notifications
You must be signed in to change notification settings - Fork 0
Fix Client and LazyObjectTypeField + minor improvements #14
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
Open
pi-sigma
wants to merge
10
commits into
main
Choose a base branch
from
fix/client-requests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7425f0a to
d05f8c0
Compare
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.
d05f8c0 to
224c7ba
Compare
swrichards
approved these changes
Dec 8, 2025
swrichards
left a comment
There was a problem hiding this 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.
224c7ba to
c7318bd
Compare
…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.
c7318bd to
affcf8d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Client.get_objectsmethod used the non-existent attributeself.objects_api_clientto fetch objects, which was removed in an earlier refactor. TheLazyTypeObjectFieldhad the same defect.Clientclass andLazyTypeObjectField, including regression tests for two bugsdefault_app_config, which is deprecated sind Django 3.2ape_pieto dependencies to support type hints (it was already a transitive dependency through zgw-consumers)