diff --git a/modules/core/src/main/scala-3/tethys/derivation/JsonReaderDerivation.scala b/modules/core/src/main/scala-3/tethys/derivation/JsonReaderDerivation.scala index 707460c..dafe620 100644 --- a/modules/core/src/main/scala-3/tethys/derivation/JsonReaderDerivation.scala +++ b/modules/core/src/main/scala-3/tethys/derivation/JsonReaderDerivation.scala @@ -26,7 +26,8 @@ trait JsonReaderDerivation: inline def derived[A](inline config: ReaderBuilder[A])(using mirror: Mirror.ProductOf[A]): JsonReader[A] = Derivation.deriveJsonReaderForProduct[A](config) - + + @deprecated("Use ReaderBuilder instead") inline def derived[A](inline config: ReaderDerivationConfig)(using mirror: Mirror.ProductOf[A]): JsonReader[A] = Derivation.deriveJsonReaderForProductLegacy[A](config) diff --git a/modules/macro-derivation/src/test/scala-3/tethys/derivation/SemiautoWriterDerivationTest.scala b/modules/macro-derivation/src/test/scala-3/tethys/derivation/SemiautoWriterDerivationTest.scala index 31e5493..bbe39f5 100644 --- a/modules/macro-derivation/src/test/scala-3/tethys/derivation/SemiautoWriterDerivationTest.scala +++ b/modules/macro-derivation/src/test/scala-3/tethys/derivation/SemiautoWriterDerivationTest.scala @@ -15,7 +15,7 @@ import tethys.writers.tokens.SimpleTokenWriter class SemiautoWriterDerivationTest extends AnyFlatSpec with Matchers { behavior of "semiauto derivation" - it should "generate proper writer from WriterDescription" in { + it should "generate proper writer from WriterBuilder" in { def freeVariable: String = "e" implicit val dWriter: JsonWriter[D] = jsonWriter[D](WriterBuilder[D].fieldStyle(FieldStyle.UpperCase)) @@ -37,6 +37,27 @@ class SemiautoWriterDerivationTest extends AnyFlatSpec with Matchers { ) } + it should "generate proper writer from WriterDerivationConfig" in { + def freeVariable: String = "e" + + implicit val dWriter: JsonWriter[D] = jsonWriter[D]( + WriterDerivationConfig.withFieldStyle(tethys.derivation.builder.FieldStyle.uppercase) + ) + + implicit val testWriter: JsonWriter[JsonTreeTestData] = jsonWriter { + WriterDerivationConfig.withFieldStyle(FieldStyle.UpperCase) + } + JsonTreeTestData(5, b = false, C(D(1))).asTokenList shouldBe obj( + "A" -> 5, + "B" -> false, + "C" -> obj( + "d" -> obj( + "A" -> 1 + ) + ) + ) + } + it should "derive writer for update partial" in { implicit val partialWriter: JsonWriter[D] = jsonWriter { WriterBuilder[D]