jsonschema: support mdDoc description

This commit is contained in:
DavHau
2023-11-21 17:29:06 +07:00
parent 53f0cf15ae
commit f38cc8a209
2 changed files with 26 additions and 2 deletions

View File

@@ -61,7 +61,7 @@ rec {
inherit (option) default;
};
description = lib.optionalAttrs (option ? description) {
inherit (option) description;
description = option.description.text or option.description;
};
in
@@ -186,8 +186,10 @@ rec {
in
default // description // {
type = "array";
items = parseOption nestedOption;
}
// (lib.optionalAttrs (! isExcludedOption nestedOption) {
items = parseOption nestedOption;
})
# parse list of unspecified
else if

View File

@@ -39,6 +39,28 @@ in
};
};
testDescriptionIsAttrs =
let
evaledConfig = lib.evalModules {
modules = [{
options.opt = lib.mkOption {
type = lib.types.bool;
description = {
_type = "mdDoc";
text = description;
};
};
}];
};
in
{
expr = slib.parseOption evaledConfig.options.opt;
expected = {
type = "boolean";
inherit description;
};
};
testBool =
let
default = false;