diff --git a/gems/smithy/lib/smithy/generators/client.rb b/gems/smithy/lib/smithy/generators/client.rb index 5aed59166..bc01c6049 100644 --- a/gems/smithy/lib/smithy/generators/client.rb +++ b/gems/smithy/lib/smithy/generators/client.rb @@ -35,7 +35,6 @@ def gem_files e.yield 'VERSION', Views::Client::Version.new(@plan).render e.yield 'CHANGELOG.md', Views::Client::ChangelogMd.new.render e.yield "#{@gem_name}.gemspec", Views::Client::Gemspec.new(@plan).render - e.yield '.rubocop.yml', Views::Client::RubocopYml.new(@plan).render source_files.each { |file, content| e.yield file, content } e.yield "lib/#{@gem_name}/customizations.rb", Views::Client::Customizations.new.render diff --git a/gems/smithy/lib/smithy/generators/schema.rb b/gems/smithy/lib/smithy/generators/schema.rb index 4b844cfcf..373f5b834 100644 --- a/gems/smithy/lib/smithy/generators/schema.rb +++ b/gems/smithy/lib/smithy/generators/schema.rb @@ -35,7 +35,6 @@ def gem_files e.yield 'VERSION', Views::Client::Version.new(@plan).render e.yield 'CHANGELOG.md', Views::Client::ChangelogMd.new.render e.yield "#{@gem_name}.gemspec", Views::Client::Gemspec.new(@plan).render - e.yield '.rubocop.yml', Views::Client::RubocopYml.new(@plan).render source_files.each { |file, content| e.yield file, content } e.yield "lib/#{@gem_name}/customizations.rb", Views::Client::Customizations.new.render diff --git a/gems/smithy/lib/smithy/templates/client/auth_parameters.erb b/gems/smithy/lib/smithy/templates/client/auth_parameters.erb index db67dfb65..d3ab9faf0 100644 --- a/gems/smithy/lib/smithy/templates/client/auth_parameters.erb +++ b/gems/smithy/lib/smithy/templates/client/auth_parameters.erb @@ -19,10 +19,8 @@ module <%= module_name %> <% end -%> keyword_init: true ) do - # @api private def self.create(context) - # TODO: support more properties new(operation_name: context.operation_name) end end diff --git a/gems/smithy/lib/smithy/templates/client/endpoint_parameters.erb b/gems/smithy/lib/smithy/templates/client/endpoint_parameters.erb index 090f15c49..09642f2c4 100644 --- a/gems/smithy/lib/smithy/templates/client/endpoint_parameters.erb +++ b/gems/smithy/lib/smithy/templates/client/endpoint_parameters.erb @@ -19,7 +19,6 @@ module <%= module_name %> <% end -%> keyword_init: true ) do - def initialize(options = {}) <% parameters.each do |param| -%> self.<%= param.name %> = options.fetch(:<%= param.name %>, <%= param.default_value %>) diff --git a/gems/smithy/lib/smithy/templates/client/endpoint_plugin.erb b/gems/smithy/lib/smithy/templates/client/endpoint_plugin.erb index 907e173e3..6723a00e7 100644 --- a/gems/smithy/lib/smithy/templates/client/endpoint_plugin.erb +++ b/gems/smithy/lib/smithy/templates/client/endpoint_plugin.erb @@ -9,7 +9,7 @@ module <%= module_name %> option( :endpoint_provider, doc_type: '<%= module_name %>::EndpointProvider', - docstring: <<~DOCS) do |config| + docstring: <<~DOCS) do |_config| The endpoint provider used to resolve endpoints. Any object that responds to `#resolve(parameters)`. DOCS EndpointProvider.new diff --git a/gems/smithy/lib/smithy/templates/client/errors.erb b/gems/smithy/lib/smithy/templates/client/errors.erb index 24ce47758..66927175b 100644 --- a/gems/smithy/lib/smithy/templates/client/errors.erb +++ b/gems/smithy/lib/smithy/templates/client/errors.erb @@ -39,7 +39,7 @@ module <%= module_name %> # @param [Smithy::Client::HandlerContext] context # @param [<%= module_name %>::Types::<%= error.name %>] data def initialize(context, data = Smithy::Schema::EmptyStructure.new) - super(context, data) + super end <% error.members.each do |member| -%> diff --git a/gems/smithy/lib/smithy/templates/client/gemspec.erb b/gems/smithy/lib/smithy/templates/client/gemspec.erb index 1de0cccb7..3d6a5f630 100644 --- a/gems/smithy/lib/smithy/templates/client/gemspec.erb +++ b/gems/smithy/lib/smithy/templates/client/gemspec.erb @@ -4,7 +4,7 @@ Gem::Specification.new do |spec| spec.name = '<%= gem_name %>' - spec.version = File.read(File.expand_path('../VERSION', __FILE__)) + spec.version = File.read(File.expand_path('VERSION', __dir__)) spec.summary = 'Generated gem using Smithy' spec.authors = ['Smithy Ruby'] spec.files = Dir['VERSION', 'CHANGELOG.md', 'lib/**/*.rb', base: __dir__] diff --git a/gems/smithy/lib/smithy/templates/client/module.erb b/gems/smithy/lib/smithy/templates/client/module.erb index 790f446bf..225bdd156 100644 --- a/gems/smithy/lib/smithy/templates/client/module.erb +++ b/gems/smithy/lib/smithy/templates/client/module.erb @@ -4,7 +4,7 @@ <% requires.each do |require| -%> require '<%= require %>' -<% end %> +<% end -%> <% ["Object"].concat(module_names).each_cons(2) do |parent, child| -%> <%= parent %>.const_set('<%= child %>', Module.new) unless <%= parent %>.const_defined?('<%= child %>') diff --git a/gems/smithy/lib/smithy/templates/client/rubocop_yml.erb b/gems/smithy/lib/smithy/templates/client/rubocop_yml.erb deleted file mode 100644 index e9499de50..000000000 --- a/gems/smithy/lib/smithy/templates/client/rubocop_yml.erb +++ /dev/null @@ -1,33 +0,0 @@ -AllCops: - NewCops: enable - TargetRubyVersion: 3.3 - SuggestExtensions: false - -Gemspec/RequireMFA: - Enabled: false - -Layout/LineLength: - Enabled: false - -Lint/StructNewOverride: - Enabled: false - -Metrics/AbcSize: - Enabled: false - -Metrics/BlockLength: - Enabled: false - -Metrics/MethodLength: - Enabled: false - -Metrics/ModuleLength: - Enabled: false - -Naming/FileName: - Exclude: - - 'lib/<%= gem_name %>.rb' - -Style/Documentation: - Exclude: - - 'spec/**/*.rb' diff --git a/gems/smithy/lib/smithy/templates/client/schema.erb b/gems/smithy/lib/smithy/templates/client/schema.erb index b43f495b5..0a3afda6c 100644 --- a/gems/smithy/lib/smithy/templates/client/schema.erb +++ b/gems/smithy/lib/smithy/templates/client/schema.erb @@ -61,7 +61,6 @@ module <%= module_name %> <% end -%> end) <% end -%> - end class << self diff --git a/gems/smithy/lib/smithy/templates/client/types.erb b/gems/smithy/lib/smithy/templates/client/types.erb index b4fedc70c..dcf461161 100644 --- a/gems/smithy/lib/smithy/templates/client/types.erb +++ b/gems/smithy/lib/smithy/templates/client/types.erb @@ -19,7 +19,8 @@ module <%= module_name %> <% type.members.each do |member| -%> :<%= member.name.underscore %>, <% end -%> - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure <% if !type.input? && type.defaults.any? -%> @@ -40,7 +41,8 @@ module <%= module_name %> :<%= member.name.underscore %>, <% end -%> :unknown, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Union <% type.members.each do |member| -%> diff --git a/gems/smithy/lib/smithy/templates/client/waiters.erb b/gems/smithy/lib/smithy/templates/client/waiters.erb index 70cb16706..9a166fc17 100644 --- a/gems/smithy/lib/smithy/templates/client/waiters.erb +++ b/gems/smithy/lib/smithy/templates/client/waiters.erb @@ -39,4 +39,4 @@ module <%= module_name %> <% end -%> end -end \ No newline at end of file +end diff --git a/gems/smithy/lib/smithy/views/client.rb b/gems/smithy/lib/smithy/views/client.rb index 20415248f..d99bc3709 100644 --- a/gems/smithy/lib/smithy/views/client.rb +++ b/gems/smithy/lib/smithy/views/client.rb @@ -38,7 +38,6 @@ module Client; end require_relative 'client/module_rbs' require_relative 'client/paginators' require_relative 'client/protocol_spec' -require_relative 'client/rubocop_yml' require_relative 'client/schema' require_relative 'client/schema_rbs' require_relative 'client/spec_helper' diff --git a/gems/smithy/lib/smithy/views/client/endpoint_provider.rb b/gems/smithy/lib/smithy/views/client/endpoint_provider.rb index 8c1db6794..cad589308 100644 --- a/gems/smithy/lib/smithy/views/client/endpoint_provider.rb +++ b/gems/smithy/lib/smithy/views/client/endpoint_provider.rb @@ -12,10 +12,8 @@ def initialize(plan) @model = plan.model service = @plan.service.values.first @endpoint_rules = service['traits']['smithy.rules#endpointRuleSet'] - @parameters = @endpoint_rules['parameters'] - .map { |id, data| EndpointParameter.new(id, data, @plan) } - @endpoint_function_bindings = - plan.welds.map(&:endpoint_function_bindings).reduce({}, :merge) + @parameters = @endpoint_rules['parameters'].map { |id, data| EndpointParameter.new(id, data, @plan) } + @endpoint_function_bindings = plan.welds.map(&:endpoint_function_bindings).reduce({}, :merge) @assigned_variables = [] super() end @@ -116,7 +114,9 @@ def error_rule_with_condition(levels, rule) end def error(error, levels) - indent("raise ArgumentError, #{str(error)}\n", levels) + error_str = "raise ArgumentError, #{str(error)}" + error_str += "\n" unless levels == 3 + indent(error_str, levels) end def tree_rule(rule, levels = 3) diff --git a/gems/smithy/lib/smithy/views/client/gemspec.rb b/gems/smithy/lib/smithy/views/client/gemspec.rb index 79011a10f..17a8e4a0f 100644 --- a/gems/smithy/lib/smithy/views/client/gemspec.rb +++ b/gems/smithy/lib/smithy/views/client/gemspec.rb @@ -19,7 +19,7 @@ def dependencies dependencies = dependencies.except(@plan.welds.map(&:remove_dependencies).reduce([], :+)) dependencies.merge!( if @plan.type == :schema - { 'smithy-schema' => '~> 1' } + { 'smithy-schema' => '1.0.0.pre1' } else { 'smithy-client' => '1.0.0.pre1' } end diff --git a/gems/smithy/lib/smithy/views/client/paginators.rb b/gems/smithy/lib/smithy/views/client/paginators.rb index e868f36f8..e7c73da33 100644 --- a/gems/smithy/lib/smithy/views/client/paginators.rb +++ b/gems/smithy/lib/smithy/views/client/paginators.rb @@ -51,7 +51,7 @@ def initialize(name, trait) def next_tokens_code next_token_getter = output_getter(@output_token) code = ["next_token = #{next_token_getter}"] - code << 'return {} if next_token.nil? || next_token.empty?' + code << "return {} if next_token.nil? || next_token.empty?\n" code << 'tokens = Hash.new { |h, k| h[k] = {} }' next_token_setter = input_getter(@input_token, 'tokens') code << "#{next_token_setter} = next_token" @@ -62,7 +62,7 @@ def next_tokens_code def prev_tokens_code prev_token_getter = input_getter(@input_token) code = ["prev_token = #{prev_token_getter}"] - code << 'return {} if prev_token.nil? || prev_token.empty?' + code << "return {} if prev_token.nil? || prev_token.empty?\n" code << 'tokens = Hash.new { |h, k| h[k] = {} }' prev_token_setter = input_getter(@input_token, 'tokens') code << "#{prev_token_setter} = prev_token" diff --git a/gems/smithy/lib/smithy/views/client/rubocop_yml.rb b/gems/smithy/lib/smithy/views/client/rubocop_yml.rb deleted file mode 100644 index 6d53bc53a..000000000 --- a/gems/smithy/lib/smithy/views/client/rubocop_yml.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module Smithy - module Views - module Client - # @api private - class RubocopYml < View - def initialize(plan) - @plan = plan - super() - end - - def gem_name - @plan.gem_name - end - end - end - end -end diff --git a/gems/smithy/lib/smithy/welds.rb b/gems/smithy/lib/smithy/welds.rb index eb87b9411..63fe72e4e 100644 --- a/gems/smithy/lib/smithy/welds.rb +++ b/gems/smithy/lib/smithy/welds.rb @@ -11,9 +11,6 @@ require_relative 'welds/default_plugins' require_relative 'welds/protocols' -# Disabled due to performance -# require_relative 'welds/rubocop' - module Smithy # @api private module Welds diff --git a/gems/smithy/lib/smithy/welds/rubocop.rb b/gems/smithy/lib/smithy/welds/rubocop.rb deleted file mode 100644 index c53606821..000000000 --- a/gems/smithy/lib/smithy/welds/rubocop.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -module Smithy - module Welds - # Runs RuboCop autocorrect-all on the generated projections. - class Rubocop < Weld - TEST_NAMESPACES = [ - Regexp.new('smithy.tests.*?'), - Regexp.new('smithy.protocoltests.*?'), - Regexp.new('smithy.ruby.tests.*?') - ].freeze - - def for?(service) - namespace = Model::Shape.namespace(service.keys.first).to_s - TEST_NAMESPACES.none? { |test_namespace| namespace.match?(test_namespace) } - end - - def post_process(_artifacts) - require 'rubocop' - puts "Running RuboCop --autocorrect-all on #{destination_root}" - rubocop = ::RuboCop::CLI.new - args = [ - '--autocorrect-all', - '--display-only-fail-level-offenses', - '--config', - "#{destination_root}/.rubocop.yml", - destination_root - ] - rubocop.run(args) - end - end - end -end diff --git a/gems/smithy/spec/support/examples/gemspec_examples.rb b/gems/smithy/spec/support/examples/gemspec_examples.rb index 3aa555f92..26484263b 100644 --- a/gems/smithy/spec/support/examples/gemspec_examples.rb +++ b/gems/smithy/spec/support/examples/gemspec_examples.rb @@ -28,7 +28,7 @@ expect(gem.files).to include("lib/#{gem_name}/types.rb", "lib/#{gem_name}/schema.rb") expect(gem.license).to eq('Apache-2.0') dependency = context.include?('schema') ? 'smithy-schema' : 'smithy-client' - expect(gem.dependencies).to include(Gem::Dependency.new(dependency, '~> 1')) + expect(gem.dependencies).to include(Gem::Dependency.new(dependency, '1.0.0.pre1')) expect(gem.required_ruby_version).to eq(Gem::Requirement.new('>= 3.3')) end end @@ -60,7 +60,7 @@ expect(gem.files).to include("lib/#{gem_name}/types.rb", "lib/#{gem_name}/schema.rb") expect(gem.license).to eq('Apache-2.0') dependency = context.include?('schema') ? 'smithy-schema' : 'smithy-client' - expect(gem.dependencies).to include(Gem::Dependency.new(dependency, '~> 1')) + expect(gem.dependencies).to include(Gem::Dependency.new(dependency, '1.0.0.pre1')) expect(gem.required_ruby_version).to eq(Gem::Requirement.new('>= 3.3')) end end diff --git a/projections/shapes/.rubocop.yml b/projections/shapes/.rubocop.yml deleted file mode 100644 index 1d9b0c12e..000000000 --- a/projections/shapes/.rubocop.yml +++ /dev/null @@ -1,33 +0,0 @@ -AllCops: - NewCops: enable - TargetRubyVersion: 3.3 - SuggestExtensions: false - -Gemspec/RequireMFA: - Enabled: false - -Layout/LineLength: - Enabled: false - -Lint/StructNewOverride: - Enabled: false - -Metrics/AbcSize: - Enabled: false - -Metrics/BlockLength: - Enabled: false - -Metrics/MethodLength: - Enabled: false - -Metrics/ModuleLength: - Enabled: false - -Naming/FileName: - Exclude: - - 'lib/shapes.rb' - -Style/Documentation: - Exclude: - - 'spec/**/*.rb' diff --git a/projections/shapes/lib/shapes.rb b/projections/shapes/lib/shapes.rb index 44f4a8f9e..116444c06 100644 --- a/projections/shapes/lib/shapes.rb +++ b/projections/shapes/lib/shapes.rb @@ -4,7 +4,6 @@ require 'smithy-client' - Object.const_set('ShapeService', Module.new) unless Object.const_defined?('ShapeService') module ShapeService diff --git a/projections/shapes/lib/shapes/auth_parameters.rb b/projections/shapes/lib/shapes/auth_parameters.rb index 879a670b1..d1a2f97e2 100644 --- a/projections/shapes/lib/shapes/auth_parameters.rb +++ b/projections/shapes/lib/shapes/auth_parameters.rb @@ -13,10 +13,8 @@ module ShapeService :operation_name, keyword_init: true ) do - # @api private def self.create(context) - # TODO: support more properties new(operation_name: context.operation_name) end end diff --git a/projections/shapes/lib/shapes/endpoint_parameters.rb b/projections/shapes/lib/shapes/endpoint_parameters.rb index 32d0955c0..e5cc0b6c2 100644 --- a/projections/shapes/lib/shapes/endpoint_parameters.rb +++ b/projections/shapes/lib/shapes/endpoint_parameters.rb @@ -13,7 +13,6 @@ module ShapeService :endpoint, keyword_init: true ) do - def initialize(options = {}) self.endpoint = options.fetch(:endpoint, nil) end diff --git a/projections/shapes/lib/shapes/endpoint_provider.rb b/projections/shapes/lib/shapes/endpoint_provider.rb index ff367ab9f..e9d5257c5 100644 --- a/projections/shapes/lib/shapes/endpoint_provider.rb +++ b/projections/shapes/lib/shapes/endpoint_provider.rb @@ -13,7 +13,6 @@ def resolve(parameters) return Smithy::Client::EndpointRules::Endpoint.new(uri: parameters.endpoint) end raise ArgumentError, "Endpoint is not set - you must configure an endpoint." - end end end diff --git a/projections/shapes/lib/shapes/plugins/endpoint.rb b/projections/shapes/lib/shapes/plugins/endpoint.rb index c22729d51..aea388f0a 100644 --- a/projections/shapes/lib/shapes/plugins/endpoint.rb +++ b/projections/shapes/lib/shapes/plugins/endpoint.rb @@ -9,7 +9,7 @@ class Endpoint < Smithy::Client::Plugin option( :endpoint_provider, doc_type: 'ShapeService::EndpointProvider', - docstring: <<~DOCS) do |config| + docstring: <<~DOCS) do |_config| The endpoint provider used to resolve endpoints. Any object that responds to `#resolve(parameters)`. DOCS EndpointProvider.new diff --git a/projections/shapes/lib/shapes/schema.rb b/projections/shapes/lib/shapes/schema.rb index ad8aafe1b..4f2957ddf 100644 --- a/projections/shapes/lib/shapes/schema.rb +++ b/projections/shapes/lib/shapes/schema.rb @@ -93,7 +93,6 @@ module Schema operation.output = ::Smithy::Schema::Shapes::ShapeRef.new(shape: OperationOutput) operation.traits = {"smithy.ruby.tests#shape" => {}} end) - end class << self diff --git a/projections/shapes/lib/shapes/types.rb b/projections/shapes/lib/shapes/types.rb index 986ae8e39..1024377bb 100644 --- a/projections/shapes/lib/shapes/types.rb +++ b/projections/shapes/lib/shapes/types.rb @@ -64,7 +64,8 @@ class OperationInput < Struct.new( :map, :structure, :union, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure end @@ -126,7 +127,8 @@ class OperationOutput < Struct.new( :map, :structure, :union, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure end @@ -134,7 +136,8 @@ class OperationOutput < Struct.new( # @return [String] class Structure < Struct.new( :member, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure end @@ -149,7 +152,8 @@ class Union < Struct.new( :structure, :unit, :unknown, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Union class String < Union; end diff --git a/projections/shapes/lib/shapes/waiters.rb b/projections/shapes/lib/shapes/waiters.rb index 89181cd0b..308fae9c1 100644 --- a/projections/shapes/lib/shapes/waiters.rb +++ b/projections/shapes/lib/shapes/waiters.rb @@ -7,4 +7,4 @@ module ShapeService # @api private module Waiters end -end \ No newline at end of file +end diff --git a/projections/shapes/shapes.gemspec b/projections/shapes/shapes.gemspec index 66d3ee0c0..6cbf3c16a 100644 --- a/projections/shapes/shapes.gemspec +++ b/projections/shapes/shapes.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |spec| spec.name = 'shapes' - spec.version = File.read(File.expand_path('../VERSION', __FILE__)) + spec.version = File.read(File.expand_path('VERSION', __dir__)) spec.summary = 'Generated gem using Smithy' spec.authors = ['Smithy Ruby'] spec.files = Dir['VERSION', 'CHANGELOG.md', 'lib/**/*.rb', base: __dir__] diff --git a/projections/weather/.rubocop.yml b/projections/weather/.rubocop.yml deleted file mode 100644 index eea3878b3..000000000 --- a/projections/weather/.rubocop.yml +++ /dev/null @@ -1,33 +0,0 @@ -AllCops: - NewCops: enable - TargetRubyVersion: 3.3 - SuggestExtensions: false - -Gemspec/RequireMFA: - Enabled: false - -Layout/LineLength: - Enabled: false - -Lint/StructNewOverride: - Enabled: false - -Metrics/AbcSize: - Enabled: false - -Metrics/BlockLength: - Enabled: false - -Metrics/MethodLength: - Enabled: false - -Metrics/ModuleLength: - Enabled: false - -Naming/FileName: - Exclude: - - 'lib/weather.rb' - -Style/Documentation: - Exclude: - - 'spec/**/*.rb' diff --git a/projections/weather/lib/weather.rb b/projections/weather/lib/weather.rb index 589f61c2b..ecfdd9db0 100644 --- a/projections/weather/lib/weather.rb +++ b/projections/weather/lib/weather.rb @@ -4,7 +4,6 @@ require 'smithy-client' - Object.const_set('Weather', Module.new) unless Object.const_defined?('Weather') # Provides weather forecasts. diff --git a/projections/weather/lib/weather/auth_parameters.rb b/projections/weather/lib/weather/auth_parameters.rb index cb752b9c5..b2530b96e 100644 --- a/projections/weather/lib/weather/auth_parameters.rb +++ b/projections/weather/lib/weather/auth_parameters.rb @@ -13,10 +13,8 @@ module Weather :operation_name, keyword_init: true ) do - # @api private def self.create(context) - # TODO: support more properties new(operation_name: context.operation_name) end end diff --git a/projections/weather/lib/weather/endpoint_parameters.rb b/projections/weather/lib/weather/endpoint_parameters.rb index 9283cf94a..654b0cacc 100644 --- a/projections/weather/lib/weather/endpoint_parameters.rb +++ b/projections/weather/lib/weather/endpoint_parameters.rb @@ -13,7 +13,6 @@ module Weather :endpoint, keyword_init: true ) do - def initialize(options = {}) self.endpoint = options.fetch(:endpoint, nil) end diff --git a/projections/weather/lib/weather/endpoint_provider.rb b/projections/weather/lib/weather/endpoint_provider.rb index 0417f4fa5..5dac5fa9d 100644 --- a/projections/weather/lib/weather/endpoint_provider.rb +++ b/projections/weather/lib/weather/endpoint_provider.rb @@ -13,7 +13,6 @@ def resolve(parameters) return Smithy::Client::EndpointRules::Endpoint.new(uri: parameters.endpoint) end raise ArgumentError, "Endpoint is not set - you must configure an endpoint." - end end end diff --git a/projections/weather/lib/weather/errors.rb b/projections/weather/lib/weather/errors.rb index 3ac1a4a4f..415ed562c 100644 --- a/projections/weather/lib/weather/errors.rb +++ b/projections/weather/lib/weather/errors.rb @@ -34,7 +34,7 @@ class NoSuchResource < Smithy::Client::ServiceError # @param [Smithy::Client::HandlerContext] context # @param [Weather::Types::NoSuchResource] data def initialize(context, data = Smithy::Schema::EmptyStructure.new) - super(context, data) + super end def resource_type diff --git a/projections/weather/lib/weather/paginators.rb b/projections/weather/lib/weather/paginators.rb index 147b309c7..dd4ccc35e 100644 --- a/projections/weather/lib/weather/paginators.rb +++ b/projections/weather/lib/weather/paginators.rb @@ -11,6 +11,7 @@ class GetCity def next_tokens(data) next_token = data.next_token return {} if next_token.nil? || next_token.empty? + tokens = Hash.new { |h, k| h[k] = {} } tokens[:next_token] = next_token tokens @@ -19,6 +20,7 @@ def next_tokens(data) def prev_tokens(params) prev_token = params[:next_token] return {} if prev_token.nil? || prev_token.empty? + tokens = Hash.new { |h, k| h[k] = {} } tokens[:next_token] = prev_token tokens @@ -34,6 +36,7 @@ class GetCurrentTime def next_tokens(data) next_token = data.next_token return {} if next_token.nil? || next_token.empty? + tokens = Hash.new { |h, k| h[k] = {} } tokens[:next_token] = next_token tokens @@ -42,6 +45,7 @@ def next_tokens(data) def prev_tokens(params) prev_token = params[:next_token] return {} if prev_token.nil? || prev_token.empty? + tokens = Hash.new { |h, k| h[k] = {} } tokens[:next_token] = prev_token tokens @@ -57,6 +61,7 @@ class GetForecast def next_tokens(data) next_token = data.next_token return {} if next_token.nil? || next_token.empty? + tokens = Hash.new { |h, k| h[k] = {} } tokens[:next_token] = next_token tokens @@ -65,6 +70,7 @@ def next_tokens(data) def prev_tokens(params) prev_token = params[:next_token] return {} if prev_token.nil? || prev_token.empty? + tokens = Hash.new { |h, k| h[k] = {} } tokens[:next_token] = prev_token tokens @@ -80,6 +86,7 @@ class ListCities def next_tokens(data) next_token = data.next_token return {} if next_token.nil? || next_token.empty? + tokens = Hash.new { |h, k| h[k] = {} } tokens[:next_token] = next_token tokens @@ -88,6 +95,7 @@ def next_tokens(data) def prev_tokens(params) prev_token = params[:next_token] return {} if prev_token.nil? || prev_token.empty? + tokens = Hash.new { |h, k| h[k] = {} } tokens[:next_token] = prev_token tokens diff --git a/projections/weather/lib/weather/plugins/endpoint.rb b/projections/weather/lib/weather/plugins/endpoint.rb index f4b46993d..0ac00b57d 100644 --- a/projections/weather/lib/weather/plugins/endpoint.rb +++ b/projections/weather/lib/weather/plugins/endpoint.rb @@ -9,7 +9,7 @@ class Endpoint < Smithy::Client::Plugin option( :endpoint_provider, doc_type: 'Weather::EndpointProvider', - docstring: <<~DOCS) do |config| + docstring: <<~DOCS) do |_config| The endpoint provider used to resolve endpoints. Any object that responds to `#resolve(parameters)`. DOCS EndpointProvider.new diff --git a/projections/weather/lib/weather/schema.rb b/projections/weather/lib/weather/schema.rb index 76240ca6f..83231b459 100644 --- a/projections/weather/lib/weather/schema.rb +++ b/projections/weather/lib/weather/schema.rb @@ -81,7 +81,6 @@ module Schema operation.traits = {"smithy.api#readonly" => {}} operation[:paginator] = Paginators::ListCities.new end) - end class << self diff --git a/projections/weather/lib/weather/types.rb b/projections/weather/lib/weather/types.rb index 93ccb9171..ff6ec2848 100644 --- a/projections/weather/lib/weather/types.rb +++ b/projections/weather/lib/weather/types.rb @@ -13,7 +13,8 @@ module Types class CityCoordinates < Struct.new( :latitude, :longitude, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure end @@ -24,7 +25,8 @@ class CityCoordinates < Struct.new( class CitySummary < Struct.new( :city_id, :name, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure end @@ -32,7 +34,8 @@ class CitySummary < Struct.new( # @return [String] class GetCityInput < Struct.new( :city_id, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure end @@ -43,7 +46,8 @@ class GetCityInput < Struct.new( class GetCityOutput < Struct.new( :name, :coordinates, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure end @@ -51,7 +55,8 @@ class GetCityOutput < Struct.new( # @return [Time] class GetCurrentTimeOutput < Struct.new( :time, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure end @@ -59,7 +64,8 @@ class GetCurrentTimeOutput < Struct.new( # @return [String] class GetForecastInput < Struct.new( :city_id, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure end @@ -67,7 +73,8 @@ class GetForecastInput < Struct.new( # @return [Float] class GetForecastOutput < Struct.new( :chance_of_rain, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure end @@ -78,7 +85,8 @@ class GetForecastOutput < Struct.new( class ListCitiesInput < Struct.new( :next_token, :page_size, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure end @@ -89,7 +97,8 @@ class ListCitiesInput < Struct.new( class ListCitiesOutput < Struct.new( :next_token, :items, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure end @@ -97,7 +106,8 @@ class ListCitiesOutput < Struct.new( # @return [String] class NoSuchResource < Struct.new( :resource_type, - keyword_init: true) + keyword_init: true + ) include ::Smithy::Schema::Structure end diff --git a/projections/weather/lib/weather/waiters.rb b/projections/weather/lib/weather/waiters.rb index 79f89c5fb..90acb39fc 100644 --- a/projections/weather/lib/weather/waiters.rb +++ b/projections/weather/lib/weather/waiters.rb @@ -35,4 +35,4 @@ def wait(params = {}) end end -end \ No newline at end of file +end diff --git a/projections/weather/weather.gemspec b/projections/weather/weather.gemspec index ef591e1e7..d0c68bd38 100644 --- a/projections/weather/weather.gemspec +++ b/projections/weather/weather.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |spec| spec.name = 'weather' - spec.version = File.read(File.expand_path('../VERSION', __FILE__)) + spec.version = File.read(File.expand_path('VERSION', __dir__)) spec.summary = 'Generated gem using Smithy' spec.authors = ['Smithy Ruby'] spec.files = Dir['VERSION', 'CHANGELOG.md', 'lib/**/*.rb', base: __dir__]