Skip to content

Commit

Permalink
Ignore unknown metadata and shape keys (#3095)
Browse files Browse the repository at this point in the history
  • Loading branch information
alextwoods authored Aug 29, 2024
1 parent f187dd2 commit a0c854d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,13 @@ module AwsSdkCodeGenerator
# WARNING ABOUT GENERATED CODE
WARNING_TXT

@warnings = []

class << self
attr_reader :warnings
def warn(service, type, message)
Kernel.warn(message)
@warnings << { service: service, type: type, message: message }
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ def metadata
value: @service.api['metadata'][key].inspect
}
elsif METADATA_KEYS[key].nil?
raise "unhandled metadata key #{key.inspect}"
AwsSdkCodeGenerator.warn(
@service.service_id,
:invalid_key,
"unhandled metadata key `#{key}`"
)
end
end
metadata
Expand Down Expand Up @@ -317,7 +321,11 @@ def shape_constructor_args(shape_name, shape)

args << "#{key}: #{value.inspect}"
elsif SHAPE_KEYS[key].nil?
raise "unhandled shape key #{key.inspect}"
AwsSdkCodeGenerator.warn(
@service.service_id,
:invalid_key,
"unhandled shape key `#{key}` on `#{shape_name}`"
)
end
end
args.join(', ')
Expand Down

0 comments on commit a0c854d

Please sign in to comment.