def main(): Foo = ForwardRef('Foo') class Foo(BaseModel): a: int = 123 b: Foo = None Foo.update_forward_refs() return Foo
def module(): from pydantic import BaseModel from pydantic.typing import ForwardRef Foo = ForwardRef('Foo') class Foo(BaseModel): a: int = 123 b: 'Foo' = None Foo.update_forward_refs()
def module(): from typing import Dict, List from pydantic import BaseModel from pydantic.typing import ForwardRef Foo = ForwardRef('Foo') class Foo(BaseModel): a: int = 123 b: Foo = None c: List[Foo] = [] d: Dict[str, Foo] = {} Foo.update_forward_refs()