1
0
forked from clan/clan-core

Add jsonschema test case

This commit is contained in:
Luis Hebendanz 2024-05-03 18:22:20 +02:00
parent 83ea2312a1
commit 159198b81a
4 changed files with 48 additions and 1 deletions

View File

@ -10,5 +10,10 @@
}, },
"services": { "services": {
"opt": "this option doesn't make sense" "opt": "this option doesn't make sense"
},
"destinations": {
"test-backup": {
"name": "John Doe"
}
} }
} }

View File

@ -50,5 +50,26 @@
]; ];
description = "A list of enabled kernel modules"; description = "A list of enabled kernel modules";
}; };
destinations = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule (
{ name, ... }:
{
options = {
name = lib.mkOption {
type = lib.types.strMatching "^[a-zA-Z0-9._-]+$";
default = name;
description = "the name of the backup job";
};
repo = lib.mkOption {
type = lib.types.str;
description = "the borgbackup repository to backup to";
};
};
}
)
);
default = { };
};
}; };
} }

View File

@ -45,6 +45,27 @@
"description": "A submodule option" "description": "A submodule option"
} }
} }
},
"destinations": {
"additionalProperties": {
"properties": {
"name": {
"default": "name",
"description": "the name of the backup job",
"type": "string"
},
"repo": {
"description": "the borgbackup repository to backup to",
"type": "string"
}
},
"required": [
"repo"
],
"type": "object"
},
"default": {},
"type": "object"
} }
} }
} }

View File

@ -46,7 +46,7 @@
checks = { checks = {
module-schema = pkgs.runCommand "schema-checks" { } '' module-schema = pkgs.runCommand "schema-checks" { } ''
${pkgs.check-jsonschema}/bin/check-jsonschema \ ${pkgs.check-jsonschema}/bin/check-jsonschema \
--check-metaschema --fill-defaults ${packages.module-schema} --check-metaschema ${packages.module-schema}
touch $out touch $out
''; '';
}; };