what if you wanted to require some hash keys *and* keep extra keys?

How would one formulate a hash schema that requires a certain set of keys (and presumably type-tests and/or coerces them) but also doesn’t drop unspecified keys?

Imagine I have a config file, let’s say it’s YAML (the format is not important).

sources:
  -
    driver: Foo
    param1: bar
    param2: something else
targets:
  named1:
    driver: FileSystem
    dir: /var/lib/whatever

I am looking for how to do some Types::Hash declaration that will:

  • convert the keys to symbols (plus .downcase.tr_s('_- ', ?_))
  • stipulate a driver key with type
  • not throw out the other keys.

I can’t tell how to do that in the docs.

Furthermore:

  • it seems that I can do Hash.map(KeyType, ValType) but not combine that with .schema
  • if I do Hash.schema({}).with_key_transform &proc and try to extend that, it throws out the other keys.