-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
Description
Feature Request
Please complete:
- OS: Ubuntu
- Python version
import sys; print(sys.version): 3.7.4 - Pydantic version
import pydantic; print(pydantic.VERSION): v0.32.1
Would be great if pydantic.dataclasses.dataclass could convert an exsting dataclass to a validated/parsed dataclass.
This currently doesn't work and you just get back the normal dataclass.
from dataclasses import dataclass
from typing import Optional
import pydantic.dataclasses
@dataclass
class File:
hash: str
name: Optional[str]
size: int
content: Optional[bytes] = None
FileChecked = pydantic.dataclasses.dataclass(File)
f = FileChecked(hash='xxx', name=b'whatever.txt', size='456')
debug(f)
# doesn't currently convert name to a str or size to an intVictor-Savu, cordalace, rominf, kalzoo, fhpriamo and 1 more