lib/aws/cfn/compiler/base.rb in aws-cfn-compiler-0.9.22 vs lib/aws/cfn/compiler/base.rb in aws-cfn-compiler-0.9.23
- old
+ new
@@ -65,9 +65,22 @@
abort! "Parameter #{name} has an invalid compiled block!\n#{hash.ai}" unless hash.is_a?(Hash)
if hash['Type']
unless %w(String Number CommaDelimitedList).include?(hash['Type'])
abort! "Parameter #{name} has an invalid type: #{hash['Type']}"
end
+ if hash.has_key?('Default')
+ @logger.debug "#{name} is a #{hash['Type']} and 'Default' is #{hash['Default']}"
+ case hash['Type']
+ when /String/
+ abort! "Parameter #{name} has an invalid Default: #{hash['Default']}" unless hash['Default'].is_a?(String)
+ when /Number/
+ abort! "Parameter #{name} has an invalid Default: #{hash['Default']}" unless (hash['Default'].is_a?(Numeric))
+ when /CommaDelimetedList/
+ abort! "Parameter #{name} has an invalid Default: #{hash['Default']}" unless (hash['Default'].is_a?(Array))
+ else
+ abort! "Parameter #{name} has an invalid type: #{hash['Type']}"
+ end
+ end
end
if hash['Default']
unless hash['Default'].is_a?(String)
abort! "Parameter #{name} has an invalid default (Must be string): #{hash['Default']}"
end