Skip to content

Commit

Permalink
zio-bson support (#546)
Browse files Browse the repository at this point in the history
* zio-bson support

* tests

* update README
  • Loading branch information
senia-psm authored May 10, 2023
1 parent 4e1e001 commit 0855237
Show file tree
Hide file tree
Showing 10 changed files with 2,395 additions and 11 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ _ZIO Schema_ is used by a growing number of ZIO libraries, including _ZIO Flow_,
In order to use this library, we need to add the following lines in our `build.sbt` file:

```scala
libraryDependencies += "dev.zio" %% "zio-schema" % "0.4.10"
libraryDependencies += "dev.zio" %% "zio-schema-json" % "0.4.10"
libraryDependencies += "dev.zio" %% "zio-schema-protobuf" % "0.4.10"
libraryDependencies += "dev.zio" %% "zio-schema" % "0.4.11"
libraryDependencies += "dev.zio" %% "zio-schema-bson" % "0.4.11"
libraryDependencies += "dev.zio" %% "zio-schema-json" % "0.4.11"
libraryDependencies += "dev.zio" %% "zio-schema-protobuf" % "0.4.11"

// Required for automatic generic derivation of schemas
libraryDependencies += "dev.zio" %% "zio-schema-derivation" % "0.4.10",
libraryDependencies += "dev.zio" %% "zio-schema-derivation" % "0.4.11",
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided"
```

Expand Down
20 changes: 20 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ lazy val root = project
zioSchemaThriftJVM,
zioSchemaAvroJS,
zioSchemaAvroJVM,
zioSchemaBsonJVM,
zioSchemaMsgPackJS,
zioSchemaMsgPackJVM,
docs
Expand Down Expand Up @@ -236,6 +237,25 @@ lazy val zioSchemaAvroJS = zioSchemaAvro.js

lazy val zioSchemaAvroJVM = zioSchemaAvro.jvm

lazy val zioSchemaBson = crossProject(JVMPlatform)
.in(file("zio-schema-bson"))
.dependsOn(zioSchema, zioSchemaDerivation, zioSchemaZioTest % Test, tests % "test->test")
.settings(stdSettings("zio-schema-bson"))
.settings(crossProjectSettings)
.settings(buildInfoSettings("zio.schema.bson"))
.settings(
libraryDependencies ++= Seq(
"org.mongodb" % "bson" % bsonVersion,
"dev.zio" %% "zio-bson" % zioBsonVersion,
"dev.zio" %% "zio" % zioVersion, // zio.Chunk
"dev.zio" %% "zio-test-magnolia" % zioVersion % Test, // TODO: implement DeriveDiff in zioSchemaZioTest
"org.scala-lang.modules" %% "scala-collection-compat" % scalaCollectionCompatVersion
),
scalacOptions -= "-Xfatal-warnings" // cross-version imports
)

lazy val zioSchemaBsonJVM = zioSchemaBson.jvm

lazy val zioSchemaOptics = crossProject(JSPlatform, JVMPlatform)
.in(file("zio-schema-optics"))
.dependsOn(zioSchema, zioSchemaDerivation, tests % "test->test")
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ In order to use this library, we need to add the following lines in our `build.s

```scala
libraryDependencies += "dev.zio" %% "zio-schema" % "@VERSION@"
libraryDependencies += "dev.zio" %% "zio-schema-bson" % "@VERSION@"
libraryDependencies += "dev.zio" %% "zio-schema-json" % "@VERSION@"
libraryDependencies += "dev.zio" %% "zio-schema-protobuf" % "@VERSION@"

Expand Down
17 changes: 10 additions & 7 deletions project/BuildHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ object BuildHelper {
val Scala213: String = versions("2.13")
val Scala3: String = versions("3.2") //versions.getOrElse("3.0", versions("3.1"))

val zioVersion = "2.0.10"
val zioJsonVersion = "0.5.0"
val zioPreludeVersion = "1.0.0-RC18"
val zioOpticsVersion = "0.2.1"
val silencerVersion = "1.7.11"
val avroVersion = "1.11.0"
val zioConstraintlessVersion = "0.3.2"
val zioVersion = "2.0.10"
val zioJsonVersion = "0.5.0"
val zioPreludeVersion = "1.0.0-RC18"
val zioOpticsVersion = "0.2.1"
val zioBsonVersion = "1.0.2"
val silencerVersion = "1.7.11"
val avroVersion = "1.11.0"
val bsonVersion = "4.9.1"
val zioConstraintlessVersion = "0.3.2"
val scalaCollectionCompatVersion = "2.10.0"

private val testDeps = Seq(
"dev.zio" %% "zio-test" % zioVersion % "test",
Expand Down
Loading

0 comments on commit 0855237

Please sign in to comment.