Dataclass or BaseModel¶
Pydantic’s documentation primarily adopts the
from pydantic import BaseModel class Item(BaseModel): ...
rather than the
from pydantic.dataclasses import dataclass @dataclass class Item: ...
and whilst Quart-Schema supports both this documentation primarily
dataclass approach. This is because I find this
approach to be cleaner and clearer. I think if pydantic had started
dataclass was added to the Python stdlib it would have
done the same.
Just a caveat, that these two approaches lead to potentially subtle differences which you can read about here.