Closed Jasha10 closed 8 months ago
This PR closes #1005, fixing a bug where a validation error was raised when an interpolation points to a structured config from within a typed list.
from dataclasses import dataclass, field from omegaconf import MISSING, OmegaConf @dataclass class User: name: str = MISSING @dataclass class Config: user: User = User("John") users: list[User] = field(default_factory=lambda: ["${user}"]) cfg = OmegaConf.structured(Config) OmegaConf.resolve(cfg) print(cfg)
$ python repro.py Traceback (most recent call last): ... omegaconf.errors.ValidationError: Invalid type assigned: str is not a subclass of User. value: ${user} full_key: users[0] reference_type=List[User] object_type=list
$ python repro.py {'user': {'name': 'John'}, 'users': [{'name': 'John'}]}
This PR closes #1005, fixing a bug where a validation error was raised when an interpolation points to a structured config from within a typed list.
BEFORE
AFTER