@@ -48,9 +48,7 @@ def initialize(options)
48
48
@operation_inputs = operation_inputs . map do |operation_inputs_test |
49
49
OperationInputsTest . new (
50
50
service : @service ,
51
- operation_name : Underscore . underscore (
52
- operation_inputs_test [ 'operationName' ]
53
- ) ,
51
+ operation_name : operation_inputs_test [ 'operationName' ] ,
54
52
operation_params : operation_inputs_test [ 'operationParams' ] || { } ,
55
53
built_in_params : operation_inputs_test [ 'builtInParams' ] || { } ,
56
54
client_params : operation_inputs_test [ 'clientParams' ] || { }
@@ -110,9 +108,13 @@ class OperationInputsTest
110
108
111
109
def initialize ( options )
112
110
@service = options [ :service ]
113
- @operation_name = options [ :operation_name ]
111
+ @api = @service . api
112
+ @operation_name = Underscore . underscore ( options [ :operation_name ] )
113
+ input_shape_name = @api [ 'operations' ] [ options [ :operation_name ] ] [ 'input' ] [ 'shape' ]
114
+ input = @api [ 'shapes' ] [ input_shape_name ]
114
115
@operation_params = options [ :operation_params ] . map do |k , v |
115
- Param . new ( Underscore . underscore ( k ) , transform_operation_values ( v ) )
116
+ member_shape = @api [ 'shapes' ] [ input [ 'members' ] [ k ] [ 'shape' ] ]
117
+ Param . new ( Underscore . underscore ( k ) , transform_operation_values ( v , member_shape ) )
116
118
end
117
119
@client_params = options [ :client_params ] . map do |k , v |
118
120
Param . new ( Underscore . underscore ( k ) , v )
@@ -126,6 +128,10 @@ def initialize(options)
126
128
!options [ :built_in_params ] . include? ( 'AWS::S3::UseGlobalEndpoint' )
127
129
@client_params << built_in_to_param ( 'AWS::S3::UseGlobalEndpoint' , false )
128
130
end
131
+
132
+ if @service . identifier == 'dynamodb'
133
+ @client_params << Param . new ( :simple_attributes , false , true )
134
+ end
129
135
end
130
136
131
137
# @return String
@@ -138,14 +144,21 @@ def initialize(options)
138
144
attr_reader :client_params
139
145
140
146
private
141
- def transform_operation_values ( value )
142
- case value
143
- when Hash
147
+ def transform_operation_values ( value , ref )
148
+ case ref [ 'type' ]
149
+ when 'structure' , 'union'
150
+ value . each_with_object ( { } ) do |( k , v ) , o |
151
+ member_shape = @api [ 'shapes' ] [ ref [ 'members' ] [ k ] [ 'shape' ] ]
152
+ o [ Underscore . underscore ( k ) . to_sym ] = transform_operation_values ( v , member_shape )
153
+ end
154
+ when 'list'
155
+ member_shape = @api [ 'shapes' ] [ ref [ 'member' ] [ 'shape' ] ]
156
+ value . map { |v | transform_operation_values ( v , member_shape ) }
157
+ when 'map'
158
+ member_shape = @api [ 'shapes' ] [ ref [ 'value' ] [ 'shape' ] ]
144
159
value . each_with_object ( { } ) do |( k , v ) , o |
145
- o [ Underscore . underscore ( k ) . to_sym ] = transform_operation_values ( v )
160
+ o [ k ] = transform_operation_values ( v , member_shape )
146
161
end
147
- when Array
148
- value . map { |v | transform_operation_values ( v ) }
149
162
else
150
163
value
151
164
end
0 commit comments