zio-schema
zio-schema copied to clipboard
Unable to convert to TypedValue
If the schema is rebuilt from the AST, it doesn't correctly convert a dynamic value back to a typed value. This is specifically happening with records.
import zio.schema._
final case class User(name: String, age: Int)
implicit val schema = DeriveSchema.gen[User]
val user = User("John", 30)
val userDynamic = schema.toDynamic(user)
println(userDynamic)
println(userDynamic.toTypedValue(schema))
println(userDynamic.toTypedValue(schema.ast.toSchema))
https://scastie.scala-lang.org/TJmOjesrS5KY5ZYHOwJTUg