Skip to content

Commit

Permalink
Add SchemaBuilder API
Browse files Browse the repository at this point in the history
Wrap all methods of org.apache.avro.SchemaBuilder and its nested classes. Reimplements the full SchemaBuilder API, with the exceptions of the self methods and the shortcut methods of the nested classes. Side effects are now wrapped in cats.effect.Sync, and now typeclass composition replaces inheritance, but extension methods are used to remain faithful to the Java API.
  • Loading branch information
julianpeeters committed Aug 7, 2023
1 parent a2e551c commit 2b754ec
Show file tree
Hide file tree
Showing 5 changed files with 1,717 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# schemabuilder4cats
A referentially transparent FFI to `org.apache.avro.SchemaBuilder`

### Welcome to `schemabuilder4cats`

##### Add the dependency:

"com.julianpeeters" %% "schemabuilder4cats" % "0.1.0-SNAPSHOT"

### `schemabuilder4cats` Essentials

The `SchemaBuilder` API is modelled after `org.apache.avro.SchemaBuilder` ([Javadoc](https://avro.apache.org/docs/1.11.1/api/java/)).
33 changes: 33 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
lazy val ApacheAvroV = "1.11.1"
lazy val CatsEffectV = "3.5.1"
lazy val MUnitCEV = "1.0.7"

ThisBuild / description := "A referentially transparent FFI to `org.apache.avro.SchemaBuilder`"
ThisBuild / organization := "com.julianpeeters"
ThisBuild / scalaVersion := "3.3.0"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / versionScheme := Some("semver-spec")

lazy val commonSettings = Seq(
scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-Werror",
"-source:future",
"-Wunused:all",
"-Wvalue-discard"
)
)

lazy val schemabuilder4cats = (project in file("."))
.settings(
commonSettings,
name := "schemabuilder4cats",
libraryDependencies ++= Seq(
// main
"org.apache.avro" % "avro" % ApacheAvroV,
"org.typelevel" %% "cats-effect" % CatsEffectV,
// test
"org.typelevel" %% "munit-cats-effect-3" % MUnitCEV % Test,
)
)
1 change: 1 addition & 0 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.9.3

0 comments on commit 2b754ec

Please sign in to comment.