Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion gems/smithy/lib/smithy/generators/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion gems/smithy/lib/smithy/generators/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions gems/smithy/lib/smithy/templates/client/auth_parameters.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gems/smithy/lib/smithy/templates/client/errors.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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| -%>

Expand Down
2 changes: 1 addition & 1 deletion gems/smithy/lib/smithy/templates/client/gemspec.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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__]
Expand Down
2 changes: 1 addition & 1 deletion gems/smithy/lib/smithy/templates/client/module.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>')
Expand Down
33 changes: 0 additions & 33 deletions gems/smithy/lib/smithy/templates/client/rubocop_yml.erb

This file was deleted.

1 change: 0 additions & 1 deletion gems/smithy/lib/smithy/templates/client/schema.erb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ module <%= module_name %>
<% end -%>
end)
<% end -%>

end

class << self
Expand Down
6 changes: 4 additions & 2 deletions gems/smithy/lib/smithy/templates/client/types.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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? -%>

Expand All @@ -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| -%>
Expand Down
2 changes: 1 addition & 1 deletion gems/smithy/lib/smithy/templates/client/waiters.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ module <%= module_name %>

<% end -%>
end
end
end
1 change: 0 additions & 1 deletion gems/smithy/lib/smithy/views/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 5 additions & 5 deletions gems/smithy/lib/smithy/views/client/endpoint_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion gems/smithy/lib/smithy/views/client/gemspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions gems/smithy/lib/smithy/views/client/paginators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
19 changes: 0 additions & 19 deletions gems/smithy/lib/smithy/views/client/rubocop_yml.rb

This file was deleted.

3 changes: 0 additions & 3 deletions gems/smithy/lib/smithy/welds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 0 additions & 33 deletions gems/smithy/lib/smithy/welds/rubocop.rb

This file was deleted.

4 changes: 2 additions & 2 deletions gems/smithy/spec/support/examples/gemspec_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
33 changes: 0 additions & 33 deletions projections/shapes/.rubocop.yml

This file was deleted.

1 change: 0 additions & 1 deletion projections/shapes/lib/shapes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require 'smithy-client'


Object.const_set('ShapeService', Module.new) unless Object.const_defined?('ShapeService')

module ShapeService
Expand Down
2 changes: 0 additions & 2 deletions projections/shapes/lib/shapes/auth_parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion projections/shapes/lib/shapes/endpoint_parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module ShapeService
:endpoint,
keyword_init: true
) do

def initialize(options = {})
self.endpoint = options.fetch(:endpoint, nil)
end
Expand Down
1 change: 0 additions & 1 deletion projections/shapes/lib/shapes/endpoint_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion projections/shapes/lib/shapes/plugins/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion projections/shapes/lib/shapes/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading