lib/jsonschema: support listOf unspecified
This commit is contained in:
@@ -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
|
# parse attrsOf submodule
|
||||||
else if option.type.name == "attrsOf" && option.type.nestedTypes.elemType.name == "submodule"
|
else if option.type.name == "attrsOf" && option.type.nestedTypes.elemType.name == "submodule"
|
||||||
# return jsonschema property definition for attrsOf submodule
|
# return jsonschema property definition for attrsOf submodule
|
||||||
|
|||||||
@@ -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 =
|
testAttrsOfInt =
|
||||||
let
|
let
|
||||||
default = { foo = 1; bar = 2; baz = 3; };
|
default = { foo = 1; bar = 2; baz = 3; };
|
||||||
|
|||||||
Reference in New Issue
Block a user