Skip to content

Commit 2fe1749

Browse files
authored
[BuildTools] Support structure with no members key (aws#1971)
1 parent 62a22fb commit 2fe1749

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/apply_docs.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def apply_docs(docs)
2929
case @api['shapes'][ref_shape]['type']
3030
when 'structure'
3131
shape = @api['shapes'][ref_shape]
32-
if shape
32+
if shape && shape['members']
3333
member = shape['members'][ref_member]
3434
member['documentation'] = ref_docs if member
3535
end

build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/client_operation_documentation.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def option_tags(operation, api)
101101

102102
def return_tag(operation, api)
103103
output = Api.shape(operation['output'], api)
104-
if output && output['members'].size > 0
104+
if output && output['members'] && output['members'].size > 0
105105
shape_name = operation.fetch('output').fetch('shape')
106106
type = "Types::#{shape_name}"
107107
_, shape = Api.resolve(shape_name, api)
@@ -198,7 +198,7 @@ def request_syntax_example(method_name, operation, api)
198198

199199
def response_structure_example(operation, api)
200200
output = Api.shape(operation['output'], api) if operation['output']
201-
if output && output['members'].size > 0
201+
if output && output['members'] && output['members'].size > 0
202202
Docstring.block_comment(ClientResponseStructureExample.new(
203203
shape_ref: operation['output'],
204204
api: api

build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/client_response_structure_example.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def structure(ref, context, visited)
3636
event_ctx.unshift("#{context} #=> Enumerator")
3737
event_ctx.unshift("All events are available at #{context}:")
3838
return event_ctx
39-
else
39+
elsif shape['members']
4040
shape['members'].each_pair do |member_name, member_ref|
4141
lines += entry(member_ref, "#{context}.#{underscore(member_name)}", visited)
4242
end

build_tools/customizations.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def exclude_eventstream(api)
4242

4343
def is_eventstream?(api, shape_name)
4444
shape = api['shapes'][shape_name]
45-
if shape['type'] == 'structure'
45+
if shape['type'] == 'structure' && shape['members']
4646
eventstream = false
4747
shape['members'].each do |_, m_ref|
4848
eventstream ||= api['shapes'][m_ref['shape']]['eventstream']

tasks/update-sensitive-params.rake

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ task 'update-sensitive-params' do
33
sensitive = []
44
BuildTools::Services.each do |svc|
55
svc.api['shapes'].each_pair do |shape_name, shape|
6-
if shape['type'] == 'structure'
6+
if shape['type'] == 'structure' && shape['members']
77
shape['members'].each_pair do |member_name, member_ref|
88
if
99
member_ref['sensitive'] ||

0 commit comments

Comments
 (0)