Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging a sublcass Structured Config that adds a field fails #291

Closed
omry opened this issue Jul 12, 2020 · 0 comments · Fixed by #292
Closed

Merging a sublcass Structured Config that adds a field fails #291

omry opened this issue Jul 12, 2020 · 0 comments · Fixed by #292
Assignees
Labels
bug Something isn't working

Comments

@omry
Copy link
Owner

omry commented Jul 12, 2020

from dataclasses import dataclass
from omegaconf import OmegaConf, MISSING

@dataclass
class DBConfig:
    host: str = "localhost"
    port: int = MISSING
    driver: str = MISSING

@dataclass
class PostGreSQLConfig(DBConfig):
    driver: str = "postgresql"
    port: int = 5432
    timeout: int = 10

assert OmegaConf.merge(DBConfig, PostGreSQLConfig) == PostGreSQLConfig

Result:

omegaconf.errors.ConfigKeyError: Key 'timeout' not in 'DBConfig'
        full_key: timeout
        reference_type=Optional[DBConfig]
        object_type=DBConfig
@omry omry added the bug Something isn't working label Jul 12, 2020
@omry omry self-assigned this Jul 12, 2020
@omry omry closed this as completed in #292 Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant