-
Notifications
You must be signed in to change notification settings - Fork 0
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: allow unexpected fields in responses #69
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
Just noticed a missing |
this helper method allows for the presence of unexpected fields in the response JSON. this establishes the convention that response classes (at least the ones that are used for GET responses) must define this class method.
397e0e4
to
859b316
Compare
Ready for review! |
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.
Very nice 👍
I ran Benefits with this branch of
Then I added |
I think this is fine. It's a valid field now available in the API response, so we can parse it and make it available in case others are using our library. |
Closes #66
This PR makes it so GET requests will allow unexpected fields in the response JSON. The main code changes was for
Client._get
to expect that it can callfrom_kwargs
to instantiate the response object, and to addfrom_kwargs
as a class method on all response dataclasses.Looking at our
Client
code and usages of_get
,_post
, and_put
, we see that it is really only_get
that tries to hydrate specific response dataclasses. Endpoints that use_put
and_post
all pass indict
as the response class to hydrate.So it is a sufficient fix to only change
Client._get
.