How does a Config Descriptor look for a Map with ZIO Config / Magnolia

586 views Asked by At

I have the following Case Class:

case class MyClass(name: String, params: Map[String, String])

I couldn't figure out how to create a Config Description for this. Also automatic derivation with Magnolia did not work.

Error:(70, 44) could not find implicit value for evidence parameter of type zio.config.magnolia.ConfigDescriptorProvider[zio.config.examples.MyConfig.MyClass]
  private val automaticConfig = description[MyClass]

With a list of Tuples automatic Derivation works (but still no idea how the Config Description for this).

final case class MyClass(name: String, params: List[(String, String)])

Is this a restriction? I also couldn't find an example.

1

There are 1 answers

0
Afsal Thaj On BEST ANSWER

As of now zio-config cannot handle if the value of a key is a map. zio-config considererd this as nested configuration (which it can handle quite elegantly) and de-prioritised the feature of having to handle dynamic map.

However, we will considering this as a higher priority, as it turns out there are many usecase that falls into this category and will be included in 1.0.0-RC11, planning to get released by 25th of Jan.

I know this doesn't solve your immediate problem, sorry about that.