It's inconvenient and un-Pythonic to have to make everything a TypedDict. The natural way to describe a Python schema would be to use a plain class or a dataclass. Pydantic classes should also work. All these have in common that the data, when being manipulated by a Python program, looks and feels like a Python object rather than a Python dict. For example, to construct an object, you would write something like
p = Point(x=10, y=42)
instead of
p = {'type': 'Point', 'x': 10, 'y': 42}
I believe that Pydantic is able to take in JSON and turn it into a Python object for consumption by Python code, and it does the validation as it is doing the conversion.
I would also like not to have to explicitly add the
It's inconvenient and un-Pythonic to have to make everything a
TypedDict
. The natural way to describe a Python schema would be to use a plain class or a dataclass. Pydantic classes should also work. All these have in common that the data, when being manipulated by a Python program, looks and feels like a Python object rather than a Python dict. For example, to construct an object, you would write something likeinstead of
I believe that Pydantic is able to take in JSON and turn it into a Python object for consumption by Python code, and it does the validation as it is doing the conversion.
I would also like not to have to explicitly add the
declaration to the
Point
class.