From c0e78b1e448977bf2d15a8592d31a23d570ffe33 Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Thu, 13 Aug 2026 16:11:14 +0000 Subject: [PATCH] Introduce LaxJsonDict --- synapse/types/__init__.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/synapse/types/__init__.py b/synapse/types/__init__.py index 7516847303..d7602e8507 100644 --- a/synapse/types/__init__.py +++ b/synapse/types/__init__.py @@ -94,8 +94,19 @@ MutableStateMap = MutableMapping[StateKey, T] # A "simple" (canonical) JSON value. SimpleJsonValue = str | int | bool | None JsonValue = list[SimpleJsonValue] | tuple[SimpleJsonValue, ...] | SimpleJsonValue -# A JSON-serialisable dict. + +LaxJsonDict = dict[str, Any] +""" +A JSON-serialisable dict, without strong type enforcement. +""" + JsonDict = dict[str, Any] +""" +A JSON-serialisable dict. + +NOTE: Will be updated to point at `StrictJsonDict` in the future. +""" + # A JSON-serialisable mapping; roughly speaking an immutable JSONDict. # Useful when you have a TypedDict which isn't going to be mutated and you don't want # to cast to JsonDict everywhere.