forked from Fediversity/Fediversity
Document nullable fields sanitation (#365)
Reviewed-on: Fediversity/Fediversity#365 Reviewed-by: Valentin Gagarin <valentin.gagarin@tweag.io> Co-authored-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@moduscreate.com> Co-committed-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@moduscreate.com>
This commit is contained in:
parent
09119803e8
commit
69b2e535fe
1 changed files with 5 additions and 1 deletions
|
@ -38,8 +38,12 @@ panelConfigNullable:
|
||||||
let
|
let
|
||||||
inherit (lib) mkIf;
|
inherit (lib) mkIf;
|
||||||
|
|
||||||
|
## The convertor from module options to JSON schema does not generate proper
|
||||||
|
## JSON schema types, forcing us to use nullable fields for default values.
|
||||||
|
## However, working with those fields in the deployment code is annoying (and
|
||||||
|
## unusual for Nix programmers), so we sanitize the input here and add back
|
||||||
|
## the default value by hand.
|
||||||
nonNull = x: v: if x == null then v else x;
|
nonNull = x: v: if x == null then v else x;
|
||||||
|
|
||||||
panelConfig = {
|
panelConfig = {
|
||||||
domain = nonNull panelConfigNullable.domain "fediversity.net";
|
domain = nonNull panelConfigNullable.domain "fediversity.net";
|
||||||
initialUser = nonNull panelConfigNullable.initialUser {
|
initialUser = nonNull panelConfigNullable.initialUser {
|
||||||
|
|
Loading…
Add table
Reference in a new issue