1
0
forked from clan/clan-core

lib.jsonschema: parse some more types

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

View File

@ -83,20 +83,20 @@ rec {
in in
# either type # 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 if
option.type.name or null == "either" option.type.name or null == "either" || option.type.name or null == "coercedTo"
# return jsonschema property definition for either # return jsonschema property definition for either
then then
let let
optionsList' = [ optionsList' = [
{ {
type = option.type.nestedTypes.left; type = option.type.nestedTypes.left or option.type.nestedTypes.coercedType;
_type = "option"; _type = "option";
loc = option.loc; loc = option.loc;
} }
{ {
type = option.type.nestedTypes.right; type = option.type.nestedTypes.right or option.type.nestedTypes.finalType;
_type = "option"; _type = "option";
loc = option.loc; loc = option.loc;
} }
@ -157,12 +157,21 @@ rec {
# TODO: Add support for intMatching in jsonschema # TODO: Add support for intMatching in jsonschema
# parse port type aka. "unsignedInt16" # 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"; } default // example // description // { type = "integer"; }
# parse string # parse string
# TODO: parse more precise string types
else if else if
option.type.name == "str" option.type.name == "str"
|| option.type.name == "singleLineStr"
|| option.type.name == "passwdEntry str"
|| option.type.name == "passwdEntry path"
# return jsonschema property definition for string # return jsonschema property definition for string
then then
default // example // description // { type = "string"; } default // example // description // { type = "string"; }