Add structure_response helper to consolidate response deserialization#2024
Merged
Add structure_response helper to consolidate response deserialization#2024
Conversation
…dling and update tests accordingly
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates Overkiz API response deserialization by introducing a single helper that decamelizes payloads and structures them via the shared cattrs converter, then updates client + model tests to use it.
Changes:
- Added
structure_responsehelper inpyoverkiz/converter.pyto combinedecamelize()+converter.structure(). - Replaced repeated
converter.structure(decamelize(response), T)call sites inpyoverkiz/client.pyandtests/test_models.pywithstructure_response(response, T). - Adopted PEP 695 type parameter syntax for the helper signature.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pyoverkiz/converter.py |
Adds structure_response to centralize response decamelization + structuring. |
pyoverkiz/client.py |
Refactors multiple endpoint methods to use structure_response for consistent deserialization. |
tests/test_models.py |
Updates model/event structuring tests to use structure_response instead of repeated decamelize+structure patterns. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
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.
Summary
structure_responsehelper inpyoverkiz/converter.pythat combinesdecamelize+converter.structureinto a single callconverter.structure(decamelize(response), Type)patterns inclient.pyand tests with the new helperdef structure_response[T](...))Test plan