Skip to content

Commit

Permalink
Validate Array contents (GoogleCloudPlatform#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
rileykarson authored and modular-magician committed Oct 25, 2018
1 parent 781bfec commit fa022c2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions api/async.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def validate
check_property :path, String
check_property :complete, String
check_property :allowed, Array
check_property_list :allowed, String
end
end

Expand Down
5 changes: 3 additions & 2 deletions api/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ def validate
check_optional_property :transport, Transport
check_optional_property :references, ReferenceLinks

check_property :properties, Array unless @exclude

check_property_oneof_default :create_verb, %i[POST PUT], :POST, Symbol
check_property_oneof_default \
:delete_verb, %i[POST PUT PATCH DELETE], :DELETE, Symbol
Expand All @@ -265,6 +263,8 @@ def validate
set_variables(@properties, :__resource)

check_property_list :parameters, Api::Type

check_property :properties, Array unless @exclude
check_property_list :properties, Api::Type

check_identity unless @identity.nil?
Expand Down Expand Up @@ -326,6 +326,7 @@ def uri_properties

def check_identity
check_property :identity, Array
check_property_list :identity, String

# Ensures we have all properties defined
@identity.each do |i|
Expand Down
1 change: 1 addition & 0 deletions provider/ansible/manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Manifest < Api::Object
def validate
check_property :metadata_version, String
check_property :status, Array
check_property_list :status, String
check_property :supported_by, String
check_property :requirements, Array
check_property_list :requirements, String
Expand Down
6 changes: 3 additions & 3 deletions provider/chef/manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ class Manifest < Api::Object
def validate
check_optional_property :additional_info, Array
check_optional_property :depends, Array
check_property_list :depends, Provider::Config::Requirements
check_property :description, String
check_property :issues, String
check_property :operating_systems, Array
check_property_list \
:operating_systems, Provider::Config::OperatingSystem
check_property :source, String
check_property :summary, String
check_property :version, String
check_property_list :depends, Provider::Config::Requirements
check_property_list \
:operating_systems, Provider::Config::OperatingSystem
super
end
end
Expand Down
7 changes: 4 additions & 3 deletions provider/puppet/manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ def validate
check_property :homepage, String
check_property :issues, String
check_property :operating_systems, Array
check_property_list \
:operating_systems, Provider::Config::OperatingSystem
check_optional_property :requires, Array
check_property_list :requires, Provider::Config::Requirements
check_property :source, String
check_property :summary, String
check_property :tags, Array
check_property_list :tags, String
check_property :version, String
check_property_list :requires, Provider::Config::Requirements
check_property_list \
:operating_systems, Provider::Config::OperatingSystem
super
end
end
Expand Down
1 change: 1 addition & 0 deletions provider/terraform/resource_override.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def validate
check_optional_property :custom_code, Provider::Terraform::CustomCode
check_optional_property :docs, Provider::Terraform::Docs
check_property :import_format, Array
check_property_list :import_format, String
end

def apply(resource)
Expand Down

0 comments on commit fa022c2

Please sign in to comment.