Python version import sys; print(sys.version): 3.6.7 with dataclasses backport
Pydantic version import pydantic; print(pydantic.VERSION): 1.0
It is known that @pydantic.dataclasses.dataclass doesn't fully mimic the BaseModel. However, we'd like use .schema() representation faithfully. I'm wondering what's the best workaround.
Adding a Config for b with required=False doesn't carry over to .schema() either.
D1(a=10)
1 validation error for D2
b
value is not a valid dict (type=type_error.dict)
D3(a=10, b={'x': 10})
only ["a"] should be required, is: ['a', 'b']
['a', 'b']
The text was updated successfully, but these errors were encountered:
I think what you want is better support for the field() function from dataclasses. If so, please describe exactly what parts of field() usage you'd like to support in pydantic. Is it just the default in schema?
Thanks for clarifying!
Only handling default* in schema is what we need to support. However, it would be nice to have a stable interface for .__pydantic_model__. I'm not sure if this might change.
Bug
Please complete:
import sys; print(sys.version)
: 3.6.7 with dataclasses backportimport pydantic; print(pydantic.VERSION)
: 1.0It is known that
@pydantic.dataclasses.dataclass
doesn't fully mimic theBaseModel
. However, we'd like use.schema()
representation faithfully. I'm wondering what's the best workaround.Adding a
Config
forb
withrequired=False
doesn't carry over to.schema()
either.Output
The text was updated successfully, but these errors were encountered: