lib/jsonschema: support listOf unspecified

This commit is contained in:
DavHau
2023-11-20 17:01:16 +07:00
parent 3b50f62b37
commit a656b5e83e
2 changed files with 21 additions and 0 deletions

View File

@@ -138,6 +138,15 @@ rec {
};
}
# parse list of unspecified
else if
(option.type.name == "listOf")
&& (option.type.functor.wrapped.name == "unspecified")
# return jsonschema property definition for list
then default // description // {
type = "array";
}
# parse attrsOf submodule
else if option.type.name == "attrsOf" && option.type.nestedTypes.elemType.name == "submodule"
# return jsonschema property definition for attrsOf submodule

View File

@@ -115,6 +115,18 @@ in
};
};
testListOfUnspacified =
let
default = [ 1 2 3 ];
in
{
expr = slib.parseOption (evalType (lib.types.listOf lib.types.unspecified) default);
expected = {
type = "array";
inherit default description;
};
};
testAttrsOfInt =
let
default = { foo = 1; bar = 2; baz = 3; };