diff --git a/codegen/projections/rails_json/sig/rails_json/config.rbs b/codegen/projections/rails_json/sig/rails_json/config.rbs index 9834a7cb9..ef2d8eaa1 100644 --- a/codegen/projections/rails_json/sig/rails_json/config.rbs +++ b/codegen/projections/rails_json/sig/rails_json/config.rbs @@ -1,21 +1,21 @@ module RailsJson class Config include Hearth::Configuration[instance] - attr_accessor auth_resolver (): Hearth::_AuthResolver[Auth::Params] - attr_accessor auth_schemes (): Array[Hearth::AuthSchemes::Base] - attr_accessor disable_host_prefix (): bool - attr_accessor disable_request_compression (): bool - attr_accessor endpoint (): String - attr_accessor endpoint_resolver (): Hearth::_EndpointResolver[Endpoint::Params] - attr_accessor http_client (): Hearth::HTTP::Client - attr_accessor interceptors (): Hearth::InterceptorList[Config] - attr_accessor logger (): Logger - attr_accessor plugins (): Hearth::PluginList[Config] - attr_accessor request_min_compression_size_bytes (): Integer - attr_accessor retry_strategy (): Hearth::_RetryStrategy - attr_accessor stub_responses (): bool - attr_accessor stubs (): Hearth::Stubs - attr_accessor validate_input (): bool + attr_accessor auth_resolver (): Hearth::_AuthResolver[Auth::Params]? + attr_accessor auth_schemes (): Array[Hearth::AuthSchemes::Base]? + attr_accessor disable_host_prefix (): bool? + attr_accessor disable_request_compression (): bool? + attr_accessor endpoint (): String? + attr_accessor endpoint_resolver (): Hearth::_EndpointResolver[Endpoint::Params]? + attr_accessor http_client (): Hearth::HTTP::Client? + attr_accessor interceptors (): Hearth::InterceptorList[Config]? + attr_accessor logger (): Logger? + attr_accessor plugins (): Hearth::PluginList[Config]? + attr_accessor request_min_compression_size_bytes (): Integer? + attr_accessor retry_strategy (): Hearth::_RetryStrategy? + attr_accessor stub_responses (): bool? + attr_accessor stubs (): Hearth::Stubs? + attr_accessor validate_input (): bool? def validate!: () -> void end diff --git a/codegen/projections/rails_json/sig/rails_json/endpoint.rbs b/codegen/projections/rails_json/sig/rails_json/endpoint.rbs index 1bbe38cb5..5894355ce 100644 --- a/codegen/projections/rails_json/sig/rails_json/endpoint.rbs +++ b/codegen/projections/rails_json/sig/rails_json/endpoint.rbs @@ -11,7 +11,7 @@ module RailsJson module Endpoint class Params def initialize: (?endpoint: ::String?) -> void - attr_accessor endpoint (): ::String + attr_accessor endpoint (): ::String? end class Resolver diff --git a/codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/config.rbs b/codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/config.rbs index 5a85c99c3..9dfd2854c 100644 --- a/codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/config.rbs +++ b/codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/config.rbs @@ -1,19 +1,19 @@ module Rpcv2Cbor class Config include Hearth::Configuration[instance] - attr_accessor auth_resolver (): Hearth::_AuthResolver[Auth::Params] - attr_accessor auth_schemes (): Array[Hearth::AuthSchemes::Base] - attr_accessor disable_host_prefix (): bool - attr_accessor endpoint (): String - attr_accessor endpoint_resolver (): Hearth::_EndpointResolver[Endpoint::Params] - attr_accessor http_client (): Hearth::HTTP::Client - attr_accessor interceptors (): Hearth::InterceptorList[Config] - attr_accessor logger (): Logger - attr_accessor plugins (): Hearth::PluginList[Config] - attr_accessor retry_strategy (): Hearth::_RetryStrategy - attr_accessor stub_responses (): bool - attr_accessor stubs (): Hearth::Stubs - attr_accessor validate_input (): bool + attr_accessor auth_resolver (): Hearth::_AuthResolver[Auth::Params]? + attr_accessor auth_schemes (): Array[Hearth::AuthSchemes::Base]? + attr_accessor disable_host_prefix (): bool? + attr_accessor endpoint (): String? + attr_accessor endpoint_resolver (): Hearth::_EndpointResolver[Endpoint::Params]? + attr_accessor http_client (): Hearth::HTTP::Client? + attr_accessor interceptors (): Hearth::InterceptorList[Config]? + attr_accessor logger (): Logger? + attr_accessor plugins (): Hearth::PluginList[Config]? + attr_accessor retry_strategy (): Hearth::_RetryStrategy? + attr_accessor stub_responses (): bool? + attr_accessor stubs (): Hearth::Stubs? + attr_accessor validate_input (): bool? def validate!: () -> void end diff --git a/codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/endpoint.rbs b/codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/endpoint.rbs index 5ea400521..92e364f37 100644 --- a/codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/endpoint.rbs +++ b/codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/endpoint.rbs @@ -11,7 +11,7 @@ module Rpcv2Cbor module Endpoint class Params def initialize: (?endpoint: ::String?) -> void - attr_accessor endpoint (): ::String + attr_accessor endpoint (): ::String? end class Resolver diff --git a/codegen/projections/white_label/sig/white_label/client.rbs b/codegen/projections/white_label/sig/white_label/client.rbs index e194c8b5e..8a00ec780 100644 --- a/codegen/projections/white_label/sig/white_label/client.rbs +++ b/codegen/projections/white_label/sig/white_label/client.rbs @@ -23,7 +23,7 @@ module WhiteLabel ?http_api_key_provider: Hearth::IdentityProvider, ?http_bearer_provider: Hearth::IdentityProvider, ?http_client: Hearth::HTTP::Client, - ?http_custom_key_provider: untyped, + ?http_custom_key_provider: Hearth::IdentityProvider, ?http_login_provider: Hearth::IdentityProvider, ?interceptors: Hearth::InterceptorList[Config], ?logger: Logger, diff --git a/codegen/projections/white_label/sig/white_label/config.rbs b/codegen/projections/white_label/sig/white_label/config.rbs index 6c81dcf29..aaa1b37c2 100644 --- a/codegen/projections/white_label/sig/white_label/config.rbs +++ b/codegen/projections/white_label/sig/white_label/config.rbs @@ -1,27 +1,27 @@ module WhiteLabel class Config include Hearth::Configuration[instance] - attr_accessor auth_resolver (): Hearth::_AuthResolver[Auth::Params] - attr_accessor auth_schemes (): Array[Hearth::AuthSchemes::Base] - attr_accessor disable_host_prefix (): bool - attr_accessor disable_request_compression (): bool - attr_accessor endpoint (): String - attr_accessor endpoint_resolver (): Hearth::_EndpointResolver[Endpoint::Params] - attr_accessor http_api_key_provider (): Hearth::IdentityProvider - attr_accessor http_bearer_provider (): Hearth::IdentityProvider - attr_accessor http_client (): Hearth::HTTP::Client - attr_accessor http_custom_key_provider (): untyped - attr_accessor http_login_provider (): Hearth::IdentityProvider - attr_accessor interceptors (): Hearth::InterceptorList[Config] - attr_accessor logger (): Logger - attr_accessor plugins (): Hearth::PluginList[Config] - attr_accessor request_min_compression_size_bytes (): Integer - attr_accessor retry_strategy (): Hearth::_RetryStrategy - attr_accessor stage (): String - attr_accessor stub_responses (): bool - attr_accessor stubs (): Hearth::Stubs - attr_accessor test_config (): untyped - attr_accessor validate_input (): bool + attr_accessor auth_resolver (): Hearth::_AuthResolver[Auth::Params]? + attr_accessor auth_schemes (): Array[Hearth::AuthSchemes::Base]? + attr_accessor disable_host_prefix (): bool? + attr_accessor disable_request_compression (): bool? + attr_accessor endpoint (): String? + attr_accessor endpoint_resolver (): Hearth::_EndpointResolver[Endpoint::Params]? + attr_accessor http_api_key_provider (): Hearth::IdentityProvider? + attr_accessor http_bearer_provider (): Hearth::IdentityProvider? + attr_accessor http_client (): Hearth::HTTP::Client? + attr_accessor http_custom_key_provider (): Hearth::IdentityProvider? + attr_accessor http_login_provider (): Hearth::IdentityProvider? + attr_accessor interceptors (): Hearth::InterceptorList[Config]? + attr_accessor logger (): Logger? + attr_accessor plugins (): Hearth::PluginList[Config]? + attr_accessor request_min_compression_size_bytes (): Integer? + attr_accessor retry_strategy (): Hearth::_RetryStrategy? + attr_accessor stage (): String? + attr_accessor stub_responses (): bool? + attr_accessor stubs (): Hearth::Stubs? + attr_accessor test_config (): untyped? + attr_accessor validate_input (): bool? def validate!: () -> void end diff --git a/codegen/projections/white_label/sig/white_label/endpoint.rbs b/codegen/projections/white_label/sig/white_label/endpoint.rbs index 6d212a855..52035906a 100644 --- a/codegen/projections/white_label/sig/white_label/endpoint.rbs +++ b/codegen/projections/white_label/sig/white_label/endpoint.rbs @@ -11,10 +11,10 @@ module WhiteLabel module Endpoint class Params def initialize: (?dataplane: bool?, ?resource_url: ::String?, ?endpoint: ::String?, ?stage: ::String?) -> void - attr_accessor dataplane (): bool - attr_accessor resource_url (): ::String - attr_accessor endpoint (): ::String - attr_accessor stage (): ::String + attr_accessor dataplane (): bool? + attr_accessor resource_url (): ::String? + attr_accessor endpoint (): ::String? + attr_accessor stage (): ::String? end class Resolver diff --git a/codegen/projections/white_label/spec/auth_spec.rb b/codegen/projections/white_label/spec/auth_spec.rb index 35f767b89..2996539e8 100644 --- a/codegen/projections/white_label/spec/auth_spec.rb +++ b/codegen/projections/white_label/spec/auth_spec.rb @@ -158,7 +158,7 @@ module Auth end describe Config do - it 'validates identity resolvers' do + it 'validates identity resolvers', rbs_test: :skip do msg = /to be in \[Hearth::IdentityProvider\], got String/ expect do Config.new(http_api_key_provider: 'foo').validate! diff --git a/codegen/projections/white_label/spec/client_spec.rb b/codegen/projections/white_label/spec/client_spec.rb index 2b27755c6..fa0316de2 100644 --- a/codegen/projections/white_label/spec/client_spec.rb +++ b/codegen/projections/white_label/spec/client_spec.rb @@ -19,7 +19,7 @@ module WhiteLabel client.kitchen_sink end - it 'validates config' do + it 'validates config', rbs_test: :skip do expect do Client.new(stub_responses: 'false') end.to raise_error(ArgumentError, /config\[:stub_responses\]/) @@ -34,7 +34,7 @@ module WhiteLabel expect(client.config.logger).to eq(logger) end - it 'validates global config values' do + it 'validates global config values', rbs_test: :skip do Hearth.config[:logger] = 'logger' expect do Client.new @@ -50,7 +50,7 @@ module WhiteLabel end context 'operation overrides' do - it 'validates config' do + it 'validates config', rbs_test: :skip do expect do client.kitchen_sink({}, endpoint: 1) end.to raise_error(ArgumentError, /config\[:endpoint\]/) diff --git a/codegen/projections/white_label/spec/compression_spec.rb b/codegen/projections/white_label/spec/compression_spec.rb index 163e27ae6..60345383b 100644 --- a/codegen/projections/white_label/spec/compression_spec.rb +++ b/codegen/projections/white_label/spec/compression_spec.rb @@ -5,7 +5,7 @@ module WhiteLabel describe Config do context 'disable_request_compression' do - it 'raises error when given an invalid input' do + it 'raises when given an invalid input', rbs_test: :skip do expect { Config.new(disable_request_compression: 'string').validate! } .to raise_error( ArgumentError, @@ -16,7 +16,7 @@ module WhiteLabel end context 'request_min_compression_size_bytes' do - it 'raises error when given invalid integer' do + it 'raises when given invalid integer' do expect { Config.new(request_min_compression_size_bytes: -1).validate! } .to raise_error( ArgumentError, diff --git a/codegen/projections/white_label/spec/config_spec.rb b/codegen/projections/white_label/spec/config_spec.rb index ce2b1aaf4..a4a5497ec 100644 --- a/codegen/projections/white_label/spec/config_spec.rb +++ b/codegen/projections/white_label/spec/config_spec.rb @@ -31,7 +31,7 @@ module WhiteLabel expect(config.request_min_compression_size_bytes).to be_a(Integer) end - it 'validates types' do + it 'validates types', rbs_test: :skip do config = Config.new(logger: 'foo') expect { config.validate! } .to raise_error(ArgumentError, /config\[:logger\]/) diff --git a/codegen/smithy-ruby-codegen-test-utils/src/main/java/software/amazon/smithy/ruby/codegen/integrations/WhiteLabelTestIntegration.java b/codegen/smithy-ruby-codegen-test-utils/src/main/java/software/amazon/smithy/ruby/codegen/integrations/WhiteLabelTestIntegration.java index f955344ac..e159863ad 100644 --- a/codegen/smithy-ruby-codegen-test-utils/src/main/java/software/amazon/smithy/ruby/codegen/integrations/WhiteLabelTestIntegration.java +++ b/codegen/smithy-ruby-codegen-test-utils/src/main/java/software/amazon/smithy/ruby/codegen/integrations/WhiteLabelTestIntegration.java @@ -117,6 +117,7 @@ public List getAdditionalAuthSchemes(GenerationContext context) { identityType, HttpBasicAuthTrait.ID)) .documentationType(Hearth.IDENTITY_PROVIDER.toString()) + .rbsType(Hearth.IDENTITY_PROVIDER.toString()) .defaultDynamicValue(defaultConfigValue) .constraint(new TypeConstraint(Hearth.IDENTITY_PROVIDER.toString())) .build(); diff --git a/codegen/smithy-ruby-codegen-test/integration-specs/auth_spec.rb b/codegen/smithy-ruby-codegen-test/integration-specs/auth_spec.rb index 35f767b89..2996539e8 100644 --- a/codegen/smithy-ruby-codegen-test/integration-specs/auth_spec.rb +++ b/codegen/smithy-ruby-codegen-test/integration-specs/auth_spec.rb @@ -158,7 +158,7 @@ module Auth end describe Config do - it 'validates identity resolvers' do + it 'validates identity resolvers', rbs_test: :skip do msg = /to be in \[Hearth::IdentityProvider\], got String/ expect do Config.new(http_api_key_provider: 'foo').validate! diff --git a/codegen/smithy-ruby-codegen-test/integration-specs/client_spec.rb b/codegen/smithy-ruby-codegen-test/integration-specs/client_spec.rb index 2b27755c6..fa0316de2 100644 --- a/codegen/smithy-ruby-codegen-test/integration-specs/client_spec.rb +++ b/codegen/smithy-ruby-codegen-test/integration-specs/client_spec.rb @@ -19,7 +19,7 @@ module WhiteLabel client.kitchen_sink end - it 'validates config' do + it 'validates config', rbs_test: :skip do expect do Client.new(stub_responses: 'false') end.to raise_error(ArgumentError, /config\[:stub_responses\]/) @@ -34,7 +34,7 @@ module WhiteLabel expect(client.config.logger).to eq(logger) end - it 'validates global config values' do + it 'validates global config values', rbs_test: :skip do Hearth.config[:logger] = 'logger' expect do Client.new @@ -50,7 +50,7 @@ module WhiteLabel end context 'operation overrides' do - it 'validates config' do + it 'validates config', rbs_test: :skip do expect do client.kitchen_sink({}, endpoint: 1) end.to raise_error(ArgumentError, /config\[:endpoint\]/) diff --git a/codegen/smithy-ruby-codegen-test/integration-specs/compression_spec.rb b/codegen/smithy-ruby-codegen-test/integration-specs/compression_spec.rb index 163e27ae6..60345383b 100644 --- a/codegen/smithy-ruby-codegen-test/integration-specs/compression_spec.rb +++ b/codegen/smithy-ruby-codegen-test/integration-specs/compression_spec.rb @@ -5,7 +5,7 @@ module WhiteLabel describe Config do context 'disable_request_compression' do - it 'raises error when given an invalid input' do + it 'raises when given an invalid input', rbs_test: :skip do expect { Config.new(disable_request_compression: 'string').validate! } .to raise_error( ArgumentError, @@ -16,7 +16,7 @@ module WhiteLabel end context 'request_min_compression_size_bytes' do - it 'raises error when given invalid integer' do + it 'raises when given invalid integer' do expect { Config.new(request_min_compression_size_bytes: -1).validate! } .to raise_error( ArgumentError, diff --git a/codegen/smithy-ruby-codegen-test/integration-specs/config_spec.rb b/codegen/smithy-ruby-codegen-test/integration-specs/config_spec.rb index ce2b1aaf4..a4a5497ec 100644 --- a/codegen/smithy-ruby-codegen-test/integration-specs/config_spec.rb +++ b/codegen/smithy-ruby-codegen-test/integration-specs/config_spec.rb @@ -31,7 +31,7 @@ module WhiteLabel expect(config.request_min_compression_size_bytes).to be_a(Integer) end - it 'validates types' do + it 'validates types', rbs_test: :skip do config = Config.new(logger: 'foo') expect { config.validate! } .to raise_error(ArgumentError, /config\[:logger\]/) diff --git a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/ConfigGenerator.java b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/ConfigGenerator.java index 1940538f7..85d6c9cfa 100644 --- a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/ConfigGenerator.java +++ b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/ConfigGenerator.java @@ -103,7 +103,7 @@ public void renderRbs() { clientConfigList.forEach((clientConfig) -> { String member = RubySymbolProvider.toMemberName(clientConfig.getName()); String rbsType = clientConfig.getRbsType(); - writer.write("attr_accessor $L (): $L", member, rbsType); + writer.write("attr_accessor $L (): $L?", member, rbsType); }); }) .write("") diff --git a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/EndpointGenerator.java b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/EndpointGenerator.java index 9344c12cf..8cd08a7a4 100644 --- a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/EndpointGenerator.java +++ b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/EndpointGenerator.java @@ -296,7 +296,7 @@ private void renderRbsEndpointParamsClass(RubyCodeWriter writer) { .collect(Collectors.joining(", "))) .call(() -> { paramsToTypes.forEach((param, rbsType) -> { - writer.write("attr_accessor $L (): $L", param, rbsType); + writer.write("attr_accessor $L (): $L?", param, rbsType); }); }) .closeBlock("end");