forked from Fediversity/Fediversity
JSON schema converter: make regular attrs required
This commit is contained in:
parent
81842f714e
commit
a02f81567f
1 changed files with 6 additions and 2 deletions
|
@ -127,7 +127,7 @@ rec {
|
|||
# parse options to jsonschema properties
|
||||
properties = lib.mapAttrs (_name: option: (parseOption' (path ++ [ _name ]) option)) options';
|
||||
# TODO: figure out how to handle if prop.anyOf is used
|
||||
isRequired = prop: !(prop ? default || prop.type or null == "object");
|
||||
isRequired = prop: !(prop ? default || prop."$exportedModuleInfo".required or false);
|
||||
requiredProps = lib.filterAttrs (_: prop: isRequired prop) properties;
|
||||
required = lib.optionalAttrs (requiredProps != { }) { required = lib.attrNames requiredProps; };
|
||||
header' = if addHeader then header else { };
|
||||
|
@ -381,7 +381,11 @@ rec {
|
|||
# return jsonschema property definition for attrs
|
||||
then
|
||||
default
|
||||
// exposedModuleInfo
|
||||
// (lib.reqursiveUpdate exposedModuleInfo {
|
||||
"$exportedModuleInfo" = {
|
||||
required = true;
|
||||
};
|
||||
})
|
||||
// example
|
||||
// description
|
||||
// {
|
||||
|
|
Loading…
Add table
Reference in a new issue