You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a value a: A and a schema: Schema[A] if we convert it to dynamic value and back:
schema.fromDynamic(schema.toDynamic(a)))
we get back the same value a. This property is verified by tests and it is true for all the supported cases.
However if we serialize the schema and read it back:
scala
val schemaAst = schema.ast
val schema2 = schemaAst.toSchema
and try to materialize the dynamic value with schema2, simulating that the value and its schema was sent to another process,
the property is no longer true for all cases:
Records and enums are materialized as generic ListMap[String, _] values which is expected
However we also loose the structure of tuples!
higher arity tuples are converted back to a nested representation (A, B, C) becomes ((A, B), C)
I think for tuples we should be able to reconstruct the original tuple arity in this case.
The text was updated successfully, but these errors were encountered:
vigoo
added a commit
to vigoo/zio-schema
that referenced
this issue
Sep 25, 2022
The simple round-trip test for DynamicValue:
Given a value
a: A
and aschema: Schema[A]
if we convert it to dynamic value and back:we get back the same value
a
. This property is verified by tests and it is true for all the supported cases.However if we serialize the schema and read it back:
scala
and try to materialize the dynamic value with
schema2
, simulating that the value and its schema was sent to another process,the property is no longer true for all cases:
ListMap[String, _]
values which is expected(A, B, C)
becomes((A, B), C)
I think for tuples we should be able to reconstruct the original tuple arity in this case.
The text was updated successfully, but these errors were encountered: