Skip to content

Commit

Permalink
Updated ZIO 2 branch (#307)
Browse files Browse the repository at this point in the history
* Support ZIO 2.x (#149)

* Run scalafix ZIO 2 migration

* Get core project compiling

* Get Optics to compile and pass tests

* Get protobuf to compile and pass tests

* Run `sbt prepare`

* Remove unused reference to zio-nio in BuildHelper.scala

* Update to ZIO 2.0.0-RC1

* Update zio-schema-json and examples to ZIO 2

* Update dependency ch.epfl.scala:sbt-scalafix to v0.9.33 (#98)

Co-authored-by: Renovate Bot <[email protected]>

* Capture annotations on Enums and all cases (#167)

* Capture annotations on Enums and all cases

* Linting

* Update dependency com.github.ghik:silencer-lib to v1.7.7 (#123)

Co-authored-by: Renovate Bot <[email protected]>

* Upgrade zio-json to 0.3.0-RC1-1

* Update zio-prelude and zio-optics versions to ZIO-2 releases and address Adam's PR feedback

* Last bit of PR cleanup

* Fix linter error

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Dan Harris <[email protected]>

* Update ZIO2 branch to latest main (#216)

* Update dependency ch.epfl.scala:sbt-scalafix to v0.9.33 (#98)

Co-authored-by: Renovate Bot <[email protected]>

* Capture annotations on Enums and all cases (#167)

* Capture annotations on Enums and all cases

* Linting

* Update dependency com.github.ghik:silencer-lib to v1.7.7 (#123)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency org.scalameta:sbt-scalafmt to v2.4.5 (#154)

Co-authored-by: Renovate Bot <[email protected]>

* Add schema for DynamicValue (#170)

* Add Schema for DynamicValue

* Rename some of StandardType values

* Fix type casting

* Fix linting issues

Run `prepare` on the whole project

* Support native schema for Set #139 (#173)

* Support native schema for Set

* added Diff support for SetSchema

* removed dead code

* attempt to fix scala 2.13 match may not be exhaustive compile error

* added SetSchema support

* updated docs to mention zio-dynamoDB as a client

* More property based tests for map and set (#178)

* added more property based tests for Map

* added more property based tests for Set

* Diff refactor (#176)

* Diff refactor

Refactor diff. There are two main goals:

1. Add type parameter to `Dff`. This solves an otherwise very nasty issue in the Scala 3 support.

2. Use Least Common Subsequence (LCS aka Myers Diff) for all sequence diffs. This simplifies things a lot of unifies all collection diffs under a single, principled algorithm.

* Linter fixes

* Fix 2.12 build issue

* Move LCSDiff to Differ companion object

* Make LCSDiff package private

* Linting

Co-authored-by: John A. De Goes <[email protected]>

* Update dependency org.scala-native:sbt-scala-native to v0.4.3 (#180)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency org.scalameta:sbt-mdoc to v2.3.0 (#181)

Co-authored-by: Renovate Bot <[email protected]>

* Thrift (#163)

* thrift

* all tests passing

* uncommented benchmarks

* sets

* removed not implemented methods

* map

* fixes

* formatting

* small fixes

* fixes

* fixes

* failure decoding

* path as first param

* Fix compile errors for Scala 2.12

* code review

* thrift optionals

* scalafmt + compilation warnings

* removed JavaConverters

* removed JavaConverters

* scalafmt

* scalafix

* scalafix test

Co-authored-by: Dan Harris <[email protected]>
Co-authored-by: Dan Harris <[email protected]>

* Fix bug in enum schema derivation (#191)

* Unify schema of Either/Left/Right (#204)

* Update dependency org.xerial.sbt:sbt-sonatype to v3.9.12 (#186)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency org.scala-js:sbt-scalajs to v1.9.0 (#190)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency com.eed3si9n:sbt-buildinfo to v0.11.0 (#199)

Co-authored-by: Renovate Bot <[email protected]>

* Equality implementation for Schema (#206)

* Equality implementation for Schema

* Import order fix

* Improve equality of Sequence

* Fix equality, recursion, migration

* Fix warning

* Run fix

* Manually fix scalafix result

* preserve annotations when calling toRecord on a Tuple: fixes #212 (#213)

* preserve annotations when calling toRecord on a Tuple: fixes #212

* apply scalafixAll

* Format

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Dan Harris <[email protected]>
Co-authored-by: Ivan Grebenik <[email protected]>
Co-authored-by: Avinder Bahra <[email protected]>
Co-authored-by: Avinder Bahra <[email protected]>
Co-authored-by: John A. De Goes <[email protected]>
Co-authored-by: František Kocun <[email protected]>
Co-authored-by: Dan Harris <[email protected]>
Co-authored-by: Tobias Pfeifer <[email protected]>

* ZIO2 latest update from main (#222)

* Update dependency ch.epfl.scala:sbt-scalafix to v0.9.33 (#98)

Co-authored-by: Renovate Bot <[email protected]>

* Capture annotations on Enums and all cases (#167)

* Capture annotations on Enums and all cases

* Linting

* Update dependency com.github.ghik:silencer-lib to v1.7.7 (#123)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency org.scalameta:sbt-scalafmt to v2.4.5 (#154)

Co-authored-by: Renovate Bot <[email protected]>

* Add schema for DynamicValue (#170)

* Add Schema for DynamicValue

* Rename some of StandardType values

* Fix type casting

* Fix linting issues

Run `prepare` on the whole project

* Support native schema for Set #139 (#173)

* Support native schema for Set

* added Diff support for SetSchema

* removed dead code

* attempt to fix scala 2.13 match may not be exhaustive compile error

* added SetSchema support

* updated docs to mention zio-dynamoDB as a client

* More property based tests for map and set (#178)

* added more property based tests for Map

* added more property based tests for Set

* Diff refactor (#176)

* Diff refactor

Refactor diff. There are two main goals:

1. Add type parameter to `Dff`. This solves an otherwise very nasty issue in the Scala 3 support.

2. Use Least Common Subsequence (LCS aka Myers Diff) for all sequence diffs. This simplifies things a lot of unifies all collection diffs under a single, principled algorithm.

* Linter fixes

* Fix 2.12 build issue

* Move LCSDiff to Differ companion object

* Make LCSDiff package private

* Linting

Co-authored-by: John A. De Goes <[email protected]>

* Update dependency org.scala-native:sbt-scala-native to v0.4.3 (#180)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency org.scalameta:sbt-mdoc to v2.3.0 (#181)

Co-authored-by: Renovate Bot <[email protected]>

* Thrift (#163)

* thrift

* all tests passing

* uncommented benchmarks

* sets

* removed not implemented methods

* map

* fixes

* formatting

* small fixes

* fixes

* fixes

* failure decoding

* path as first param

* Fix compile errors for Scala 2.12

* code review

* thrift optionals

* scalafmt + compilation warnings

* removed JavaConverters

* removed JavaConverters

* scalafmt

* scalafix

* scalafix test

Co-authored-by: Dan Harris <[email protected]>
Co-authored-by: Dan Harris <[email protected]>

* Fix bug in enum schema derivation (#191)

* Unify schema of Either/Left/Right (#204)

* Update dependency org.xerial.sbt:sbt-sonatype to v3.9.12 (#186)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency org.scala-js:sbt-scalajs to v1.9.0 (#190)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency com.eed3si9n:sbt-buildinfo to v0.11.0 (#199)

Co-authored-by: Renovate Bot <[email protected]>

* Equality implementation for Schema (#206)

* Equality implementation for Schema

* Import order fix

* Improve equality of Sequence

* Fix equality, recursion, migration

* Fix warning

* Run fix

* Manually fix scalafix result

* preserve annotations when calling toRecord on a Tuple: fixes #212 (#213)

* preserve annotations when calling toRecord on a Tuple: fixes #212

* apply scalafixAll

* Add special encoding for List and Map types in SchemaAst (#220)

* Add special encoding for List and Map types in SchemaAst

* revert build config chnage

* preserve optional flag

* Fix

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Dan Harris <[email protected]>
Co-authored-by: Ivan Grebenik <[email protected]>
Co-authored-by: Avinder Bahra <[email protected]>
Co-authored-by: Avinder Bahra <[email protected]>
Co-authored-by: John A. De Goes <[email protected]>
Co-authored-by: František Kocun <[email protected]>
Co-authored-by: Dan Harris <[email protected]>
Co-authored-by: Tobias Pfeifer <[email protected]>

* Dynamic and SemiDynamic schemas ZIO 2 version (#219)

* Update dependency ch.epfl.scala:sbt-scalafix to v0.9.33 (#98)

Co-authored-by: Renovate Bot <[email protected]>

* Capture annotations on Enums and all cases (#167)

* Capture annotations on Enums and all cases

* Linting

* Update dependency com.github.ghik:silencer-lib to v1.7.7 (#123)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency org.scalameta:sbt-scalafmt to v2.4.5 (#154)

Co-authored-by: Renovate Bot <[email protected]>

* Add schema for DynamicValue (#170)

* Add Schema for DynamicValue

* Rename some of StandardType values

* Fix type casting

* Fix linting issues

Run `prepare` on the whole project

* Support native schema for Set #139 (#173)

* Support native schema for Set

* added Diff support for SetSchema

* removed dead code

* attempt to fix scala 2.13 match may not be exhaustive compile error

* added SetSchema support

* updated docs to mention zio-dynamoDB as a client

* More property based tests for map and set (#178)

* added more property based tests for Map

* added more property based tests for Set

* Diff refactor (#176)

* Diff refactor

Refactor diff. There are two main goals:

1. Add type parameter to `Dff`. This solves an otherwise very nasty issue in the Scala 3 support.

2. Use Least Common Subsequence (LCS aka Myers Diff) for all sequence diffs. This simplifies things a lot of unifies all collection diffs under a single, principled algorithm.

* Linter fixes

* Fix 2.12 build issue

* Move LCSDiff to Differ companion object

* Make LCSDiff package private

* Linting

Co-authored-by: John A. De Goes <[email protected]>

* Update dependency org.scala-native:sbt-scala-native to v0.4.3 (#180)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency org.scalameta:sbt-mdoc to v2.3.0 (#181)

Co-authored-by: Renovate Bot <[email protected]>

* Thrift (#163)

* thrift

* all tests passing

* uncommented benchmarks

* sets

* removed not implemented methods

* map

* fixes

* formatting

* small fixes

* fixes

* fixes

* failure decoding

* path as first param

* Fix compile errors for Scala 2.12

* code review

* thrift optionals

* scalafmt + compilation warnings

* removed JavaConverters

* removed JavaConverters

* scalafmt

* scalafix

* scalafix test

Co-authored-by: Dan Harris <[email protected]>
Co-authored-by: Dan Harris <[email protected]>

* Fix bug in enum schema derivation (#191)

* Dynamic and SemiDynamic schemas

* Unify schema of Either/Left/Right (#204)

* DeriveGen

* JsonCodec

* Fix semiDynamicEncoder

* Fixes

* Update dependency org.xerial.sbt:sbt-sonatype to v3.9.12 (#186)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency org.scala-js:sbt-scalajs to v1.9.0 (#190)

Co-authored-by: Renovate Bot <[email protected]>

* Update dependency com.eed3si9n:sbt-buildinfo to v0.11.0 (#199)

Co-authored-by: Renovate Bot <[email protected]>

* Equality implementation for Schema (#206)

* Equality implementation for Schema

* Import order fix

* Improve equality of Sequence

* Fix equality, recursion, migration

* Fix warning

* Run fix

* Manually fix scalafix result

* Json codec works

* BigInt, BigDecimal support for protobuf

* Fix protobuf semi dynamic record test

* Various thrift codec fixes

* SemiDynamic support for thrift

* Fix some warnings

* Fix more warnings

* Fix compilation on 2.12

* scalafix

* format

* preserve annotations when calling toRecord on a Tuple: fixes #212 (#213)

* preserve annotations when calling toRecord on a Tuple: fixes #212

* apply scalafixAll

* Reproducer for schema ast materialization problem

* Format

* Finish todo items

* Fix bug in AST (#223)

* Fix bug in AST

* Remove unused import

* Unused import

* deprecate testM abd checM

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Dan Harris <[email protected]>
Co-authored-by: Ivan Grebenik <[email protected]>
Co-authored-by: Avinder Bahra <[email protected]>
Co-authored-by: Avinder Bahra <[email protected]>
Co-authored-by: John A. De Goes <[email protected]>
Co-authored-by: František Kocun <[email protected]>
Co-authored-by: Dan Harris <[email protected]>
Co-authored-by: Tobias Pfeifer <[email protected]>

* Remove DynamicValue.Transform (#227)

* Support for ZIO2-RC3 (#230)

* Upgrade to ZIO2 RC2

* Update to ZIO2 RC3

* Upgrade zio-json snapshot version for ZIO2-RC3

* Fix string encoding compilation error

* Try to get timeouts sorted

* Upgrade To ZIO 2.0.0-RC4 (#234)

* upgrade zio version

* remove unused import

* ZIO 2.0.0-RC5 (#238)

* Upgrade to ZIO 2.0.0-RC6 (#245)

* Upgrade to ZIO 2.0.0-RC6

* Convert error to string

* Fix schema derivation test

* Migrate test

* Switch to ZPipeline.utf8Decode

* Fix JSON decode

* fix and format

Co-authored-by: Daniel Vigovszky <[email protected]>

* Fix protobuf semidynamic encoding/decoding (#266)

* Remove Left/Right/None/Nil implicit schemas (#279)

* Fix for DynamicValue.Record field order mixed up by serialization  (#284)

* Reproducer for Dynamic Record field order issue

* Fix

* Update to ZIO 2.0.0 final (#290)

* feature: add `toTypedPrimitive` operator to `StandardType` (#300)

* feature: add `toTypedPrimitive` operator to StandardType

* chore: update style

* Fix

* Fixes

* Settings fix

* Fix build helper

* Scala 3 fixes

* Thrift codec Scala3 fixes

* Scala3 fix

* More Scala3 fix

* Copied memory settings from zio/zio

* Trying other memory settings

* More fixes

* Force rebuild

* Make AvroCodec Scala 2.12 compatible

* ScalaFix

* ZIO 2.0.1

* Disable parallel execution on CI

* Do not fork tests

Co-authored-by: Alexander van Olst <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Dan Harris <[email protected]>
Co-authored-by: Ivan Grebenik <[email protected]>
Co-authored-by: Avinder Bahra <[email protected]>
Co-authored-by: Avinder Bahra <[email protected]>
Co-authored-by: John A. De Goes <[email protected]>
Co-authored-by: František Kocun <[email protected]>
Co-authored-by: Dan Harris <[email protected]>
Co-authored-by: Tobias Pfeifer <[email protected]>
Co-authored-by: Adam Fraser <[email protected]>
Co-authored-by: Denis <[email protected]>
Co-authored-by: Albert Pető <[email protected]>
Co-authored-by: Tushar Mathur <[email protected]>
  • Loading branch information
16 people authored Aug 19, 2022
1 parent 7ef9825 commit 184e045
Show file tree
Hide file tree
Showing 51 changed files with 3,751 additions and 3,957 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: CI

env:
JDK_JAVA_OPTIONS: -XX:+PrintCommandLineFlags -Xmx6G -Xss4M -XX:+UseG1GC # JDK_JAVA_OPTIONS is _the_ env. variable to use for modern Java
JVM_OPTS: -XX:+PrintCommandLineFlags -Xmx6G -Xss4M -XX:+UseG1GC # for Java 8 only (sadly, it is not modern enough for JDK_JAVA_OPTIONS)
NODE_OPTIONS: --max_old_space_size=6144

on:
pull_request:
push:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import zio.{BootstrapRuntime, Chunk}
import zio.internal.{Platform, Tracing}
import zio.schema.{DeriveSchema, Schema}

import scala.util.Random

object CodecBenchmarks {

val TracedRuntime: BootstrapRuntime = new BootstrapRuntime {
Expand Down
9 changes: 0 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ lazy val testsJS = tests.js
.settings(scalaJSUseMainModuleInitializer := true)

lazy val testsJVM = tests.jvm
.settings(Test / fork := true)

lazy val zioSchemaMacros = crossProject(JSPlatform, JVMPlatform)
.in(file("zio-schema-macros"))
Expand Down Expand Up @@ -116,7 +115,6 @@ lazy val zioSchemaJS = zioSchema.js
.settings(scalaJSUseMainModuleInitializer := true)

lazy val zioSchemaJVM = zioSchema.jvm
.settings(Test / fork := true)

lazy val zioSchemaDerivation = crossProject(JSPlatform, JVMPlatform)
.in(file("zio-schema-derivation"))
Expand Down Expand Up @@ -148,7 +146,6 @@ lazy val zioSchemaDerivationJS = zioSchemaDerivation.js
.settings(scalaJSUseMainModuleInitializer := true)

lazy val zioSchemaDerivationJVM = zioSchemaDerivation.jvm
.settings(Test / fork := true)

lazy val zioSchemaJson = crossProject(JSPlatform, JVMPlatform)
.in(file("zio-schema-json"))
Expand All @@ -166,7 +163,6 @@ lazy val zioSchemaJsonJS = zioSchemaJson.js
.settings(scalaJSUseMainModuleInitializer := true)

lazy val zioSchemaJsonJVM = zioSchemaJson.jvm
.settings(Test / fork := true)

lazy val zioSchemaProtobuf = crossProject(JSPlatform, JVMPlatform)
.in(file("zio-schema-protobuf"))
Expand All @@ -180,7 +176,6 @@ lazy val zioSchemaProtobufJS = zioSchemaProtobuf.js
.settings(scalaJSUseMainModuleInitializer := true)

lazy val zioSchemaProtobufJVM = zioSchemaProtobuf.jvm
.settings(Test / fork := true)

lazy val zioSchemaThrift = crossProject(JSPlatform, JVMPlatform)
.in(file("zio-schema-thrift"))
Expand All @@ -199,7 +194,6 @@ lazy val zioSchemaThriftJS = zioSchemaThrift.js
.settings(scalaJSUseMainModuleInitializer := true)

lazy val zioSchemaThriftJVM = zioSchemaThrift.jvm
.settings(Test / fork := true)

lazy val zioSchemaAvro = crossProject(JSPlatform, JVMPlatform)
.in(file("zio-schema-avro"))
Expand All @@ -218,7 +212,6 @@ lazy val zioSchemaAvroJS = zioSchemaAvro.js
.settings(scalaJSUseMainModuleInitializer := true)

lazy val zioSchemaAvroJVM = zioSchemaAvro.jvm
.settings(Test / fork := true)

lazy val zioSchemaOptics = crossProject(JSPlatform, JVMPlatform)
.in(file("zio-schema-optics"))
Expand All @@ -237,7 +230,6 @@ lazy val zioSchemaOpticsJS = zioSchemaOptics.js
.settings(scalaJSUseMainModuleInitializer := true)

lazy val zioSchemaOpticsJVM = zioSchemaOptics.jvm
.settings(Test / fork := true)

lazy val zioSchemaExamples = crossProject(JSPlatform, JVMPlatform)
.in(file("zio-schema-examples"))
Expand Down Expand Up @@ -272,7 +264,6 @@ lazy val zioSchemaZioTestJS = zioSchemaZioTest.js
.settings(scalaJSUseMainModuleInitializer := true)

lazy val zioSchemaZioTestJVM = zioSchemaZioTest.jvm
.settings(Test / fork := true)

lazy val docs = project
.in(file("zio-schema-docs"))
Expand Down
6 changes: 3 additions & 3 deletions docs/overview/first_schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ object JsonSample extends zio.App {
import ManualConstruction._
import zio.stream.ZStream

override def run(args: List[String]): URIO[zio.ZEnv, ExitCode] = for {
override def run(args: List[String]): UIO[ExitCode] = for {
_ <- ZIO.unit
person = Person("Michelle", 32)
personToJsonTransducer = JsonCodec.encoder[Person](schemaPerson)
Expand All @@ -139,7 +139,7 @@ object ProtobufExample extends zio.App {
import ManualConstruction._
import zio.stream.ZStream

override def run(args: List[String]): URIO[zio.ZEnv, ExitCode] = for {
override def run(args: List[String]): UIO[ExitCode] = for {
_ <- ZIO.unit
_ <- ZIO.debug("protobuf roundtrip")
person = Person("Michelle", 32)
Expand Down Expand Up @@ -172,7 +172,7 @@ object CombiningExample extends zio.App {
import ManualConstruction._
import zio.stream.ZStream

override def run(args: List[String]): URIO[zio.ZEnv, ExitCode] = for {
override def run(args: List[String]): UIO[ExitCode] = for {
_ <- ZIO.unit
_ <- ZIO.debug("combining roundtrip")
person = Person("Michelle", 32)
Expand Down
12 changes: 6 additions & 6 deletions project/BuildHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ object BuildHelper {
val Scala213: String = versions("2.13")
val Scala3: String = versions("3.1") //versions.getOrElse("3.0", versions("3.1"))

val zioVersion = "1.0.15"
val zioJsonVersion = "0.2.0-M2"
val zioPreludeVersion = "1.0.0-RC8"
val zioOpticsVersion = "0.1.0"
val zioVersion = "2.0.1"
val zioJsonVersion = "0.3.0-RC9"
val zioPreludeVersion = "1.0.0-RC15"
val zioOpticsVersion = "0.2.0"
val silencerVersion = "1.7.8"
val avroVersion = "1.11.0"

Expand Down Expand Up @@ -106,7 +106,7 @@ object BuildHelper {
else Seq.empty

val extraOptions = CrossVersion.partialVersion(scalaVersion) match {
case Some((3, 0)) =>
case Some((3, _)) =>
Seq(
"-language:implicitConversions",
"-Xignore-scala2-macros"
Expand Down Expand Up @@ -206,7 +206,7 @@ object BuildHelper {
"com.github.liancheng" %% "organize-imports" % "0.6.0",
"com.github.vovapolu" %% "scaluzzi" % "0.1.21"
),
Test / parallelExecution := true,
Test / parallelExecution := !sys.env.contains("CI"),
incOptions ~= (_.withLogRecompileOnMacro(true)),
autoAPIMappings := true,
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ import zio.schema.Schema._
import zio.schema.SchemaGen.Json.schema
import zio.test._

object AccessorBuilderSpec extends DefaultRunnableSpec {
object AccessorBuilderSpec extends ZIOSpecDefault {
import TestAccessorBuilder._
import Assertion._

private val builder: TestAccessorBuilder = new TestAccessorBuilder

override def spec: ZSpec[Environment, Failure] = suite("AccessorBuilder")(
override def spec: Spec[Environment, Any] = suite("AccessorBuilder")(
test("fail") {
assert(Schema.fail("error").makeAccessors(builder).asInstanceOf[Unit])(isUnit)
},
testM("primitive") {
test("primitive") {
check(SchemaGen.anyPrimitive) { schema =>
assert(schema.makeAccessors(builder))(isUnit)
}
},
testM("sequence") {
test("sequence") {
check(SchemaGen.anySchema) { elementSchema =>
val collectionSchema = elementSchema.repeated
val traversal = collectionSchema.makeAccessors(builder)
Expand All @@ -33,7 +33,7 @@ object AccessorBuilderSpec extends DefaultRunnableSpec {
)(isTrue)
}
},
testM("transform") {
test("transform") {
check(SchemaGen.anyPrimitive) { schema =>
val transform = schema.transformOrFail[Unit](_ => Left("error"), _ => Left("error"))

Expand All @@ -45,7 +45,7 @@ object AccessorBuilderSpec extends DefaultRunnableSpec {
)(isTrue)
}
},
testM("optional") {
test("optional") {
check(SchemaGen.anyPrimitive) { schema =>
val optionalSchema: Schema.Optional[_] = schema.optional.asInstanceOf[Schema.Optional[_]]
val enumSchema = optionalSchema.toEnum
Expand All @@ -63,7 +63,7 @@ object AccessorBuilderSpec extends DefaultRunnableSpec {
)(isTrue)
}
},
testM("tuple") {
test("tuple") {
check(SchemaGen.anyPrimitive <*> SchemaGen.anyPrimitive) {
case (leftSchema, rightSchema) =>
val tupleSchema: Schema.Tuple[_, _] = (leftSchema <*> rightSchema).asInstanceOf[Schema.Tuple[_, _]]
Expand All @@ -81,7 +81,7 @@ object AccessorBuilderSpec extends DefaultRunnableSpec {
)(isTrue)
}
},
testM("either") {
test("either") {
check(SchemaGen.anyPrimitive <*> SchemaGen.anyPrimitive) {
case (leftSchema, rightSchema) =>
val eitherSchema: Schema.EitherSchema[_, _] =
Expand All @@ -103,7 +103,7 @@ object AccessorBuilderSpec extends DefaultRunnableSpec {
)(isTrue)
}
},
testM("lazy") {
test("lazy") {
check(SchemaGen.anyPrimitive) { schema =>
val lazySchema = Schema.defer(schema)
val eagerAccessor: Any = schema.makeAccessors(builder)
Expand Down
Loading

0 comments on commit 184e045

Please sign in to comment.