From 69b2e535fea028eced11cfedb39202586f0fbca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=E2=80=9CNiols=E2=80=9D=20Jeannerod?= Date: Tue, 10 Jun 2025 11:57:01 +0200 Subject: [PATCH] Document nullable fields sanitation (#365) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.fediversity.eu/Fediversity/Fediversity/pulls/365 Reviewed-by: Valentin Gagarin Co-authored-by: Nicolas “Niols” Jeannerod Co-committed-by: Nicolas “Niols” Jeannerod --- deployment/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deployment/default.nix b/deployment/default.nix index 3f8e550a..dbfa4610 100644 --- a/deployment/default.nix +++ b/deployment/default.nix @@ -38,8 +38,12 @@ panelConfigNullable: let 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; - panelConfig = { domain = nonNull panelConfigNullable.domain "fediversity.net"; initialUser = nonNull panelConfigNullable.initialUser {