-
Notifications
You must be signed in to change notification settings - Fork 6
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
Implement protocol plugin and rpcv2 protocol #264
Conversation
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.
Just an idea of codegenerated protocol plugin so may be scrapped.
I liked the idea in the beginning but there's some limitations that I need to think through and makes me lean toward V3 implementation for protocols. Open to thoughts!
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.
Generally looking good - I like the weld based mapping of service traits to ruby protocol implementations.
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.
Can discuss offline later.
@@ -198,6 +211,7 @@ class StructureShape < Shape | |||
def initialize(options = {}) | |||
super | |||
@members = {} | |||
@members_by_name = {} |
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.
Basically - any shapes that involves members - we want to retain their member names to reference for (de)serialization process. (AKA the location_name in Shape ref)
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.
Yea. I think we should choose a different name though..
# @return [Boolean] | ||
def member?(name) | ||
@members.key?(name) | ||
@members.key?(name) || @members_by_name.key?(name) |
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.
I want flexibility to check members existence whether by the symbolized member name (:city_id
) vs the member name defined on the shape (cityName
). I also did this for member(name)
method
nil | ||
else | ||
format_data(value, shape.value.shape) | ||
end | ||
end | ||
end | ||
|
||
def format_structure(values, shape) |
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.
I'm going to implement the (de)serialization of union shapes in a separate PR since I have some questions before implementing. Will be a small follow-up PR most likely.
# @api private | ||
class Error < Smithy::Client::Handler | ||
def call(context) | ||
@handler.call(context).on(300..599) do |response| |
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.
Unfortunately s3 has errors at 200 level, so this may need to be 0..599 or some way to control/customize this.
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.
Yeah that makes sense - we should do some brainstorm work when we start looking into error handling.
# This configuration is required to build requests and parse responses. | ||
# In Smithy, a protocol is a named set of rules that defines the syntax | ||
# and semantics of how a client and server communicate. The given protocol | ||
# must provide the following functionalities: `build`, `parse` and `error`. |
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.
Probably want to reword this to "should respond to build(context), parse(context) etc"
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.
I'll make the changes in a separate PR.
module Smithy | ||
module Welds | ||
# Provides map of protocol trait id and its Ruby class name. | ||
# TODO: Update Welds to have a functionality to control ordering since there |
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.
I think we can add another method (later) for protocol ordering, and in aws-sdk-core, we have a plugin that defines the order (it would also have a reference to any in smithy-client).
@@ -198,6 +211,7 @@ class StructureShape < Shape | |||
def initialize(options = {}) | |||
super | |||
@members = {} | |||
@members_by_name = {} |
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.
Yea. I think we should choose a different name though..
Description
This PR aims to provide the following features:
Differences between current state of V3 and smithy-ruby:
client
gem generationprotocol
on the clientContentTypePlugin
in V3 is no longer needed - moved all the logic tobuild_request
method.Customer Experience
Customer already has a default protocol defined on client creation:
Customer could overwrite the default protocol:
Future TODOs:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.