Skip to content

Commit bfef195

Browse files
committed
name -> service name in plan
1 parent 90de2bf commit bfef195

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

gems/smithy/lib/smithy/command.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class Smith < Base
2121
class_option :quiet, type: :boolean, default: false, desc: 'Suppress all output.'
2222

2323
def self.gem_options!
24-
method_option :name, type: :string,
25-
desc: 'The name of the service to generate code for.' \
26-
'Defaults to the name of the first service shape found in the model.'
24+
method_option :service_name, type: :string,
25+
desc: 'The name of the service to generate code for.' \
26+
'Defaults to the name of the first service shape found in the model.'
2727
method_option :module_name, type: :string,
2828
desc: 'The module name to generate, e.g. `Organization::Weather`. ' \
2929
'Defaults to the name of the service.'

gems/smithy/lib/smithy/plan.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Plan
66
# @param [Hash] model The API model as a JSON hash.
77
# @param [Symbol] type The type of code to generate, either :client, :server, or :schema.
88
# @param [Hash] options
9-
# @option options [String] :name The name of the service to generate code for.
9+
# @option options [String] :service_name The name of the service to generate code for.
1010
# @option options [String] :module_name The module name for clients and schemas.
1111
# Defaults to the name of the service.
1212
# @option options [String] :gem_name The gem name for clients and schemas.
@@ -20,8 +20,8 @@ def initialize(model, type, options = {})
2020
@type = type
2121
@service = find_service(model['shapes'])
2222

23-
@name = options.fetch(:name, default_name(@service))
24-
@module_name = options.fetch(:module_name, @name)
23+
@service_name = options.fetch(:service_name, default_service_name(@service))
24+
@module_name = options.fetch(:module_name, @service_name)
2525
@gem_name = options.fetch(:gem_name, default_gem_name(@module_name, @type))
2626
@gem_version = options.fetch(:gem_version)
2727

@@ -42,7 +42,7 @@ def initialize(model, type, options = {})
4242
attr_reader :service
4343

4444
# @return [String] The name of the service.
45-
attr_reader :name
45+
attr_reader :service_name
4646

4747
# @return [String] The module name for clients and schemas.
4848
attr_reader :module_name
@@ -72,7 +72,7 @@ def find_service(shapes)
7272
service
7373
end
7474

75-
def default_name(service)
75+
def default_service_name(service)
7676
Model::Shape.name(service.keys.first)
7777
end
7878

gems/smithy/spec/smithy/plan_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ module Smithy
5757
end
5858
end
5959

60-
describe '#name' do
60+
describe '#service_name' do
6161
it 'defaults to the name of the service' do
62-
expect(subject.name).to eq('Weather')
62+
expect(subject.service_name).to eq('Weather')
6363
end
6464
end
6565

6666
describe '#module_name' do
67-
it 'defaults to the name' do
68-
expect(subject.module_name).to eq(subject.name)
67+
it 'defaults to the service name' do
68+
expect(subject.module_name).to eq(subject.service_name)
6969
end
7070
end
7171

0 commit comments

Comments
 (0)