Skip to content

Commit 152b1f6

Browse files
author
Matt Muller
committed
Add identifier
1 parent 20c521e commit 152b1f6

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

gems/smithy/lib/smithy/plan.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Plan
77
# @param [Symbol] type The type of code to generate, either :client, :server, or :schema.
88
# @param [Hash] options
99
# @option options [String] :service_name The name of the service to generate code for.
10+
# Defaults to a name derived from the service shape.
1011
# @option options [String] :module_name The module name for clients and schemas.
1112
# Defaults to the name of the service.
1213
# @option options [String] :gem_name The gem name for clients and schemas.

gems/smithy/lib/smithy/templates/client/client.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ module <%= module_name %>
1212
class Client < Smithy::Client::Base
1313
include Smithy::Client::Stubs
1414

15-
self.service = Schema::<%= service_name %>
15+
self.service = Schema::<%= service_shape %>
16+
@identifier = :<%= identifier %>
1617

1718
<% add_plugins.each do |plugin_class| -%>
1819
add_plugin(<%= plugin_class %>)

gems/smithy/lib/smithy/views/client/client.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Client < View
88
def initialize(plan, code_generated_plugins)
99
@plan = plan
1010
@model = plan.model
11-
_, @service = plan.service.first
11+
@service_id, @service = plan.service.first
1212
@plugins = PluginList.new(plan, code_generated_plugins)
1313
super()
1414
end
@@ -27,9 +27,12 @@ def module_name
2727
@plan.module_name
2828
end
2929

30-
def service_name
31-
id, = @plan.service.first
32-
Model::Shape.name(id).camelize
30+
def service_shape
31+
Model::Shape.name(@service_id).camelize
32+
end
33+
34+
def identifier
35+
@plan.service_name.downcase
3336
end
3437

3538
def add_plugins

0 commit comments

Comments
 (0)