Describe the bug
I have a dataclass config and want to convert it into a YAML representation via OmegaConf, but it raises a ValidationError since I use forward reference in the list.
Here is the simplified version of my code:
from dataclasses import dataclass
from omegaconf import OmegaConf
from typing import Optional
@dataclass
class Tree:
value: int = -1
children: Optional[list["Tree"]] = None
mytree = Tree(value=1, children=[Tree(value=2)])
config = OmegaConf.structured(mytree)
print(config)
Describe the bug I have a dataclass config and want to convert it into a YAML representation via OmegaConf, but it raises a ValidationError since I use forward reference in the list. Here is the simplified version of my code:
Expected behavior Output
{'value': 1, 'children': [{'value': 2, 'children': None}]}
, no errorActual behavior
I believe this is a bug since the following very similar code produces an expected result:
Additional context
5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64 GNU/Linux