In 0a2456f I introduced StrictJsonDict (and a family of related 'strict' JSON types), after discovering that this has become possible. (In the past we had trouble getting Mypy to accept a recursive type definition.)
Our current codebase norm is to use JsonDict which is defined as dict[str, Any].
I suspect there are more instances of under-validated JSON being propagated that are concealed by the Any in JsonDict.
I intend to repoint JsonDict to be strict, which will involve adding appropriate validation in some places.
I will introduce a LaxJsonDict type with the old definition, with the intention of using this in test code where we currently need it (as otherwise we will probably have to insert more verbose checks into our test code).
I will then attempt to fix up code that relies on JsonDict = LaxJsonDict and drive down the number of errors that occur from a changeover. I would like to avoid polluting git blame everywhere by doing a tree-wide rename, so I'll rely on doing the work upfront before a single changeover.
In 0a2456f I introduced
StrictJsonDict(and a family of related 'strict' JSON types), after discovering that this has become possible. (In the past we had trouble getting Mypy to accept a recursive type definition.)Our current codebase norm is to use
JsonDictwhich is defined asdict[str, Any].I suspect there are more instances of under-validated JSON being propagated that are concealed by the
AnyinJsonDict.I intend to repoint
JsonDictto be strict, which will involve adding appropriate validation in some places.I will introduce a
LaxJsonDicttype with the old definition, with the intention of using this in test code where we currently need it (as otherwise we will probably have to insert more verbose checks into our test code).I will then attempt to fix up code that relies on
JsonDict = LaxJsonDictand drive down the number of errors that occur from a changeover. I would like to avoid polluting git blame everywhere by doing a tree-wide rename, so I'll rely on doing the work upfront before a single changeover.