-
Notifications
You must be signed in to change notification settings - Fork 44
fix BatchRequestItem now properly serializes the header and body fields #959
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 BatchRequestItem now properly serializes the header and body fields #959
Conversation
baywet
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.
Thanks for the contribution!
Can you add unit tests please?
Adding this test required fixing the request_info fixture and the test_initialization test because they were using a BytesIO object when the content field should just be bytes.
|
@microsoft-github-policy-service agree |
…tionWriter to test the result of serialization
|
This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged. |
baywet
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.
Thank you for making the changes!
|



Overview
The batch request item serialization does not currently work for the header and body fields. For both of them, a dictionary is being passed to the write_collection_of_object_values, which is supposed to be given a list of parsable objects. An ignore type annotation is being given to silence the error.
I've replaced the method with write_additional_data_value. This method accepts a dictionary of arbitrary types, so it's able to handle the deserialized json string for the body.
Demo
Notes
The write_additional_data_value is not intended to be used in this way, and is usually used to handle excess fields that may be included in the body of a request, but are not part of the parsable model class. A dedicated method for serializing dicts is probably needed.
Testing Instructions