Skip to content
This repository was archived by the owner on Aug 17, 2022. It is now read-only.
This repository was archived by the owner on Aug 17, 2022. It is now read-only.

feature: assertion of exhaustive mapping for ArbitraryTypeReader #13

@frohoff

Description

@frohoff

I would be helpful if ArbitraryTypeReader offered a mode/setting that adds a runtime check that all keys for a Config object were mapped into the instantiation parameters successfully and that no keys were left un-mapped after instantiation. Current behavior silently ignores Config keys that don't match a parameter when that parameter is optional (Option or default value), allowing simple typo bugs that could be caught at instantiation time to slip into runtime.

Example:

case class Test(foo: String = "foo", bar: Option[String])

val cfg = ConfigFactory.parseString("""
    test {
        fooTypo: overrideFoo
        barTypo: overrideBar
    }
    """)                                            

val test = cfg.as[Test]("test")  
//> test  : worksheet.Test = Test(foo,None)
// note default values are not overridden

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions