All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zio.schema.SchemaPlatformSpecific.scala Maven / Gradle / Ivy

package zio.schema

trait SchemaPlatformSpecific {

  implicit val url: Schema[java.net.URL] =
    Schema[String].transformOrFail(
      string =>
        try {
          Right(new java.net.URI(string).toURL)
        } catch { case _: Exception => Left(s"Invalid URL: $string") },
      url => Right(url.toString)
    )

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy