- Library for Scala 3 (JVM only)
- Depends on Avro 1.11.3
Build schemas secure in the knowledge that we won't be causing side-effects.
"com.julianpeeters" %% "schemabuilder4cats" % "0.1.3"
The SchemaBuilder
API is modelled after Apache Avro Java 1.11.3 API.
Please see the corresponding org.apache.avro.SchemaBuilder
Javadoc for documentation.
import cats.effect.IO
import org.apache.avro.Schema
import schemabuilder4cats.SchemaBuilder
// define B as a contextual abstraction in order to import extension methods
given B: SchemaBuilder[IO] = SchemaBuilder[IO]
val record: IO[Schema] = B.record("myrecord").fields.endRecord
import cats.effect.unsafe.implicits.global
// example usage only, avoid unsafe methods in real code
record.unsafeRunSync().toString(true)
// res0: String = """{
// "type" : "record",
// "name" : "myrecord",
// "fields" : [ ]
// }"""