lib/types: Fix emptyValue of listOf and nonEmptyListOf
An empty list is [], not {}! Also, non-empty lists shouldn't have a default of an empty list!
This commit is contained in:
parent
97d3b5e1dd
commit
382289027f
1 changed files with 2 additions and 2 deletions
|
@ -390,7 +390,7 @@ rec {
|
|||
).optionalValue
|
||||
) def.value
|
||||
) defs)));
|
||||
emptyValue = { value = {}; };
|
||||
emptyValue = { value = []; };
|
||||
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]);
|
||||
getSubModules = elemType.getSubModules;
|
||||
substSubModules = m: listOf (elemType.substSubModules m);
|
||||
|
@ -402,7 +402,7 @@ rec {
|
|||
let list = addCheck (types.listOf elemType) (l: l != []);
|
||||
in list // {
|
||||
description = "non-empty " + list.description;
|
||||
# Note: emptyValue is left as is, because another module may define an element.
|
||||
emptyValue = { }; # no .value attr, meaning unset
|
||||
};
|
||||
|
||||
attrsOf = elemType: mkOptionType rec {
|
||||
|
|
Loading…
Reference in a new issue