Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure zio-config doesn't support values as list without proper in…
…dexing (#1086) * Avoid scala-2.11 for all projects * Remove all fix checks * Add snapshot releases * Make sure fatal warnings exist for local development * Generate docs test * Avoid splitting values for Indexed configs * Make sure to fail if index is absent, and try to keep the order of list * Reformat all code * Allow keys to be present and allow empty list * Reformat examples
- Loading branch information
Showing
19 changed files
with
127 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
examples/shared/src/main/scala/zio/config/examples/typesafe/SealedTraitListExample.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package zio.config.examples.typesafe | ||
|
||
import zio.ConfigProvider | ||
import zio.config.derivation.nameWithLabel | ||
import zio.config._, typesafe._, magnolia._ | ||
|
||
object SealedTraitListExample extends App { | ||
|
||
@nameWithLabel | ||
sealed trait DataTransformation | ||
|
||
case class CastColumns(dataTypeMapper: Map[String, String]) extends DataTransformation | ||
|
||
case class TransformationRules(transformations: List[DataTransformation]) | ||
|
||
val transformations = | ||
s""" | ||
|transformations = [ | ||
| { | ||
| type = "CastColumns" | ||
| dataTypeMapper = { | ||
| "col_A" = "string" | ||
| "col_B" = "double" | ||
| "col_C" = "decimal(19,2)" | ||
| } | ||
| } | ||
| ] | ||
|""".stripMargin | ||
|
||
val pgm = ConfigProvider.fromHoconString(transformations).load(deriveConfig[TransformationRules]) | ||
|
||
pgm equalM (TransformationRules( | ||
List(CastColumns(Map("col_C" -> "decimal(19,2)", "col_B" -> "double", "col_A" -> "string"))) | ||
)) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...c/main/scala/zio/config/xml/Parsers.scala → ...zio/config/xml/experimental/Parsers.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...la/zio/config/xml/XmlConfigProvider.scala → .../xml/experimental/XmlConfigProvider.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...main/scala/zio/config/xml/XmlObject.scala → ...o/config/xml/experimental/XmlObject.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...main/scala/zio/config/xml/XmlParser.scala → ...o/config/xml/experimental/XmlParser.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...c/main/scala/zio/config/xml/package.scala → ...zio/config/xml/experimental/package.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
xml/shared/src/test/scala/zio/config/yaml/XmlProviderSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
xml/shared/src/test/scala/zio/config/yaml/generators/WhiteSpacedAttributes.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
xml/shared/src/test/scala/zio/config/yaml/generators/WhiteSpacedText.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.