Skip to content

Commit

Permalink
Fix builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp committed Feb 26, 2025
1 parent 1d222f6 commit d8ee37c
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 14 deletions.
13 changes: 7 additions & 6 deletions gems/smithy-client/lib/smithy-client/plugins/stub_responses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def call(context)
stub = context.client.next_stub(context)
output = Smithy::Client::Output.new(context: context)

if Hash === stub && stub[:mutex]
if stub.is_a?(Hash) && stub[:mutex]
stub[:mutex].synchronize { apply_stub(stub, output) }
else
apply_stub(stub, output)
Expand All @@ -43,10 +43,12 @@ def call(context)

def apply_stub(stub, output)
resp = output.context.response
case
when stub[:error] then signal_error(stub[:error], resp)
when stub[:http] then signal_http(stub[:http], resp)
when stub[:data] then signal_data(stub[:data], resp)
if stub[:error]
signal_error(stub[:error], resp)
elsif stub[:http]
signal_http(stub[:http], resp)
elsif stub[:data]
signal_data(stub[:data], resp)
end
end

Expand Down Expand Up @@ -75,4 +77,3 @@ def signal_data(stub, http_resp)
end
end
end

8 changes: 4 additions & 4 deletions gems/smithy-client/lib/smithy-client/protocols/rpc_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def parse(context)

def error(context)
code, message, data = extract_error(context)
if code
errors_module = context.client.class.errors_module
errors_module.error_class(code).new(context, message, data)
end
return unless code

errors_module = context.client.class.errors_module
errors_module.error_class(code).new(context, message, data)
end

def stub_data(operation, data)
Expand Down
4 changes: 1 addition & 3 deletions gems/smithy-client/lib/smithy-client/stubs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,7 @@ def convert_stub(operation_name, stub)
when Hash then http_response_stub(operation_name, stub)
else { data: stub }
end
if stub.is_a?(Hash)
stub[:mutex] = Mutex.new
end
stub[:mutex] = Mutex.new if stub.is_a?(Hash)
stub
end

Expand Down
12 changes: 12 additions & 0 deletions gems/smithy-client/sig/smithy-client/stubs.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Smithy
module Client
module Stubs
def stub_responses: (Symbol operation_name, *untyped stubs) -> void

def api_requests: (?exclude_presign: bool) -> Array[{ operation_name: Symbol, params: untyped, context: untyped }]
| (?Hash[:exclude_presign, bool] options) -> Array[{ operation_name: Symbol, params: untyped, context: untyped }]

def stub_data: (Symbol operation_name, ?untyped data) -> untyped
end
end
end
2 changes: 1 addition & 1 deletion gems/smithy-schema/sig/smithy-schema/structure.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Smithy
module Structure
end

class Class[EmptyStructure]
class EmptyStructure
include Structure
end
end
Expand Down
2 changes: 2 additions & 0 deletions gems/smithy/lib/smithy/welds/plugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def for?(_service)
true
end

# rubocop:disable Metrics/MethodLength
def plugins
{
Smithy::Client::Plugins::Logging => {
Expand All @@ -42,6 +43,7 @@ def plugins
}
}
end
# rubocop:enable Metrics/MethodLength
end
end
end

0 comments on commit d8ee37c

Please sign in to comment.