From bd9ee1fad769535bfb0a0a754a3bcd2e3affb046 Mon Sep 17 00:00:00 2001 From: Matt Muller Date: Fri, 12 Jul 2024 21:30:31 -0400 Subject: [PATCH] Some RBS fixes --- .../rails_json/lib/rails_json/client.rb | 36 ++--- .../rails_json/lib/rails_json/types.rb | 144 +++++++++--------- .../rails_json/sig/rails_json/types.rbs | 82 +++++----- .../rpcv2_cbor/lib/rpcv2_cbor/client.rb | 24 +-- .../rpcv2_cbor/lib/rpcv2_cbor/types.rb | 96 ++++++------ .../rpcv2_cbor/sig/rpcv2_cbor/types.rbs | 48 +++--- .../white_label/lib/white_label/client.rb | 6 +- .../white_label/lib/white_label/types.rb | 24 +-- .../white_label/sig/white_label/types.rbs | 20 +-- .../white_label/spec/params_spec.rb | 2 +- .../white_label/spec/streaming_spec.rb | 8 +- .../white_label/spec/types_spec.rb | 15 +- .../white_label/spec/validators_spec.rb | 13 +- .../integration-specs/params_spec.rb | 2 +- .../integration-specs/streaming_spec.rb | 8 +- .../integration-specs/types_spec.rb | 15 +- .../integration-specs/validators_spec.rb | 13 +- .../ruby/codegen/RubySymbolProvider.java | 8 +- .../generators/types/StructureGenerator.java | 18 ++- 19 files changed, 286 insertions(+), 296 deletions(-) diff --git a/codegen/projections/rails_json/lib/rails_json/client.rb b/codegen/projections/rails_json/lib/rails_json/client.rb index fc9e58c83..bb08a6863 100644 --- a/codegen/projections/rails_json/lib/rails_json/client.rb +++ b/codegen/projections/rails_json/lib/rails_json/client.rb @@ -279,7 +279,7 @@ def document_type(params = {}, options = {}) # ) # @example Response structure # resp.data #=> Types::DocumentTypeAsMapValueOutput - # resp.data.doc_valued_map #=> Hash + # resp.data.doc_valued_map #=> Hash # resp.data.doc_valued_map['key'] #=> Hash, Array, String, Boolean, Numeric def document_type_as_map_value(params = {}, options = {}) response_body = ::StringIO.new @@ -809,7 +809,7 @@ def http_payload_with_union(params = {}, options = {}) # @example Response structure # resp.data #=> Types::HttpPrefixHeadersOutput # resp.data.foo #=> String - # resp.data.foo_map #=> Hash + # resp.data.foo_map #=> Hash # resp.data.foo_map['key'] #=> String def http_prefix_headers(params = {}, options = {}) response_body = ::StringIO.new @@ -844,7 +844,7 @@ def http_prefix_headers(params = {}, options = {}) # resp = client.http_prefix_headers_in_response() # @example Response structure # resp.data #=> Types::HttpPrefixHeadersInResponseOutput - # resp.data.prefix_headers #=> Hash + # resp.data.prefix_headers #=> Hash # resp.data.prefix_headers['key'] #=> String def http_prefix_headers_in_response(params = {}, options = {}) response_body = ::StringIO.new @@ -1320,7 +1320,7 @@ def json_blobs(params = {}, options = {}) # resp.data.foo_enum_list[0] #=> String, one of ["Foo", "Baz", "Bar", "1", "0"] # resp.data.foo_enum_set #=> Array # resp.data.foo_enum_set[0] #=> String, one of ["Foo", "Baz", "Bar", "1", "0"] - # resp.data.foo_enum_map #=> Hash + # resp.data.foo_enum_map #=> Hash # resp.data.foo_enum_map['key'] #=> String, one of ["Foo", "Baz", "Bar", "1", "0"] def json_enums(params = {}, options = {}) response_body = ::StringIO.new @@ -1375,7 +1375,7 @@ def json_enums(params = {}, options = {}) # resp.data.integer_enum_list[0] #=> Integer # resp.data.integer_enum_set #=> Array # resp.data.integer_enum_set[0] #=> Integer - # resp.data.integer_enum_map #=> Hash + # resp.data.integer_enum_map #=> Hash # resp.data.integer_enum_map['key'] #=> Integer def json_int_enums(params = {}, options = {}) response_body = ::StringIO.new @@ -1516,16 +1516,16 @@ def json_lists(params = {}, options = {}) # ) # @example Response structure # resp.data #=> Types::JsonMapsOutput - # resp.data.dense_struct_map #=> Hash + # resp.data.dense_struct_map #=> Hash # resp.data.dense_struct_map['key'] #=> Types::GreetingStruct # resp.data.dense_struct_map['key'].hi #=> String - # resp.data.dense_number_map #=> Hash + # resp.data.dense_number_map #=> Hash # resp.data.dense_number_map['key'] #=> Integer - # resp.data.dense_boolean_map #=> Hash + # resp.data.dense_boolean_map #=> Hash # resp.data.dense_boolean_map['key'] #=> Boolean - # resp.data.dense_string_map #=> Hash + # resp.data.dense_string_map #=> Hash # resp.data.dense_string_map['key'] #=> String - # resp.data.dense_set_map #=> Hash> + # resp.data.dense_set_map #=> Hash> # resp.data.dense_set_map['key'] #=> Array # resp.data.dense_set_map['key'][0] #=> String def json_maps(params = {}, options = {}) @@ -1642,7 +1642,7 @@ def json_timestamps(params = {}, options = {}) # resp.data.contents.enum_value #=> String, one of ["Foo", "Baz", "Bar", "1", "0"] # resp.data.contents.list_value #=> Array # resp.data.contents.list_value[0] #=> String - # resp.data.contents.map_value #=> Hash + # resp.data.contents.map_value #=> Hash # resp.data.contents.map_value['key'] #=> String # resp.data.contents.structure_value #=> Types::GreetingStruct # resp.data.contents.structure_value.hi #=> String @@ -2029,7 +2029,7 @@ def omits_serializing_empty_lists(params = {}, options = {}) # resp.data.default_long #=> Integer # resp.data.default_float #=> Float # resp.data.default_double #=> Float - # resp.data.default_map #=> Hash + # resp.data.default_map #=> Hash # resp.data.default_map['key'] #=> String # resp.data.default_enum #=> String, one of ["FOO", "BAR", "BAZ"] # resp.data.default_int_enum #=> Integer @@ -2090,7 +2090,7 @@ def operation_with_defaults(params = {}, options = {}) # resp.data.dialog.farewell #=> Types::Farewell # resp.data.dialog.farewell.phrase #=> String # resp.data.dialog_list #=> Array - # resp.data.dialog_map #=> Hash + # resp.data.dialog_map #=> Hash def operation_with_nested_structure(params = {}, options = {}) response_body = ::StringIO.new config = operation_config(options) @@ -2511,16 +2511,16 @@ def sparse_json_lists(params = {}, options = {}) # ) # @example Response structure # resp.data #=> Types::SparseJsonMapsOutput - # resp.data.sparse_struct_map #=> Hash + # resp.data.sparse_struct_map #=> Hash # resp.data.sparse_struct_map['key'] #=> Types::GreetingStruct # resp.data.sparse_struct_map['key'].hi #=> String - # resp.data.sparse_number_map #=> Hash + # resp.data.sparse_number_map #=> Hash # resp.data.sparse_number_map['key'] #=> Integer - # resp.data.sparse_boolean_map #=> Hash + # resp.data.sparse_boolean_map #=> Hash # resp.data.sparse_boolean_map['key'] #=> Boolean - # resp.data.sparse_string_map #=> Hash + # resp.data.sparse_string_map #=> Hash # resp.data.sparse_string_map['key'] #=> String - # resp.data.sparse_set_map #=> Hash> + # resp.data.sparse_set_map #=> Hash> # resp.data.sparse_set_map['key'] #=> Array # resp.data.sparse_set_map['key'][0] #=> String def sparse_json_maps(params = {}, options = {}) diff --git a/codegen/projections/rails_json/lib/rails_json/types.rb b/codegen/projections/rails_json/lib/rails_json/types.rb index ae5fd219b..dcac8bba9 100644 --- a/codegen/projections/rails_json/lib/rails_json/types.rb +++ b/codegen/projections/rails_json/lib/rails_json/types.rb @@ -32,7 +32,7 @@ module Types # @option params [Array] :query_enum_list # @option params [Integer] :query_integer_enum # @option params [Array] :query_integer_enum_list - # @option params [Hash>] :query_params_map_of_string_list + # @option params [Hash>] :query_params_map_of_string_list # @!attribute query_string # @return [String] # @!attribute query_string_list @@ -75,7 +75,7 @@ module Types # @!attribute query_integer_enum_list # @return [Array] # @!attribute query_params_map_of_string_list - # @return [Hash>] + # @return [Hash>] class AllQueryStringTypesInput include Hearth::Structure @@ -267,7 +267,7 @@ class DatetimeOffsetsOutput # @option params [Integer] :default_long # @option params [Float] :default_float # @option params [Float] :default_double - # @option params [Hash] :default_map + # @option params [Hash] :default_map # @option params [String] :default_enum # @option params [Integer] :default_int_enum # @option params [String] :empty_string @@ -312,7 +312,7 @@ class DatetimeOffsetsOutput # @!attribute default_double # @return [Float] # @!attribute default_map - # @return [Hash] + # @return [Hash] # @!attribute default_enum # Enum, one of: ["FOO", "BAR", "BAZ"] # @return [String] @@ -440,9 +440,9 @@ def _defaults # @!method initialize(params = {}) # @param [Hash] params - # @option params [Hash] :doc_valued_map + # @option params [Hash] :doc_valued_map # @!attribute doc_valued_map - # @return [Hash] + # @return [Hash] class DocumentTypeAsMapValueInput include Hearth::Structure @@ -455,9 +455,9 @@ class DocumentTypeAsMapValueInput # @!method initialize(params = {}) # @param [Hash] params - # @option params [Hash] :doc_valued_map + # @option params [Hash] :doc_valued_map # @!attribute doc_valued_map - # @return [Hash] + # @return [Hash] class DocumentTypeAsMapValueOutput include Hearth::Structure @@ -932,9 +932,9 @@ class HttpPrefixHeadersInResponseInput # @!method initialize(params = {}) # @param [Hash] params - # @option params [Hash] :prefix_headers + # @option params [Hash] :prefix_headers # @!attribute prefix_headers - # @return [Hash] + # @return [Hash] class HttpPrefixHeadersInResponseOutput include Hearth::Structure @@ -948,11 +948,11 @@ class HttpPrefixHeadersInResponseOutput # @!method initialize(params = {}) # @param [Hash] params # @option params [String] :foo - # @option params [Hash] :foo_map + # @option params [Hash] :foo_map # @!attribute foo # @return [String] # @!attribute foo_map - # @return [Hash] + # @return [Hash] class HttpPrefixHeadersInput include Hearth::Structure @@ -967,11 +967,11 @@ class HttpPrefixHeadersInput # @!method initialize(params = {}) # @param [Hash] params # @option params [String] :foo - # @option params [Hash] :foo_map + # @option params [Hash] :foo_map # @!attribute foo # @return [String] # @!attribute foo_map - # @return [Hash] + # @return [Hash] class HttpPrefixHeadersOutput include Hearth::Structure @@ -1480,7 +1480,7 @@ class JsonBlobsOutput # @option params [String] :foo_enum3 # @option params [Array] :foo_enum_list # @option params [Array] :foo_enum_set - # @option params [Hash] :foo_enum_map + # @option params [Hash] :foo_enum_map # @!attribute foo_enum1 # Enum, one of: ["Foo", "Baz", "Bar", "1", "0"] # @return [String] @@ -1495,7 +1495,7 @@ class JsonBlobsOutput # @!attribute foo_enum_set # @return [Array] # @!attribute foo_enum_map - # @return [Hash] + # @return [Hash] class JsonEnumsInput include Hearth::Structure @@ -1518,7 +1518,7 @@ class JsonEnumsInput # @option params [String] :foo_enum3 # @option params [Array] :foo_enum_list # @option params [Array] :foo_enum_set - # @option params [Hash] :foo_enum_map + # @option params [Hash] :foo_enum_map # @!attribute foo_enum1 # Enum, one of: ["Foo", "Baz", "Bar", "1", "0"] # @return [String] @@ -1533,7 +1533,7 @@ class JsonEnumsInput # @!attribute foo_enum_set # @return [Array] # @!attribute foo_enum_map - # @return [Hash] + # @return [Hash] class JsonEnumsOutput include Hearth::Structure @@ -1556,7 +1556,7 @@ class JsonEnumsOutput # @option params [Integer] :integer_enum3 # @option params [Array] :integer_enum_list # @option params [Array] :integer_enum_set - # @option params [Hash] :integer_enum_map + # @option params [Hash] :integer_enum_map # @!attribute integer_enum1 # @return [Integer] # @!attribute integer_enum2 @@ -1568,7 +1568,7 @@ class JsonEnumsOutput # @!attribute integer_enum_set # @return [Array] # @!attribute integer_enum_map - # @return [Hash] + # @return [Hash] class JsonIntEnumsInput include Hearth::Structure @@ -1591,7 +1591,7 @@ class JsonIntEnumsInput # @option params [Integer] :integer_enum3 # @option params [Array] :integer_enum_list # @option params [Array] :integer_enum_set - # @option params [Hash] :integer_enum_map + # @option params [Hash] :integer_enum_map # @!attribute integer_enum1 # @return [Integer] # @!attribute integer_enum2 @@ -1603,7 +1603,7 @@ class JsonIntEnumsInput # @!attribute integer_enum_set # @return [Array] # @!attribute integer_enum_map - # @return [Hash] + # @return [Hash] class JsonIntEnumsOutput include Hearth::Structure @@ -1717,21 +1717,21 @@ class JsonListsOutput # @!method initialize(params = {}) # @param [Hash] params - # @option params [Hash] :dense_struct_map - # @option params [Hash] :dense_number_map - # @option params [Hash] :dense_boolean_map - # @option params [Hash] :dense_string_map - # @option params [Hash>] :dense_set_map + # @option params [Hash] :dense_struct_map + # @option params [Hash] :dense_number_map + # @option params [Hash] :dense_boolean_map + # @option params [Hash] :dense_string_map + # @option params [Hash>] :dense_set_map # @!attribute dense_struct_map - # @return [Hash] + # @return [Hash] # @!attribute dense_number_map - # @return [Hash] + # @return [Hash] # @!attribute dense_boolean_map - # @return [Hash] + # @return [Hash] # @!attribute dense_string_map - # @return [Hash] + # @return [Hash] # @!attribute dense_set_map - # @return [Hash>] + # @return [Hash>] class JsonMapsInput include Hearth::Structure @@ -1748,21 +1748,21 @@ class JsonMapsInput # @!method initialize(params = {}) # @param [Hash] params - # @option params [Hash] :dense_struct_map - # @option params [Hash] :dense_number_map - # @option params [Hash] :dense_boolean_map - # @option params [Hash] :dense_string_map - # @option params [Hash>] :dense_set_map + # @option params [Hash] :dense_struct_map + # @option params [Hash] :dense_number_map + # @option params [Hash] :dense_boolean_map + # @option params [Hash] :dense_string_map + # @option params [Hash>] :dense_set_map # @!attribute dense_struct_map - # @return [Hash] + # @return [Hash] # @!attribute dense_number_map - # @return [Hash] + # @return [Hash] # @!attribute dense_boolean_map - # @return [Hash] + # @return [Hash] # @!attribute dense_string_map - # @return [Hash] + # @return [Hash] # @!attribute dense_set_map - # @return [Hash>] + # @return [Hash>] class JsonMapsOutput include Hearth::Structure @@ -2311,7 +2311,7 @@ class OperationWithDefaultsInput # @option params [Integer] :default_long # @option params [Float] :default_float # @option params [Float] :default_double - # @option params [Hash] :default_map + # @option params [Hash] :default_map # @option params [String] :default_enum # @option params [Integer] :default_int_enum # @option params [String] :empty_string @@ -2356,7 +2356,7 @@ class OperationWithDefaultsInput # @!attribute default_double # @return [Float] # @!attribute default_map - # @return [Hash] + # @return [Hash] # @!attribute default_enum # Enum, one of: ["FOO", "BAR", "BAZ"] # @return [String] @@ -2470,13 +2470,13 @@ class OperationWithNestedStructureInput # @param [Hash] params # @option params [Dialog] :dialog # @option params [Array] :dialog_list - # @option params [Hash] :dialog_map + # @option params [Hash] :dialog_map # @!attribute dialog # @return [Dialog] # @!attribute dialog_list # @return [Array] # @!attribute dialog_map - # @return [Hash] + # @return [Hash] class OperationWithNestedStructureOutput include Hearth::Structure @@ -2657,11 +2657,11 @@ class QueryIdempotencyTokenAutoFillOutput # @!method initialize(params = {}) # @param [Hash] params # @option params [String] :qux - # @option params [Hash>] :foo + # @option params [Hash>] :foo # @!attribute qux # @return [String] # @!attribute foo - # @return [Hash>] + # @return [Hash>] class QueryParamsAsStringListMapInput include Hearth::Structure @@ -2686,11 +2686,11 @@ class QueryParamsAsStringListMapOutput # @!method initialize(params = {}) # @param [Hash] params # @option params [String] :foo - # @option params [Hash] :baz + # @option params [Hash] :baz # @!attribute foo # @return [String] # @!attribute baz - # @return [Hash] + # @return [Hash] class QueryPrecedenceInput include Hearth::Structure @@ -2929,21 +2929,21 @@ class SparseJsonListsOutput # @!method initialize(params = {}) # @param [Hash] params - # @option params [Hash] :sparse_struct_map - # @option params [Hash] :sparse_number_map - # @option params [Hash] :sparse_boolean_map - # @option params [Hash] :sparse_string_map - # @option params [Hash>] :sparse_set_map + # @option params [Hash] :sparse_struct_map + # @option params [Hash] :sparse_number_map + # @option params [Hash] :sparse_boolean_map + # @option params [Hash] :sparse_string_map + # @option params [Hash>] :sparse_set_map # @!attribute sparse_struct_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_number_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_boolean_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_string_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_set_map - # @return [Hash>] + # @return [Hash>] class SparseJsonMapsInput include Hearth::Structure @@ -2960,21 +2960,21 @@ class SparseJsonMapsInput # @!method initialize(params = {}) # @param [Hash] params - # @option params [Hash] :sparse_struct_map - # @option params [Hash] :sparse_number_map - # @option params [Hash] :sparse_boolean_map - # @option params [Hash] :sparse_string_map - # @option params [Hash>] :sparse_set_map + # @option params [Hash] :sparse_struct_map + # @option params [Hash] :sparse_number_map + # @option params [Hash] :sparse_boolean_map + # @option params [Hash] :sparse_string_map + # @option params [Hash>] :sparse_set_map # @!attribute sparse_struct_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_number_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_boolean_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_string_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_set_map - # @return [Hash>] + # @return [Hash>] class SparseJsonMapsOutput include Hearth::Structure @@ -3391,13 +3391,13 @@ class TimestampFormatHeadersOutput # @param [Hash] params # @option params [Dialog] :dialog # @option params [Array] :dialog_list - # @option params [Hash] :dialog_map + # @option params [Hash] :dialog_map # @!attribute dialog # @return [Dialog] # @!attribute dialog_list # @return [Array] # @!attribute dialog_map - # @return [Hash] + # @return [Hash] class TopLevel include Hearth::Structure diff --git a/codegen/projections/rails_json/sig/rails_json/types.rbs b/codegen/projections/rails_json/sig/rails_json/types.rbs index e74f2e69b..8fbcb28e4 100644 --- a/codegen/projections/rails_json/sig/rails_json/types.rbs +++ b/codegen/projections/rails_json/sig/rails_json/types.rbs @@ -32,7 +32,7 @@ module RailsJson attr_accessor query_enum_list (): ::Array[::String]? attr_accessor query_integer_enum (): ::Integer? attr_accessor query_integer_enum_list (): ::Array[::Integer]? - attr_accessor query_params_map_of_string_list (): ::Hash[::String, ::Array[::String]]? + attr_accessor query_params_map_of_string_list (): ::Hash[Symbol, ::Array[::String]]? end class AllQueryStringTypesOutput @@ -102,7 +102,7 @@ module RailsJson attr_accessor default_long (): ::Integer? attr_accessor default_float (): ::Float? attr_accessor default_double (): ::Float? - attr_accessor default_map (): ::Hash[::String, ::String]? + attr_accessor default_map (): ::Hash[Symbol, ::String]? attr_accessor default_enum (): ::String? attr_accessor default_int_enum (): ::Integer? attr_accessor empty_string (): ::String? @@ -125,12 +125,12 @@ module RailsJson class DocumentTypeAsMapValueInput include Hearth::Structure - attr_accessor doc_valued_map (): ::Hash[::String, Hearth::document]? + attr_accessor doc_valued_map (): ::Hash[Symbol, Hearth::document]? end class DocumentTypeAsMapValueOutput include Hearth::Structure - attr_accessor doc_valued_map (): ::Hash[::String, Hearth::document]? + attr_accessor doc_valued_map (): ::Hash[Symbol, Hearth::document]? end class DocumentTypeAsPayloadInput @@ -298,19 +298,19 @@ module RailsJson class HttpPrefixHeadersInResponseOutput include Hearth::Structure - attr_accessor prefix_headers (): ::Hash[::String, ::String]? + attr_accessor prefix_headers (): ::Hash[Symbol, ::String]? end class HttpPrefixHeadersInput include Hearth::Structure attr_accessor foo (): ::String? - attr_accessor foo_map (): ::Hash[::String, ::String]? + attr_accessor foo_map (): ::Hash[Symbol, ::String]? end class HttpPrefixHeadersOutput include Hearth::Structure attr_accessor foo (): ::String? - attr_accessor foo_map (): ::Hash[::String, ::String]? + attr_accessor foo_map (): ::Hash[Symbol, ::String]? end class HttpRequestWithFloatLabelsInput @@ -475,7 +475,7 @@ module RailsJson attr_accessor foo_enum3 (): ::String? attr_accessor foo_enum_list (): ::Array[::String]? attr_accessor foo_enum_set (): ::Array[::String]? - attr_accessor foo_enum_map (): ::Hash[::String, ::String]? + attr_accessor foo_enum_map (): ::Hash[Symbol, ::String]? end class JsonEnumsOutput @@ -485,7 +485,7 @@ module RailsJson attr_accessor foo_enum3 (): ::String? attr_accessor foo_enum_list (): ::Array[::String]? attr_accessor foo_enum_set (): ::Array[::String]? - attr_accessor foo_enum_map (): ::Hash[::String, ::String]? + attr_accessor foo_enum_map (): ::Hash[Symbol, ::String]? end class JsonIntEnumsInput @@ -495,7 +495,7 @@ module RailsJson attr_accessor integer_enum3 (): ::Integer? attr_accessor integer_enum_list (): ::Array[::Integer]? attr_accessor integer_enum_set (): ::Array[::Integer]? - attr_accessor integer_enum_map (): ::Hash[::String, ::Integer]? + attr_accessor integer_enum_map (): ::Hash[Symbol, ::Integer]? end class JsonIntEnumsOutput @@ -505,7 +505,7 @@ module RailsJson attr_accessor integer_enum3 (): ::Integer? attr_accessor integer_enum_list (): ::Array[::Integer]? attr_accessor integer_enum_set (): ::Array[::Integer]? - attr_accessor integer_enum_map (): ::Hash[::String, ::Integer]? + attr_accessor integer_enum_map (): ::Hash[Symbol, ::Integer]? end class JsonListsInput @@ -536,20 +536,20 @@ module RailsJson class JsonMapsInput include Hearth::Structure - attr_accessor dense_struct_map (): ::Hash[::String, Types::GreetingStruct]? - attr_accessor dense_number_map (): ::Hash[::String, ::Integer]? - attr_accessor dense_boolean_map (): ::Hash[::String, bool]? - attr_accessor dense_string_map (): ::Hash[::String, ::String]? - attr_accessor dense_set_map (): ::Hash[::String, ::Array[::String]]? + attr_accessor dense_struct_map (): ::Hash[Symbol, Types::GreetingStruct]? + attr_accessor dense_number_map (): ::Hash[Symbol, ::Integer]? + attr_accessor dense_boolean_map (): ::Hash[Symbol, bool]? + attr_accessor dense_string_map (): ::Hash[Symbol, ::String]? + attr_accessor dense_set_map (): ::Hash[Symbol, ::Array[::String]]? end class JsonMapsOutput include Hearth::Structure - attr_accessor dense_struct_map (): ::Hash[::String, Types::GreetingStruct]? - attr_accessor dense_number_map (): ::Hash[::String, ::Integer]? - attr_accessor dense_boolean_map (): ::Hash[::String, bool]? - attr_accessor dense_string_map (): ::Hash[::String, ::String]? - attr_accessor dense_set_map (): ::Hash[::String, ::Array[::String]]? + attr_accessor dense_struct_map (): ::Hash[Symbol, Types::GreetingStruct]? + attr_accessor dense_number_map (): ::Hash[Symbol, ::Integer]? + attr_accessor dense_boolean_map (): ::Hash[Symbol, bool]? + attr_accessor dense_string_map (): ::Hash[Symbol, ::String]? + attr_accessor dense_set_map (): ::Hash[Symbol, ::Array[::String]]? end class JsonTimestampsInput @@ -752,7 +752,7 @@ module RailsJson attr_accessor default_long (): ::Integer? attr_accessor default_float (): ::Float? attr_accessor default_double (): ::Float? - attr_accessor default_map (): ::Hash[::String, ::String]? + attr_accessor default_map (): ::Hash[Symbol, ::String]? attr_accessor default_enum (): ::String? attr_accessor default_int_enum (): ::Integer? attr_accessor empty_string (): ::String? @@ -775,7 +775,7 @@ module RailsJson include Hearth::Structure attr_accessor dialog (): Types::Dialog? attr_accessor dialog_list (): ::Array[Types::Dialog]? - attr_accessor dialog_map (): ::Hash[::String, Types::Dialog]? + attr_accessor dialog_map (): ::Hash[Symbol, Types::Dialog]? end class PayloadConfig @@ -837,7 +837,7 @@ module RailsJson class QueryParamsAsStringListMapInput include Hearth::Structure attr_accessor qux (): ::String? - attr_accessor foo (): ::Hash[::String, ::Array[::String]]? + attr_accessor foo (): ::Hash[Symbol, ::Array[::String]]? end class QueryParamsAsStringListMapOutput @@ -847,7 +847,7 @@ module RailsJson class QueryPrecedenceInput include Hearth::Structure attr_accessor foo (): ::String? - attr_accessor baz (): ::Hash[::String, ::String]? + attr_accessor baz (): ::Hash[Symbol, ::String]? end class QueryPrecedenceOutput @@ -921,38 +921,38 @@ module RailsJson class SparseJsonMapsInput include Hearth::Structure - attr_accessor sparse_struct_map (): ::Hash[::String, Types::GreetingStruct]? - attr_accessor sparse_number_map (): ::Hash[::String, ::Integer]? - attr_accessor sparse_boolean_map (): ::Hash[::String, bool]? - attr_accessor sparse_string_map (): ::Hash[::String, ::String]? - attr_accessor sparse_set_map (): ::Hash[::String, ::Array[::String]]? + attr_accessor sparse_struct_map (): ::Hash[Symbol, Types::GreetingStruct]? + attr_accessor sparse_number_map (): ::Hash[Symbol, ::Integer]? + attr_accessor sparse_boolean_map (): ::Hash[Symbol, bool]? + attr_accessor sparse_string_map (): ::Hash[Symbol, ::String]? + attr_accessor sparse_set_map (): ::Hash[Symbol, ::Array[::String]]? end class SparseJsonMapsOutput include Hearth::Structure - attr_accessor sparse_struct_map (): ::Hash[::String, Types::GreetingStruct]? - attr_accessor sparse_number_map (): ::Hash[::String, ::Integer]? - attr_accessor sparse_boolean_map (): ::Hash[::String, bool]? - attr_accessor sparse_string_map (): ::Hash[::String, ::String]? - attr_accessor sparse_set_map (): ::Hash[::String, ::Array[::String]]? + attr_accessor sparse_struct_map (): ::Hash[Symbol, Types::GreetingStruct]? + attr_accessor sparse_number_map (): ::Hash[Symbol, ::Integer]? + attr_accessor sparse_boolean_map (): ::Hash[Symbol, bool]? + attr_accessor sparse_string_map (): ::Hash[Symbol, ::String]? + attr_accessor sparse_set_map (): ::Hash[Symbol, ::Array[::String]]? end class StreamingTraitsInput include Hearth::Structure attr_accessor foo (): ::String? - attr_accessor blob (): ::String? + attr_accessor blob (): (::IO | Hearth::BlockIO | ::StringIO)? end class StreamingTraitsOutput include Hearth::Structure attr_accessor foo (): ::String? - attr_accessor blob (): ::String? + attr_accessor blob (): (::IO | Hearth::BlockIO | ::StringIO)? end class StreamingTraitsRequireLengthInput include Hearth::Structure attr_accessor foo (): ::String? - attr_accessor blob (): ::String? + attr_accessor blob (): (::IO | Hearth::BlockIO | ::StringIO)? end class StreamingTraitsRequireLengthOutput @@ -962,13 +962,13 @@ module RailsJson class StreamingTraitsWithMediaTypeInput include Hearth::Structure attr_accessor foo (): ::String? - attr_accessor blob (): ::String? + attr_accessor blob (): (::IO | Hearth::BlockIO | ::StringIO)? end class StreamingTraitsWithMediaTypeOutput include Hearth::Structure attr_accessor foo (): ::String? - attr_accessor blob (): ::String? + attr_accessor blob (): (::IO | Hearth::BlockIO | ::StringIO)? end module StringEnum @@ -1072,7 +1072,7 @@ module RailsJson include Hearth::Structure attr_accessor dialog (): Types::Dialog? attr_accessor dialog_list (): ::Array[Types::Dialog]? - attr_accessor dialog_map (): ::Hash[::String, Types::Dialog]? + attr_accessor dialog_map (): ::Hash[Symbol, Types::Dialog]? end class UnionPayload < Hearth::Union diff --git a/codegen/projections/rpcv2_cbor/lib/rpcv2_cbor/client.rb b/codegen/projections/rpcv2_cbor/lib/rpcv2_cbor/client.rb index d23698254..8c0c0d934 100644 --- a/codegen/projections/rpcv2_cbor/lib/rpcv2_cbor/client.rb +++ b/codegen/projections/rpcv2_cbor/lib/rpcv2_cbor/client.rb @@ -259,7 +259,7 @@ def no_input_output(params = {}, options = {}) # resp.data.default_long #=> Integer # resp.data.default_float #=> Float # resp.data.default_double #=> Float - # resp.data.default_map #=> Hash + # resp.data.default_map #=> Hash # resp.data.default_map['key'] #=> String # resp.data.default_enum #=> String, one of ["FOO", "BAR", "BAZ"] # resp.data.default_int_enum #=> Integer @@ -404,16 +404,16 @@ def recursive_shapes(params = {}, options = {}) # ) # @example Response structure # resp.data #=> Types::RpcV2CborDenseMapsOutput - # resp.data.dense_struct_map #=> Hash + # resp.data.dense_struct_map #=> Hash # resp.data.dense_struct_map['key'] #=> Types::GreetingStruct # resp.data.dense_struct_map['key'].hi #=> String - # resp.data.dense_number_map #=> Hash + # resp.data.dense_number_map #=> Hash # resp.data.dense_number_map['key'] #=> Integer - # resp.data.dense_boolean_map #=> Hash + # resp.data.dense_boolean_map #=> Hash # resp.data.dense_boolean_map['key'] #=> Boolean - # resp.data.dense_string_map #=> Hash + # resp.data.dense_string_map #=> Hash # resp.data.dense_string_map['key'] #=> String - # resp.data.dense_set_map #=> Hash> + # resp.data.dense_set_map #=> Hash> # resp.data.dense_set_map['key'] #=> Array # resp.data.dense_set_map['key'][0] #=> String def rpc_v2_cbor_dense_maps(params = {}, options = {}) @@ -559,16 +559,16 @@ def rpc_v2_cbor_lists(params = {}, options = {}) # ) # @example Response structure # resp.data #=> Types::RpcV2CborSparseMapsOutput - # resp.data.sparse_struct_map #=> Hash + # resp.data.sparse_struct_map #=> Hash # resp.data.sparse_struct_map['key'] #=> Types::GreetingStruct # resp.data.sparse_struct_map['key'].hi #=> String - # resp.data.sparse_number_map #=> Hash + # resp.data.sparse_number_map #=> Hash # resp.data.sparse_number_map['key'] #=> Integer - # resp.data.sparse_boolean_map #=> Hash + # resp.data.sparse_boolean_map #=> Hash # resp.data.sparse_boolean_map['key'] #=> Boolean - # resp.data.sparse_string_map #=> Hash + # resp.data.sparse_string_map #=> Hash # resp.data.sparse_string_map['key'] #=> String - # resp.data.sparse_set_map #=> Hash> + # resp.data.sparse_set_map #=> Hash> # resp.data.sparse_set_map['key'] #=> Array # resp.data.sparse_set_map['key'][0] #=> String def rpc_v2_cbor_sparse_maps(params = {}, options = {}) @@ -665,7 +665,7 @@ def simple_scalar_properties(params = {}, options = {}) # resp.data #=> Types::SparseNullsOperationOutput # resp.data.sparse_string_list #=> Array # resp.data.sparse_string_list[0] #=> String - # resp.data.sparse_string_map #=> Hash + # resp.data.sparse_string_map #=> Hash # resp.data.sparse_string_map['key'] #=> String def sparse_nulls_operation(params = {}, options = {}) response_body = ::StringIO.new diff --git a/codegen/projections/rpcv2_cbor/lib/rpcv2_cbor/types.rb b/codegen/projections/rpcv2_cbor/lib/rpcv2_cbor/types.rb index a81044bc3..c77a76632 100644 --- a/codegen/projections/rpcv2_cbor/lib/rpcv2_cbor/types.rb +++ b/codegen/projections/rpcv2_cbor/lib/rpcv2_cbor/types.rb @@ -73,7 +73,7 @@ class ComplexNestedErrorData # @option params [Integer] :default_long # @option params [Float] :default_float # @option params [Float] :default_double - # @option params [Hash] :default_map + # @option params [Hash] :default_map # @option params [String] :default_enum # @option params [Integer] :default_int_enum # @option params [String] :empty_string @@ -108,7 +108,7 @@ class ComplexNestedErrorData # @!attribute default_double # @return [Float] # @!attribute default_map - # @return [Hash] + # @return [Hash] # @!attribute default_enum # Enum, one of: ["FOO", "BAR", "BAZ"] # @return [String] @@ -402,7 +402,7 @@ class OperationWithDefaultsInput # @option params [Integer] :default_long # @option params [Float] :default_float # @option params [Float] :default_double - # @option params [Hash] :default_map + # @option params [Hash] :default_map # @option params [String] :default_enum # @option params [Integer] :default_int_enum # @option params [String] :empty_string @@ -437,7 +437,7 @@ class OperationWithDefaultsInput # @!attribute default_double # @return [Float] # @!attribute default_map - # @return [Hash] + # @return [Hash] # @!attribute default_enum # Enum, one of: ["FOO", "BAR", "BAZ"] # @return [String] @@ -623,21 +623,21 @@ class RecursiveShapesOutput # @!method initialize(params = {}) # @param [Hash] params - # @option params [Hash] :dense_struct_map - # @option params [Hash] :dense_number_map - # @option params [Hash] :dense_boolean_map - # @option params [Hash] :dense_string_map - # @option params [Hash>] :dense_set_map + # @option params [Hash] :dense_struct_map + # @option params [Hash] :dense_number_map + # @option params [Hash] :dense_boolean_map + # @option params [Hash] :dense_string_map + # @option params [Hash>] :dense_set_map # @!attribute dense_struct_map - # @return [Hash] + # @return [Hash] # @!attribute dense_number_map - # @return [Hash] + # @return [Hash] # @!attribute dense_boolean_map - # @return [Hash] + # @return [Hash] # @!attribute dense_string_map - # @return [Hash] + # @return [Hash] # @!attribute dense_set_map - # @return [Hash>] + # @return [Hash>] class RpcV2CborDenseMapsInput include Hearth::Structure @@ -654,21 +654,21 @@ class RpcV2CborDenseMapsInput # @!method initialize(params = {}) # @param [Hash] params - # @option params [Hash] :dense_struct_map - # @option params [Hash] :dense_number_map - # @option params [Hash] :dense_boolean_map - # @option params [Hash] :dense_string_map - # @option params [Hash>] :dense_set_map + # @option params [Hash] :dense_struct_map + # @option params [Hash] :dense_number_map + # @option params [Hash] :dense_boolean_map + # @option params [Hash] :dense_string_map + # @option params [Hash>] :dense_set_map # @!attribute dense_struct_map - # @return [Hash] + # @return [Hash] # @!attribute dense_number_map - # @return [Hash] + # @return [Hash] # @!attribute dense_boolean_map - # @return [Hash] + # @return [Hash] # @!attribute dense_string_map - # @return [Hash] + # @return [Hash] # @!attribute dense_set_map - # @return [Hash>] + # @return [Hash>] class RpcV2CborDenseMapsOutput include Hearth::Structure @@ -789,21 +789,21 @@ class RpcV2CborListsOutput # @!method initialize(params = {}) # @param [Hash] params - # @option params [Hash] :sparse_struct_map - # @option params [Hash] :sparse_number_map - # @option params [Hash] :sparse_boolean_map - # @option params [Hash] :sparse_string_map - # @option params [Hash>] :sparse_set_map + # @option params [Hash] :sparse_struct_map + # @option params [Hash] :sparse_number_map + # @option params [Hash] :sparse_boolean_map + # @option params [Hash] :sparse_string_map + # @option params [Hash>] :sparse_set_map # @!attribute sparse_struct_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_number_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_boolean_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_string_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_set_map - # @return [Hash>] + # @return [Hash>] class RpcV2CborSparseMapsInput include Hearth::Structure @@ -820,21 +820,21 @@ class RpcV2CborSparseMapsInput # @!method initialize(params = {}) # @param [Hash] params - # @option params [Hash] :sparse_struct_map - # @option params [Hash] :sparse_number_map - # @option params [Hash] :sparse_boolean_map - # @option params [Hash] :sparse_string_map - # @option params [Hash>] :sparse_set_map + # @option params [Hash] :sparse_struct_map + # @option params [Hash] :sparse_number_map + # @option params [Hash] :sparse_boolean_map + # @option params [Hash] :sparse_string_map + # @option params [Hash>] :sparse_set_map # @!attribute sparse_struct_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_number_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_boolean_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_string_map - # @return [Hash] + # @return [Hash] # @!attribute sparse_set_map - # @return [Hash>] + # @return [Hash>] class RpcV2CborSparseMapsOutput include Hearth::Structure @@ -954,11 +954,11 @@ class SimpleScalarPropertiesOutput # @!method initialize(params = {}) # @param [Hash] params # @option params [Array] :sparse_string_list - # @option params [Hash] :sparse_string_map + # @option params [Hash] :sparse_string_map # @!attribute sparse_string_list # @return [Array] # @!attribute sparse_string_map - # @return [Hash] + # @return [Hash] class SparseNullsOperationInput include Hearth::Structure @@ -973,11 +973,11 @@ class SparseNullsOperationInput # @!method initialize(params = {}) # @param [Hash] params # @option params [Array] :sparse_string_list - # @option params [Hash] :sparse_string_map + # @option params [Hash] :sparse_string_map # @!attribute sparse_string_list # @return [Array] # @!attribute sparse_string_map - # @return [Hash] + # @return [Hash] class SparseNullsOperationOutput include Hearth::Structure diff --git a/codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/types.rbs b/codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/types.rbs index 28e229c9d..1e2fe9809 100644 --- a/codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/types.rbs +++ b/codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/types.rbs @@ -39,7 +39,7 @@ module Rpcv2Cbor attr_accessor default_long (): ::Integer? attr_accessor default_float (): ::Float? attr_accessor default_double (): ::Float? - attr_accessor default_map (): ::Hash[::String, ::String]? + attr_accessor default_map (): ::Hash[Symbol, ::String]? attr_accessor default_enum (): ::String? attr_accessor default_int_enum (): ::Integer? attr_accessor empty_string (): ::String? @@ -147,7 +147,7 @@ module Rpcv2Cbor attr_accessor default_long (): ::Integer? attr_accessor default_float (): ::Float? attr_accessor default_double (): ::Float? - attr_accessor default_map (): ::Hash[::String, ::String]? + attr_accessor default_map (): ::Hash[Symbol, ::String]? attr_accessor default_enum (): ::String? attr_accessor default_int_enum (): ::Integer? attr_accessor empty_string (): ::String? @@ -195,20 +195,20 @@ module Rpcv2Cbor class RpcV2CborDenseMapsInput include Hearth::Structure - attr_accessor dense_struct_map (): ::Hash[::String, Types::GreetingStruct]? - attr_accessor dense_number_map (): ::Hash[::String, ::Integer]? - attr_accessor dense_boolean_map (): ::Hash[::String, bool]? - attr_accessor dense_string_map (): ::Hash[::String, ::String]? - attr_accessor dense_set_map (): ::Hash[::String, ::Array[::String]]? + attr_accessor dense_struct_map (): ::Hash[Symbol, Types::GreetingStruct]? + attr_accessor dense_number_map (): ::Hash[Symbol, ::Integer]? + attr_accessor dense_boolean_map (): ::Hash[Symbol, bool]? + attr_accessor dense_string_map (): ::Hash[Symbol, ::String]? + attr_accessor dense_set_map (): ::Hash[Symbol, ::Array[::String]]? end class RpcV2CborDenseMapsOutput include Hearth::Structure - attr_accessor dense_struct_map (): ::Hash[::String, Types::GreetingStruct]? - attr_accessor dense_number_map (): ::Hash[::String, ::Integer]? - attr_accessor dense_boolean_map (): ::Hash[::String, bool]? - attr_accessor dense_string_map (): ::Hash[::String, ::String]? - attr_accessor dense_set_map (): ::Hash[::String, ::Array[::String]]? + attr_accessor dense_struct_map (): ::Hash[Symbol, Types::GreetingStruct]? + attr_accessor dense_number_map (): ::Hash[Symbol, ::Integer]? + attr_accessor dense_boolean_map (): ::Hash[Symbol, bool]? + attr_accessor dense_string_map (): ::Hash[Symbol, ::String]? + attr_accessor dense_set_map (): ::Hash[Symbol, ::Array[::String]]? end class RpcV2CborListsInput @@ -241,20 +241,20 @@ module Rpcv2Cbor class RpcV2CborSparseMapsInput include Hearth::Structure - attr_accessor sparse_struct_map (): ::Hash[::String, Types::GreetingStruct]? - attr_accessor sparse_number_map (): ::Hash[::String, ::Integer]? - attr_accessor sparse_boolean_map (): ::Hash[::String, bool]? - attr_accessor sparse_string_map (): ::Hash[::String, ::String]? - attr_accessor sparse_set_map (): ::Hash[::String, ::Array[::String]]? + attr_accessor sparse_struct_map (): ::Hash[Symbol, Types::GreetingStruct]? + attr_accessor sparse_number_map (): ::Hash[Symbol, ::Integer]? + attr_accessor sparse_boolean_map (): ::Hash[Symbol, bool]? + attr_accessor sparse_string_map (): ::Hash[Symbol, ::String]? + attr_accessor sparse_set_map (): ::Hash[Symbol, ::Array[::String]]? end class RpcV2CborSparseMapsOutput include Hearth::Structure - attr_accessor sparse_struct_map (): ::Hash[::String, Types::GreetingStruct]? - attr_accessor sparse_number_map (): ::Hash[::String, ::Integer]? - attr_accessor sparse_boolean_map (): ::Hash[::String, bool]? - attr_accessor sparse_string_map (): ::Hash[::String, ::String]? - attr_accessor sparse_set_map (): ::Hash[::String, ::Array[::String]]? + attr_accessor sparse_struct_map (): ::Hash[Symbol, Types::GreetingStruct]? + attr_accessor sparse_number_map (): ::Hash[Symbol, ::Integer]? + attr_accessor sparse_boolean_map (): ::Hash[Symbol, bool]? + attr_accessor sparse_string_map (): ::Hash[Symbol, ::String]? + attr_accessor sparse_set_map (): ::Hash[Symbol, ::Array[::String]]? end class SimpleScalarPropertiesInput @@ -288,13 +288,13 @@ module Rpcv2Cbor class SparseNullsOperationInput include Hearth::Structure attr_accessor sparse_string_list (): ::Array[::String]? - attr_accessor sparse_string_map (): ::Hash[::String, ::String]? + attr_accessor sparse_string_map (): ::Hash[Symbol, ::String]? end class SparseNullsOperationOutput include Hearth::Structure attr_accessor sparse_string_list (): ::Array[::String]? - attr_accessor sparse_string_map (): ::Hash[::String, ::String]? + attr_accessor sparse_string_map (): ::Hash[Symbol, ::String]? end class StructureListMember diff --git a/codegen/projections/white_label/lib/white_label/client.rb b/codegen/projections/white_label/lib/white_label/client.rb index 0729b13d3..d34e6dae1 100644 --- a/codegen/projections/white_label/lib/white_label/client.rb +++ b/codegen/projections/white_label/lib/white_label/client.rb @@ -168,7 +168,7 @@ def dataplane_endpoint(params = {}, options = {}) # resp.data.map_document #=> Hash, Array, String, Boolean, Numeric # resp.data.list_of_strings #=> Array # resp.data.list_of_strings[0] #=> String - # resp.data.map_of_strings #=> Hash + # resp.data.map_of_strings #=> Hash # resp.data.map_of_strings['key'] #=> String # resp.data.iso8601_timestamp #=> Time # resp.data.epoch_timestamp #=> Time @@ -445,9 +445,9 @@ def http_digest_auth(params = {}, options = {}) # resp.data.list_of_strings #=> Array # resp.data.list_of_strings[0] #=> String # resp.data.list_of_structs #=> Array - # resp.data.map_of_strings #=> Hash + # resp.data.map_of_strings #=> Hash # resp.data.map_of_strings['key'] #=> String - # resp.data.map_of_structs #=> Hash + # resp.data.map_of_structs #=> Hash # resp.data.union #=> Types::Union, one of [String, Struct] # resp.data.union.string #=> String # resp.data.union.struct #=> Types::Struct diff --git a/codegen/projections/white_label/lib/white_label/types.rb b/codegen/projections/white_label/lib/white_label/types.rb index d00efd55a..379630b8c 100644 --- a/codegen/projections/white_label/lib/white_label/types.rb +++ b/codegen/projections/white_label/lib/white_label/types.rb @@ -84,7 +84,7 @@ class DataplaneEndpointOutput # @option params [Hash, Array, String, Boolean, Numeric] :list_document # @option params [Hash, Array, String, Boolean, Numeric] :map_document # @option params [Array] :list_of_strings - # @option params [Hash] :map_of_strings + # @option params [Hash] :map_of_strings # @option params [Time] :iso8601_timestamp # @option params [Time] :epoch_timestamp # @!attribute string @@ -141,7 +141,7 @@ class DataplaneEndpointOutput # @!attribute list_of_strings # @return [Array] # @!attribute map_of_strings - # @return [Hash] + # @return [Hash] # @!attribute iso8601_timestamp # @return [Time] # @!attribute epoch_timestamp @@ -257,7 +257,7 @@ class DefaultsTestInput # @option params [Hash, Array, String, Boolean, Numeric] :list_document # @option params [Hash, Array, String, Boolean, Numeric] :map_document # @option params [Array] :list_of_strings - # @option params [Hash] :map_of_strings + # @option params [Hash] :map_of_strings # @option params [Time] :iso8601_timestamp # @option params [Time] :epoch_timestamp # @!attribute string @@ -314,7 +314,7 @@ class DefaultsTestInput # @!attribute list_of_strings # @return [Array] # @!attribute map_of_strings - # @return [Hash] + # @return [Hash] # @!attribute iso8601_timestamp # @return [Time] # @!attribute epoch_timestamp @@ -539,8 +539,8 @@ module IntEnumType # @option params [Hash, Array, String, Boolean, Numeric] :document # @option params [Array] :list_of_strings # @option params [Array] :list_of_structs - # @option params [Hash] :map_of_strings - # @option params [Hash] :map_of_structs + # @option params [Hash] :map_of_strings + # @option params [Hash] :map_of_structs # @option params [Union] :union # @!attribute string # This is some member @@ -594,9 +594,9 @@ module IntEnumType # @!attribute list_of_structs # @return [Array] # @!attribute map_of_strings - # @return [Hash] + # @return [Hash] # @!attribute map_of_structs - # @return [Hash] + # @return [Hash] # @!attribute union # This is some union documentation. # It has some union members @@ -654,8 +654,8 @@ def to_s # @option params [Hash, Array, String, Boolean, Numeric] :document # @option params [Array] :list_of_strings # @option params [Array] :list_of_structs - # @option params [Hash] :map_of_strings - # @option params [Hash] :map_of_structs + # @option params [Hash] :map_of_strings + # @option params [Hash] :map_of_structs # @option params [Union] :union # @!attribute string # This is some member @@ -709,9 +709,9 @@ def to_s # @!attribute list_of_structs # @return [Array] # @!attribute map_of_strings - # @return [Hash] + # @return [Hash] # @!attribute map_of_structs - # @return [Hash] + # @return [Hash] # @!attribute union # This is some union documentation. # It has some union members diff --git a/codegen/projections/white_label/sig/white_label/types.rbs b/codegen/projections/white_label/sig/white_label/types.rbs index ff0f27eb3..29037118f 100644 --- a/codegen/projections/white_label/sig/white_label/types.rbs +++ b/codegen/projections/white_label/sig/white_label/types.rbs @@ -50,7 +50,7 @@ module WhiteLabel attr_accessor list_document (): Hearth::document? attr_accessor map_document (): Hearth::document? attr_accessor list_of_strings (): ::Array[::String]? - attr_accessor map_of_strings (): ::Hash[::String, ::String]? + attr_accessor map_of_strings (): ::Hash[Symbol, ::String]? attr_accessor iso8601_timestamp (): ::Time? attr_accessor epoch_timestamp (): ::Time? end @@ -79,7 +79,7 @@ module WhiteLabel attr_accessor list_document (): Hearth::document? attr_accessor map_document (): Hearth::document? attr_accessor list_of_strings (): ::Array[::String]? - attr_accessor map_of_strings (): ::Hash[::String, ::String]? + attr_accessor map_of_strings (): ::Hash[Symbol, ::String]? attr_accessor iso8601_timestamp (): ::Time? attr_accessor epoch_timestamp (): ::Time? end @@ -150,8 +150,8 @@ module WhiteLabel attr_accessor document (): Hearth::document? attr_accessor list_of_strings (): ::Array[::String]? attr_accessor list_of_structs (): ::Array[Types::Struct]? - attr_accessor map_of_strings (): ::Hash[::String, ::String]? - attr_accessor map_of_structs (): ::Hash[::String, Types::Struct]? + attr_accessor map_of_strings (): ::Hash[Symbol, ::String]? + attr_accessor map_of_structs (): ::Hash[Symbol, Types::Struct]? attr_accessor union (): Types::Union? end @@ -164,8 +164,8 @@ module WhiteLabel attr_accessor document (): Hearth::document? attr_accessor list_of_strings (): ::Array[::String]? attr_accessor list_of_structs (): ::Array[Types::Struct]? - attr_accessor map_of_strings (): ::Hash[::String, ::String]? - attr_accessor map_of_structs (): ::Hash[::String, Types::Struct]? + attr_accessor map_of_strings (): ::Hash[Symbol, ::String]? + attr_accessor map_of_structs (): ::Hash[Symbol, Types::Struct]? attr_accessor union (): Types::Union? end @@ -245,7 +245,7 @@ module WhiteLabel class RequestCompressionStreamingInput include Hearth::Structure - attr_accessor body (): ::String? + attr_accessor body (): (::IO | Hearth::BlockIO | ::StringIO)? end class RequestCompressionStreamingOutput @@ -278,17 +278,17 @@ module WhiteLabel class StreamingInput include Hearth::Structure - attr_accessor stream (): ::String? + attr_accessor stream (): (::IO | Hearth::BlockIO | ::StringIO)? end class StreamingOutput include Hearth::Structure - attr_accessor stream (): ::String? + attr_accessor stream (): (::IO | Hearth::BlockIO | ::StringIO)? end class StreamingWithLengthInput include Hearth::Structure - attr_accessor stream (): ::String? + attr_accessor stream (): (::IO | Hearth::BlockIO | ::StringIO)? end class StreamingWithLengthOutput diff --git a/codegen/projections/white_label/spec/params_spec.rb b/codegen/projections/white_label/spec/params_spec.rb index 94255cf6a..29c49358a 100644 --- a/codegen/projections/white_label/spec/params_spec.rb +++ b/codegen/projections/white_label/spec/params_spec.rb @@ -187,7 +187,7 @@ module Params end it 'does not convert a readable, io like object' do - stream = double('stream', read: 'chunk') + stream = StringIO.new('chunk') data = StreamingInput.build({ stream: stream }, context: 'params') expect(data).to be_a(Types::StreamingInput) expect(data.stream).to be(stream) diff --git a/codegen/projections/white_label/spec/streaming_spec.rb b/codegen/projections/white_label/spec/streaming_spec.rb index 0c6b4ea03..53382e415 100644 --- a/codegen/projections/white_label/spec/streaming_spec.rb +++ b/codegen/projections/white_label/spec/streaming_spec.rb @@ -14,7 +14,7 @@ module WhiteLabel end context 'block is provided' do - let(:block_io) { double('BlockIO') } + let(:block_io) { Hearth::BlockIO.new(-> {}) } it 'creates and uses a blockIO as the body' do expect(Hearth::BlockIO).to receive(:new).and_return(block_io) @@ -30,7 +30,7 @@ module WhiteLabel end context 'output_stream is set' do - let(:output_stream) { double('OutputStream') } + let(:output_stream) { StringIO.new } it 'uses the output_stream as the body' do expect(Hearth::HTTP::Response) @@ -44,7 +44,7 @@ module WhiteLabel end context 'parsers' do - let(:output_stream) { double('OutputStream') } + let(:output_stream) { StringIO.new } before do expect(output_stream).to receive(:write).and_return(0) @@ -62,7 +62,7 @@ module WhiteLabel end context 'stubs' do - let(:output_stream) { double('OutputStream') } + let(:output_stream) { StringIO.new } it 'copies the stub to the output stream' do proc = proc do |context| diff --git a/codegen/projections/white_label/spec/types_spec.rb b/codegen/projections/white_label/spec/types_spec.rb index b8e2b665f..e603f6b19 100644 --- a/codegen/projections/white_label/spec/types_spec.rb +++ b/codegen/projections/white_label/spec/types_spec.rb @@ -5,20 +5,7 @@ module WhiteLabel module Types describe KitchenSinkInput do - let(:params) do - { - string: 'simple string', - struct: { value: 'struct value' }, - document: { boolean: true }, - list_of_strings: %w[dank memes], - list_of_structs: [{ value: 'struct value' }], - map_of_strings: { key: 'value' }, - map_of_structs: { key: { value: 'struct value' } }, - union: { string: 'simple string' } - } - end - - subject { KitchenSinkInput.new(**params) } + subject { KitchenSinkInput.new } it 'is a hearth structure' do expect(subject).to be_a(Hearth::Structure) diff --git a/codegen/projections/white_label/spec/validators_spec.rb b/codegen/projections/white_label/spec/validators_spec.rb index 862a3bd78..80df56d50 100644 --- a/codegen/projections/white_label/spec/validators_spec.rb +++ b/codegen/projections/white_label/spec/validators_spec.rb @@ -218,7 +218,7 @@ module Validators end describe StreamingInput do - it 'validates io like' do + it 'validates io like', rbs_test: :skip do expect do StreamingInput.validate!( Types::StreamingInput.new(stream: ''), context: 'input' @@ -231,14 +231,17 @@ module Validators describe StreamingWithLengthInput do it 'validates responds_to(:size)' do - stream = double('stream', read: 'data') + rd, wr = IO.pipe + wr.puts 'data' + wr.close expect do StreamingWithLengthInput.validate!( - Types::StreamingWithLengthInput.new(stream: stream), - context: 'input' + Types::StreamingWithLengthInput.new(stream: rd), context: 'input' ) end - .to raise_error(ArgumentError, 'Expected input to respond_to(:size)') + .to raise_error(ArgumentError, + 'Expected input to respond_to(:size)') + rd.close end end diff --git a/codegen/smithy-ruby-codegen-test/integration-specs/params_spec.rb b/codegen/smithy-ruby-codegen-test/integration-specs/params_spec.rb index 94255cf6a..29c49358a 100644 --- a/codegen/smithy-ruby-codegen-test/integration-specs/params_spec.rb +++ b/codegen/smithy-ruby-codegen-test/integration-specs/params_spec.rb @@ -187,7 +187,7 @@ module Params end it 'does not convert a readable, io like object' do - stream = double('stream', read: 'chunk') + stream = StringIO.new('chunk') data = StreamingInput.build({ stream: stream }, context: 'params') expect(data).to be_a(Types::StreamingInput) expect(data.stream).to be(stream) diff --git a/codegen/smithy-ruby-codegen-test/integration-specs/streaming_spec.rb b/codegen/smithy-ruby-codegen-test/integration-specs/streaming_spec.rb index 0c6b4ea03..53382e415 100644 --- a/codegen/smithy-ruby-codegen-test/integration-specs/streaming_spec.rb +++ b/codegen/smithy-ruby-codegen-test/integration-specs/streaming_spec.rb @@ -14,7 +14,7 @@ module WhiteLabel end context 'block is provided' do - let(:block_io) { double('BlockIO') } + let(:block_io) { Hearth::BlockIO.new(-> {}) } it 'creates and uses a blockIO as the body' do expect(Hearth::BlockIO).to receive(:new).and_return(block_io) @@ -30,7 +30,7 @@ module WhiteLabel end context 'output_stream is set' do - let(:output_stream) { double('OutputStream') } + let(:output_stream) { StringIO.new } it 'uses the output_stream as the body' do expect(Hearth::HTTP::Response) @@ -44,7 +44,7 @@ module WhiteLabel end context 'parsers' do - let(:output_stream) { double('OutputStream') } + let(:output_stream) { StringIO.new } before do expect(output_stream).to receive(:write).and_return(0) @@ -62,7 +62,7 @@ module WhiteLabel end context 'stubs' do - let(:output_stream) { double('OutputStream') } + let(:output_stream) { StringIO.new } it 'copies the stub to the output stream' do proc = proc do |context| diff --git a/codegen/smithy-ruby-codegen-test/integration-specs/types_spec.rb b/codegen/smithy-ruby-codegen-test/integration-specs/types_spec.rb index b8e2b665f..e603f6b19 100644 --- a/codegen/smithy-ruby-codegen-test/integration-specs/types_spec.rb +++ b/codegen/smithy-ruby-codegen-test/integration-specs/types_spec.rb @@ -5,20 +5,7 @@ module WhiteLabel module Types describe KitchenSinkInput do - let(:params) do - { - string: 'simple string', - struct: { value: 'struct value' }, - document: { boolean: true }, - list_of_strings: %w[dank memes], - list_of_structs: [{ value: 'struct value' }], - map_of_strings: { key: 'value' }, - map_of_structs: { key: { value: 'struct value' } }, - union: { string: 'simple string' } - } - end - - subject { KitchenSinkInput.new(**params) } + subject { KitchenSinkInput.new } it 'is a hearth structure' do expect(subject).to be_a(Hearth::Structure) diff --git a/codegen/smithy-ruby-codegen-test/integration-specs/validators_spec.rb b/codegen/smithy-ruby-codegen-test/integration-specs/validators_spec.rb index 862a3bd78..80df56d50 100644 --- a/codegen/smithy-ruby-codegen-test/integration-specs/validators_spec.rb +++ b/codegen/smithy-ruby-codegen-test/integration-specs/validators_spec.rb @@ -218,7 +218,7 @@ module Validators end describe StreamingInput do - it 'validates io like' do + it 'validates io like', rbs_test: :skip do expect do StreamingInput.validate!( Types::StreamingInput.new(stream: ''), context: 'input' @@ -231,14 +231,17 @@ module Validators describe StreamingWithLengthInput do it 'validates responds_to(:size)' do - stream = double('stream', read: 'data') + rd, wr = IO.pipe + wr.puts 'data' + wr.close expect do StreamingWithLengthInput.validate!( - Types::StreamingWithLengthInput.new(stream: stream), - context: 'input' + Types::StreamingWithLengthInput.new(stream: rd), context: 'input' ) end - .to raise_error(ArgumentError, 'Expected input to respond_to(:size)') + .to raise_error(ArgumentError, + 'Expected input to respond_to(:size)') + rd.close end end diff --git a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/RubySymbolProvider.java b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/RubySymbolProvider.java index 6d2445198..51ce68296 100644 --- a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/RubySymbolProvider.java +++ b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/RubySymbolProvider.java @@ -295,12 +295,10 @@ public Symbol listShape(ListShape shape) { @Override public Symbol mapShape(MapShape shape) { - Symbol key = toSymbol(model.expectShape(shape.getKey().getTarget())); + // Key is always a String and will be a Symbol Symbol value = toSymbol(model.expectShape(shape.getValue().getTarget())); - String rbsType - = "::Hash[" + key.getProperty("rbsType").get() + ", " + value.getProperty("rbsType").get() + "]"; - String docType - = "Hash<" + key.getProperty("docType").get() + ", " + value.getProperty("docType").get() + ">"; + String rbsType = "::Hash[Symbol, " + value.getProperty("rbsType").get() + "]"; + String docType = "Hash"; return createSymbolBuilder(shape, getDefaultShapeName(shape, "Map__"), rbsType, docType, moduleName) .definitionFile(DEFAULT_DEFINITION_FILE) .build(); diff --git a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/types/StructureGenerator.java b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/types/StructureGenerator.java index cf86e77ab..9de0a899f 100644 --- a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/types/StructureGenerator.java +++ b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/types/StructureGenerator.java @@ -26,7 +26,9 @@ import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.ShapeVisitor; import software.amazon.smithy.model.shapes.StructureShape; +import software.amazon.smithy.model.traits.RequiredTrait; import software.amazon.smithy.model.traits.SensitiveTrait; +import software.amazon.smithy.model.traits.StreamingTrait; import software.amazon.smithy.ruby.codegen.GenerationContext; import software.amazon.smithy.ruby.codegen.Hearth; import software.amazon.smithy.ruby.codegen.RubyCodeWriter; @@ -98,9 +100,19 @@ public void render() { .write("include $L", Hearth.STRUCTURE) .call(() -> { shape.members().forEach(memberShape -> { - String name = symbolProvider.toMemberName(memberShape); - Symbol target = symbolProvider.toSymbol(model.expectShape(memberShape.getTarget())); - writer.write("attr_accessor $L (): $L", name, target.getProperty("rbsType").get()); + String memberName = symbolProvider.toMemberName(memberShape); + Shape target = model.expectShape(memberShape.getTarget()); + Symbol symbol = symbolProvider.toSymbol(target); + String rbsType; + if (target.hasTrait(StreamingTrait.class)) { + rbsType = "(::IO | Hearth::BlockIO | ::StringIO)"; + } else { + rbsType = symbol.getProperty("rbsType").get().toString(); + } + if (!target.hasTrait(RequiredTrait.class)) { + rbsType += "?"; + } + writer.write("attr_accessor $L (): $L", memberName, rbsType); }); }) .closeBlock("end");