feat(jsonschema): remove 'default' if 'defaultText' is present
default is likely to contain an error thunk if defaultText is set including it into $exportedModuleInfo makes it non-serializable
This commit is contained in:
@@ -568,4 +568,27 @@ in
|
||||
type = "object";
|
||||
};
|
||||
};
|
||||
|
||||
# Default MUST not be evaluated if defaultText is present
|
||||
test_default_lazyness = {
|
||||
expr = (
|
||||
parseOption (evalModuleOptions {
|
||||
options.opt = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = throw "This option is lazy";
|
||||
defaultText = "This option is lazy";
|
||||
};
|
||||
})
|
||||
);
|
||||
expected = {
|
||||
additionalProperties = false;
|
||||
properties = {
|
||||
opt = {
|
||||
type = "boolean";
|
||||
};
|
||||
};
|
||||
required = [ ];
|
||||
type = "object";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user