izumi.distage.config.codec
Members list
Type members
Classlikes
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- trait DIConfigReader[A]
Config reader that uses a pureconfig.ConfigReader implicit instance for a type to decode it from Typesafe Config.
Config reader that uses a pureconfig.ConfigReader implicit instance for a type to decode it from Typesafe Config.
Always automatically derives a codec if it's not available.
Automatic derivation will use camelCase
fields, NOT kebab-case
fields,
as in default pureconfig. It also overrides pureconfig's default type
field
type discriminator for sealed traits, instead using a circe
-like format with a single-key object.
Example:
sealed trait AorB
final case class A(a: Int) extends AorB
final case class B(b: String) extends AorB
final case class Config(values: List[AorB])
In config:
config {
values = [
{ A { a = 123 } },
{ B { b = cba } }
]
}
Auto-derivation will work without importing pureconfig.generic.auto._
and without any other imports
You may use izumi.distage.config.codec.PureconfigAutoDerive f you want to use DIConfigReader
's deriving strategy to derive a standalone pureconfig
codec:
final case class Abc(a: Duration, b: Regex, c: URL)
object Abc {
implicit val configReader: pureconfig.ConfigReader[Abc] =
PureconfigAutoDerive[Abc]
}
Attributes
- Companion:
- object
- Graph
- Supertypes
Attributes
- Companion:
- trait
- Graph
- Supertypes
- Self type
- DIConfigReader.type
Attributes
- Graph
- Supertypes
- Self type
- DIConfigReaderImpl.type
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Derive pureconfig.ConfigReader
for A and for its fields recursively with pureconfig-magnolia
Derive pureconfig.ConfigReader
for A and for its fields recursively with pureconfig-magnolia
This differs from just using pureconfig.module.magnolia.auto.reader.exportReader by using different configuration, defined in PureconfigInstances, specifically:
- Field name remapping is disabled,
camelCase
fields will remain camelCase, notkebab-case
- Sealed traits are rendered as in
circe
, using a wrapper object with a single field, instead of using atype
field. Example:
sealed trait AorB
final case class A(a: Int) extends AorB
final case class B(b: String) extends AorB
final case class Config(values: List[AorB])
in config:
config {
values = [
{ A { a = 123 } },
{ B { b = cba } }
]
}
Attributes
- Companion:
- object
- Graph
- Supertypes
- class AnyValtrait Matchableclass Any
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- PureconfigAutoDerive.type
Attributes
- Companion:
- object
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- object PureconfigInstances.type
Attributes
- Companion:
- trait
- Graph
- Supertypes
- Self type
- PureconfigInstances.type