Skip to content

Commit

Permalink
feature: add toDynamic helper method (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharmath authored Aug 14, 2022
1 parent 862b8c2 commit 63de037
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions zio-schema/shared/src/main/scala/zio/schema/Schema.scala
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ object Schema extends SchemaEquality {
def semiDynamic[A](defaultValue: Either[String, (A, Schema[A])] = Left("no default value")): Schema[(A, Schema[A])] =
Schema.SemiDynamic(defaultValue)

def toDynamic[A](a: A)(implicit schema: Schema[A]): DynamicValue = schema.toDynamic(a)

implicit def right[B](implicit schemaB: Schema[B]): Schema[Right[Nothing, B]] =
either[Nothing, B](Schema.fail[Nothing]("no schema for Left"), schemaB)
.transformOrFail[Right[Nothing, B]](
Expand Down

0 comments on commit 63de037

Please sign in to comment.