Pydantic version : 0.23
I find this paragraph regarding postponed annotations a bit confusing.
from __future__ import annotations # Useless !
from typing import List
from pydantic import BaseModel
class Model(BaseModel):
a: List[int] # Where's the forward reference ?
print(Model(a=('1', 2, 3)))
#> Model a=[1, 2, 3]
It wasn't immediately clear to me that the two suggested solutions (with annotations and ForwardRef) were completely independent indeed (I ended up on support for ForwardRef (forward references) #234 after googling "python typing ForwardRef")
I use Python 3.7.3 and yet have no such thing as ForwardRef in the typing module ? I'm completely unaware of type annotation's internals, but is that solution still relevant ?
Since the first solution works like a charm, I'll be suggesting a PR which emphasizes on it and updates the example
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4