Project

General

Profile

Actions

Bug #19215

closed

Example[String[0], Array[String]] data type parsed as a single argument

Added by Dominic Cleal about 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When specifying the following data type in a class parameter, the third argument is being ignored:

Variant[Undef, String[0], Array[Stdlib::Absolutepath]] $server_common_modules_path,

This can be seen from the parameter validation error when using an array, as Kafo only permits it to be an Undef or zero-length string:

Parameter puppet-server-common-modules-path invalid: ["/etc/puppetlabs/code/environments/common", "/etc/puppetlabs/code/modules", "/opt/puppetlabs/puppet/modules"] is not one of undef or string

A minimised test case is this data type:

Hash[String[0], Array[String]]

which is parsed incorrectly:

$ irb -Ilib -rkafo/data_type
> Kafo::DataType.new_from_string('Hash[String[0], Array[String]]')                                                      
 => #<Kafo::DataTypes::Hash:0x00000001967980 @inner_key_type=#<Kafo::DataTypes::String:0x00000001967458 @min=0, @max=:infinite>, @inner_value_type=#<Kafo::DataTypes::Any:0x00000001966328>, @min=0, @max=:infinite> 
> Kafo::DataType.new_from_string('Hash[String, Array[String]]')                                                         
 => #<Kafo::DataTypes::Hash:0x00000001937b90 @inner_key_type=#<Kafo::DataTypes::String:0x000000019379b0 @min=0, @max=:infinite>, @inner_value_type=#<Kafo::DataTypes::Array:0x000000019374b0 @inner_type=#<Kafo::DataTypes::String:0x00000001937398 @min=0, @max=:infinite>, @min=0, @max=:infinite>, @min=0, @max=:infinite> 

(the inner_value_type is set to "Any" when String[0] is used for the hash key type)

Actions #1

Updated by The Foreman Bot about 7 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/kafo/pull/212 added
Actions #2

Updated by Dominic Cleal almost 7 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF