Skip to content

Commit 7e4662d

Browse files
committed
Change recommendation for multiple value parameters
1 parent ceb48c2 commit 7e4662d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

docs/index.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,15 @@ There are a few things that can be checked if you review a pull request against
210210
[POSIX
211211
standard](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206),
212212
and some tools don't handle the lack of a terminating newline properly
213-
* If you can supply one or multiple values for an attribute it's common practice
214-
to enforce the datatype for one value and an array of that datatype. An
215-
example for string is `Variant[String[1],Array[String[1]]]`. This can be used
216-
in the Puppet code as `[$var].flatten()`
213+
* If you can supply multiple values for an attribute it's common practice to
214+
enforce the datatype as an array of values, even if the default is a single
215+
item. This cuts down on code and remove some edge cases. An example for string
216+
is `Array[String[1]]` instead of `Variant[String[1],Array[String[1]]]`.
217+
218+
Note that previously the recommendation was to have a `Variant` type, but this
219+
causes problems with values that contain Arrays, e.g. `Variant[Tuple[String,
220+
Array], Array[Tuple[String, Array]]]` (which would unintentionally flatten the
221+
array inside the tuple).
217222
* The parameter section should always be aligned at the `=` char
218223
* Is a class considered private? Then it should contain
219224
[assert_private](https://github.com/puppetlabs/puppetlabs-stdlib#assert_private)

0 commit comments

Comments
 (0)