From 288d90c68c385ced10e8cc29488ce42cbf0b7a36 Mon Sep 17 00:00:00 2001 From: Guillaume Piolat Date: Mon, 15 May 2023 20:30:38 +0200 Subject: [PATCH] Config keys starting with _ prefix do not trigger error or warnings. This allow to use: "_comment": "Here is a comment" in JSON. --- source/dub/internal/configy/Read.d | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/dub/internal/configy/Read.d b/source/dub/internal/configy/Read.d index 44afcf162..dff6a92a9 100644 --- a/source/dub/internal/configy/Read.d +++ b/source/dub/internal/configy/Read.d @@ -490,6 +490,11 @@ private TLFR.Type parseMapping (alias TLFR) if (k[p.length .. $].length > 1 && k[p.length] == '-') continue FIELD; + // Ignore key starting with _ (escape hatch for comments in JSON). + // See: DUB Issue #2567 + if (k.startsWith("_")) + continue FIELD; + if (ctx.strict == StrictMode.Warn) { scope exc = new UnknownKeyConfigException(