-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add deserializer interfaces and document implementation of them #246
Conversation
match schema.expect_member_index(): | ||
case 0: | ||
kwargs["boolean_member"] = de.read_boolean( | ||
SCHEMA.members["booleanMember"] |
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.
This is a test case, but in actual generated types, generating member schemas so that you can reference them directly from deserializers would avoid the overhead of hashing and getting the schema from a hashmap. Looking up schemas in the hashmap is kind of canceling out the benefit of deserializing based on the generated member index. I think you'd want those to be _
or even __
prefixed.
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.
In Python, property access is usually just a dict access, so there's no real difference. I'll be experimenting with slots to speed that up, but it'll add a good bit of generated code
f2d4126
to
29d0513
Compare
The base branch was changed.
29d0513
to
2ab5a3d
Compare
Had to rebase |
Depends on #245
This adds interfaces for shape deserializers, as well as document implementations for those interfaces. See #245 for additional context on why this approach is being taken.
Another advantage with both document serializers and deserializers available is a sort of compatibility layer with botocore:
There will of course be some cases where this won't work, mostly regarding cases where botocore has customized the type or name of a parameter, but for the vast majority of inputs and outputs, this should work. We could write a compatibility package that addresses those extra cases if needed.
In this way people could migrate gradually without much difficulty.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.