diff --git a/lib/jsonschema/default.nix b/lib/jsonschema/default.nix index 16a8e46b2..8dfddde94 100644 --- a/lib/jsonschema/default.nix +++ b/lib/jsonschema/default.nix @@ -72,7 +72,8 @@ rec { { } else if opt ? defaultText then { - default = ""; + # dont add default to jsonschema. It seems to alter the type + # default = ""; } else lib.optionalAttrs (opt ? default) { @@ -93,11 +94,18 @@ rec { }; makeModuleInfo = - { path }: { - "$exportedModuleInfo" = { - inherit path; - }; + path, + defaultText ? null, + }: + { + "$exportedModuleInfo" = + { + inherit path; + } + // lib.optionalAttrs (defaultText != null) { + inherit defaultText; + }; }; # parses a set of evaluated nixos options to a jsonschema @@ -172,6 +180,7 @@ rec { }; exposedModuleInfo = makeModuleInfo { path = option.loc; + defaultText = option.defaultText or null; }; in # either type