Open graingert opened 2 years ago
Thanks for reporting.
But what is the expected output here? I suppose it is impossible to support attribute names with spaces in Python like this anyway. (The Pydantic BaseMode
may support renaming/alias of field names, but the built-in dataclass
could not.)
I think the most pythonic approach to this problem would be to rename the attribute with snake_case naming
from __future__ import annotations
from pydantic import BaseModel
class UnnammedType160398(BaseModel):
example_with_space: int
json with spaces in the keys
becomes:
however this works fine with a TypedDict: