Packages

package gen

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. gen
  2. DeriveGenInstances
  3. GenerateConfig
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. trait DeriveGenInstances extends AnyRef

    DeriveGenInstances gives instance for DeriveGen for all the types that zio-config supports.

    DeriveGenInstances gives instance for DeriveGen for all the types that zio-config supports. It will also make sure the randomness for these types is constrained to produce an almost valid config for the users.

  2. trait GenerateConfig extends AnyRef
  3. implicit class UnsafeRunOps[E, A] extends AnyRef
    Definition Classes
    GenerateConfig

Value Members

  1. implicit def deriveGenBigDecimal: DeriveGen[BigDecimal]
    Definition Classes
    DeriveGenInstances
  2. implicit def deriveGenBigInt: DeriveGen[BigInt]
    Definition Classes
    DeriveGenInstances
  3. implicit def deriveGenByte: DeriveGen[Byte]
    Definition Classes
    DeriveGenInstances
  4. implicit def deriveGenDouble: DeriveGen[Double]
    Definition Classes
    DeriveGenInstances
  5. implicit def deriveGenDuration: DeriveGen[Duration]
    Definition Classes
    DeriveGenInstances
  6. implicit def deriveGenFile: DeriveGen[File]
    Definition Classes
    DeriveGenInstances
  7. implicit def deriveGenFloat: DeriveGen[Float]
    Definition Classes
    DeriveGenInstances
  8. implicit def deriveGenInstant: DeriveGen[Instant]
    Definition Classes
    DeriveGenInstances
  9. implicit def deriveGenInt: DeriveGen[Int]
    Definition Classes
    DeriveGenInstances
  10. implicit def deriveGenJavaFilePath: DeriveGen[Path]
    Definition Classes
    DeriveGenInstances
  11. implicit def deriveGenList[A](implicit arg0: DeriveGen[A]): DeriveGen[List[A]]
    Definition Classes
    DeriveGenInstances
  12. implicit def deriveGenLocalDate: DeriveGen[LocalDate]
    Definition Classes
    DeriveGenInstances
  13. implicit def deriveGenLong: DeriveGen[Long]
    Definition Classes
    DeriveGenInstances
  14. implicit def deriveGenMap[A, B](implicit arg0: DeriveGen[A], arg1: DeriveGen[B]): DeriveGen[Map[A, B]]
    Definition Classes
    DeriveGenInstances
  15. implicit def deriveGenShort: DeriveGen[Short]
    Definition Classes
    DeriveGenInstances
  16. implicit def deriveGenString: DeriveGen[String]
    Definition Classes
    DeriveGenInstances
  17. implicit def deriveGenURI: DeriveGen[URI]
    Definition Classes
    DeriveGenInstances
  18. implicit def deriveGenURL: DeriveGen[URL]
    Definition Classes
    DeriveGenInstances
  19. implicit def deriveGenUUID: DeriveGen[UUID]
    Definition Classes
    DeriveGenInstances
  20. implicit def deriveGenZioDuration: DeriveGen[Duration]
    Definition Classes
    DeriveGenInstances
  21. def generateConfig[A](config: config.ConfigDescriptor[A], size: Int = 0)(implicit arg0: DeriveGen[A]): ZStream[Random with Sized with Clock, String, PropertyTree[String, String]]

    Generate an almost valid PropertyTree given a ConfigDescriptor[A] and DeriveGen[A].

    Generate an almost valid PropertyTree given a ConfigDescriptor[A] and DeriveGen[A].

    Note that DeriveGen[A] is going to be available only if all the fields in A (if A is a case class) has an instance of DeriveGen.

    Most of the zio-config supported types has DeriveGen instances are already provided

    Example:

    sealed trait Region
    
     @name("ap-southeast")
     case object ApSouthEast2 extends Region
    
     @name("usEast")
     case object UsEast extends Region
    
     final case class Database(port: Int, url: java.net.URL)
     final case class MyConfig(region: Region, database: Database)
    
     val result =
       generateConfig(descriptor[MyConfig], 2).unsafeRunChunk
    
     println(result)
    
     // yield
    
     Chunk(
       Record(
           Map(
             region -> Leaf(ap-southeast),
             database -> Record(Map(port -> Leaf(4220), url -> Leaf(https://def))))
           ),
         Record(
           Map(region -> Leaf(usEast2),
           database -> Record(Map(port -> Leaf(5572), url -> Leaf(https://abc)))))
         )

    Note that this is based on ConfigDescriptor and not a direct view of a case class/sealed-trait. This is why you get almost a valid Json. If your entire config is statically represented (meaning, no custom transformation especially using transformOrFail or transform, with maximised usage of sealed traits instead of values that are known only at runtime), then the correctness increases in the emitted value. This is because zio-config would know the behaviour of your Config better, if most of its parts are statically represented.

    That said, we are yet to support refined types, and might fail to generate values because of absence of DeriveGen instance for Refined[A, B]. However, providing explicit DeriveGen instances in program is a solution.

    Also note that the uniqueness in emitted random values is not guaranteed. For this reason you can give appropriate size value and emit as many PropertyTree until all the required scenarios are covered.

    Definition Classes
    GenerateConfig
  22. def generateConfigHoconString[A](config: config.ConfigDescriptor[A], size: Int = 0)(implicit arg0: DeriveGen[A]): ZStream[Random with Sized with Clock, String, String]

    Generate an almost valid configuration in HOCON format given a ConfigDescriptor[A] and DeriveGen[A].

    Generate an almost valid configuration in HOCON format given a ConfigDescriptor[A] and DeriveGen[A].

    Note that DeriveGen[A] is going to be available only if all the fields in A (if A is a case class) has an instance of DeriveGen.

    Most of the zio-config supported types has DeriveGen instances are already provided

    Example:

    sealed trait Region
    
     @name("ap-southeast")
     case object ApSouthEast2 extends Region
    
     @name("usEast")
     case object UsEast extends Region
    
     final case class Database(port: Int, url: java.net.URL)
     final case class MyConfig(region: Region, database: Database)
    
     val result =
       generateConfigHoconString(descriptor[MyConfig], 1).unsafeRunChunk
    
     println(result)

    // yield

    Chunk(
      database {
        port="9427"
        url="file://def"
      }
      region=usEast
    ,
    
      database {
        port="180"
        url="https://def"
      }
      region=ap-southeast
    )

    Note that this is based on ConfigDescriptor and not a direct Json/HOCON view of a case class/sealed-trait. This is why you get almost a valid Json. If your entire config is statically represented (meaning, no custom transformation especially using transformOrFail or transform, with maximised usage of sealed traits instead of values that are known only at runtime), then the correctness increases in the emitted value. This is because zio-config would know the behaviour of your Config better, if most of its parts are statically represented.

    That said, we are yet to support refined types, and might fail to generate values because of absence of DeriveGen instance for Refined[A, B]. However, providing explicit DeriveGen instances in program is a solution.

    Also note that the uniqueness in emitted random values is not guaranteed. For this reason you can give appropriate size value and emit as many PropertyTree until all the required scenarios are covered.

    Definition Classes
    GenerateConfig
  23. def generateConfigJson[A](config: config.ConfigDescriptor[A], size: Int = 0)(implicit arg0: DeriveGen[A]): ZStream[Random with Sized with Clock, String, String]

    Generate an almost valid configuration in Json format given a ConfigDescriptor[A] and DeriveGen[A].

    Generate an almost valid configuration in Json format given a ConfigDescriptor[A] and DeriveGen[A].

    Note that DeriveGen[A] is going to be available only if all the fields in A (if A is a case class) has an instance of DeriveGen.

    Most of the zio-config supported types has DeriveGen instances are already provided

    Example:

    sealed trait Region
    
     @name("ap-southeast")
     case object ApSouthEast2 extends Region
    
     @name("usEast")
     case object UsEast extends Region
    
     final case class Database(port: Int, url: java.net.URL)
     final case class MyConfig(region: Region, database: Database)
    
     val result =
       generateConfigJson(descriptor[MyConfig], 1).unsafeRunChunk
    
     println(result)

    // yield

      Chunk({
        "database" : {
            "port" : "7625",
            "url" : "http://abc"
        },
        "region" : "usEast"
    }
    ,{
        "database" : {
            "port" : "6904",
            "url" : "https://abc"
        },
        "region" : "ap-southeast"
    }
    )

    Note that this is based on the ConfigDescriptor and not a direct Json view of a case class/sealed-trait. This is why you get almost a valid Json. If your entire config is statically represented (meaning, no custom transformation especially using transformOrFail or transform, with maximised usage of sealed traits instead of values that are known only at runtime), then the correctness increases in the emitted value. This is because zio-config would know the behaviour of your Config better, if most of its parts are statically represented.

    That said, we are yet to support refined types, and might fail to generate values because of absence of DeriveGen instance for Refined[A, B]. However, providing explicit DeriveGen instances in program is a solution.

    Also note that the uniqueness in emitted random values is not guaranteed. For this reason you can give appropriate size value and emit as many PropertyTree until all the required scenarios are covered.

    Definition Classes
    GenerateConfig
  24. def generateConfigMap[A](config: config.ConfigDescriptor[A], size: Int, keyDelimiter: String = ".")(implicit arg0: DeriveGen[A]): ZStream[Random with Sized with Clock, String, Map[String, ::[String]]]

    Generate an almost valid configuration in Map format given a ConfigDescriptor[A] and DeriveGen[A].

    Generate an almost valid configuration in Map format given a ConfigDescriptor[A] and DeriveGen[A].

    Note that DeriveGen[A] is going to be available only if all the fields in A (if A is a case class) has an instance of DeriveGen.

    Most of the zio-config supported types has DeriveGen instances are already provided

    Example:

    sealed trait Region
    
     @name("ap-southeast")
     case object ApSouthEast2 extends Region
    
     @name("usEast")
     case object UsEast extends Region
    
     final case class Database(port: Int, url: java.net.URL)
     final case class MyConfig(region: Region, database: Database)
    
     val result =
       generateConfigMap(descriptor[MyConfig], 1).unsafeRunChunk
    
     println(result)

    // yields

    Chunk(
      Map(
       region -> List(ap-southeast),
       database.port -> List(7627),
       database.url -> List(https://def)
     ),
     Map(
       region -> List(usEast),
       database.port -> List(4119), database.url -> List(file://abc)))

    Note that this is based on ConfigDescriptor and not a direct Json/HOCON view of a case class/sealed-trait. This is why you get almost a valid Json. If your entire config is statically represented (meaning, no custom transformation especially using transformOrFail or transform, with maximised usage of sealed traits instead of values that are known only at runtime), then the correctness increases in the emitted value. This is because zio-config would know the behaviour of your Config better, if most of its parts are statically represented.

    That said, we are yet to support refined types, and might fail to generate values because of absence of DeriveGen instance for Refined[A, B]. However, providing explicit DeriveGen instances in program is a solution.

    Also note that the uniqueness in emitted random values is not guaranteed. For this reason you can give appropriate size value and emit as many PropertyTree until all the required scenarios are covered.

    Definition Classes
    GenerateConfig
  25. object GenerateConfig extends GenerateConfig

Inherited from DeriveGenInstances

Inherited from GenerateConfig

Inherited from AnyRef

Inherited from Any

Ungrouped