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

Fix: deserialize ignores new fields #12

Merged
merged 3 commits into from
Feb 15, 2024
Merged

Fix: deserialize ignores new fields #12

merged 3 commits into from
Feb 15, 2024

Conversation

majesticio
Copy link
Contributor

This introduces a modification to the deserialization logic within the Python client to gracefully handle unexpected fields in the API responses. As we've observed the current implementation raises a TypeError when it encounters any unexpected keyword arguments during the initialization of response objects.

This approach leverages the class's annotations attribute, which contains a dictionary of expected fields based on type annotations. We can filter for fields that match the annotations.

I have also included a test in tests/test_shared_responses.py to ensure that it functions as expected.

@majesticio majesticio changed the title Fix deserialize ignores new Fix: deserialize ignores new fields Feb 15, 2024
@russbiggs russbiggs merged commit 81f7804 into v0.2.1 Feb 15, 2024
1 check passed
@russbiggs russbiggs deleted the fix/deserialize branch February 15, 2024 20:58
russbiggs added a commit that referenced this pull request Feb 15, 2024
Fix: deserialize ignores new fields (#12)
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.

2 participants