mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 14:50:19 +00:00
16 lines
214 B
Python
16 lines
214 B
Python
from typing import ForwardRef
|
|
from pydantic import BaseModel
|
|
|
|
Foo = ForwardRef('Foo')
|
|
|
|
|
|
class Foo(BaseModel):
|
|
a: int = 123
|
|
b: Foo = None
|
|
|
|
|
|
Foo.update_forward_refs()
|
|
|
|
print(Foo())
|
|
print(Foo(b={'a': '321'}))
|