lib.jsonschema: parse some more types
Some checks failed
checks / checks-impure (pull_request) Successful in 2m57s
buildbot/nix-eval Build done.

This commit is contained in:
DavHau 2024-05-23 16:11:54 +02:00
parent d137342243
commit 12a2e6c0b2

View File

@ -83,20 +83,21 @@ rec {
in
# either type
# TODO: if all nested optiosn are excluded, the parent sould be excluded too
# TODO: if all nested options are excluded, the parent should be excluded too
if
option.type.name or null == "either"
|| option.type.name or null == "coercedTo"
# return jsonschema property definition for either
then
let
optionsList' = [
{
type = option.type.nestedTypes.left;
type = option.type.nestedTypes.left or option.type.nestedTypes.coercedType;
_type = "option";
loc = option.loc;
}
{
type = option.type.nestedTypes.right;
type = option.type.nestedTypes.right or option.type.nestedTypes.finalType;
_type = "option";
loc = option.loc;
}
@ -157,12 +158,20 @@ rec {
# TODO: Add support for intMatching in jsonschema
# parse port type aka. "unsignedInt16"
else if option.type.name == "unsignedInt16" then
else if
option.type.name == "unsignedInt16"
|| option.type.name == "unsignedInt"
|| option.type.name == "pkcs11"
|| option.type.name == "intBetween" then
default // example // description // { type = "integer"; }
# parse string
# TODO: parse more precise string types
else if
option.type.name == "str"
|| option.type.name == "singleLineStr"
|| option.type.name == "passwdEntry str"
|| option.type.name == "passwdEntry path"
# return jsonschema property definition for string
then
default // example // description // { type = "string"; }