-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Closed
Labels
Description
I use the native dataclasses api, and I imagine that this will be the standard for python apps in the coming future, so I think fastapi should support them without requiring the use of pydantic.
Otherwise, a heavily nested dc will require changing a lot of code.
The common situation is this:
@dataclasses.dataclass(frozen=True)
class A:
b: B
@dataclasses.dataclass(frozen=True)
class B:
...
Where I want to use A in my fastapi app, but I end up having to convert A to pydantic (via mix-in or by giving up dataclasses features).
Even if I do that, I might need to convert B as well, so this is quite a big change to introduce for an api that's supposed to affect just the networking side of things.
Side note: I'm using dataclasses_json to convert to json, so I have two decorators.
bgreen-litl