feat(jsonschema): add test for attrsof submodule

This commit is contained in:
Johannes Kirschbauer
2025-04-16 14:48:35 +02:00
parent e28681c4f2
commit 9f7e9ca9df
2 changed files with 35 additions and 1 deletions

View File

@@ -40,6 +40,14 @@
albrecht = 3; albrecht = 3;
}; };
}; };
# attrs of submodule
userModules = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule {
options.foo = lib.mkOption { };
}
);
};
# list of str # list of str
kernelModules = lib.mkOption { kernelModules = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;

View File

@@ -3,7 +3,7 @@
"$exportedModuleInfo": { "path": [] }, "$exportedModuleInfo": { "path": [] },
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"required": [ "services" ], "required": ["services", "userModules"],
"properties": { "properties": {
"name": { "name": {
"$exportedModuleInfo": { "path": ["name"] }, "$exportedModuleInfo": { "path": ["name"] },
@@ -47,6 +47,32 @@
}, },
"description": "Some attributes" "description": "Some attributes"
}, },
"userModules": {
"$exportedModuleInfo": { "path": ["userModules"] },
"type": "object",
"additionalProperties": {
"$exportedModuleInfo": { "path": ["userModules", "<name>"] },
"additionalProperties": false,
"type": "object",
"properties": {
"foo": {
"$exportedModuleInfo": {
"path": ["userModules", "<name>", "foo"]
},
"type": [
"boolean",
"integer",
"number",
"string",
"array",
"object",
"null"
]
}
},
"required": ["foo"]
}
},
"colour": { "colour": {
"$exportedModuleInfo": { "path": ["colour"] }, "$exportedModuleInfo": { "path": ["colour"] },
"default": "red", "default": "red",