https://github.com/maginepro/http4s-karapace
An http4s client for Karapace :turtle:
https://github.com/maginepro/http4s-karapace
http4s kafka karapace scala schema schema-registry
Last synced: about 1 year ago
JSON representation
An http4s client for Karapace :turtle:
- Host: GitHub
- URL: https://github.com/maginepro/http4s-karapace
- Owner: maginepro
- License: apache-2.0
- Created: 2025-03-14T11:51:18.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-09T10:47:09.000Z (about 1 year ago)
- Last Synced: 2025-04-09T11:42:31.390Z (about 1 year ago)
- Topics: http4s, kafka, karapace, scala, schema, schema-registry
- Language: Scala
- Homepage:
- Size: 37.1 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# :turtle: http4s-karapace
Provides an [http4s](https://http4s.org) client for the [Karapace](https://www.karapace.io) schema registry.
## Usage
You can add the following line to `build.sbt` to use the library.
```scala
libraryDependencies += "com.magine" %% "http4s-karapace" % http4sKarapaceVersion
```
Make sure to replace `http4sKarapaceVersion` with a [release version](https://github.com/maginepro/http4s-karapace/releases).
Replace `%%` with `%%%` if you are using [Scala.js](https://www.scala-js.org) or [Scala Native](https://scala-native.org).
## Quick Example
Create a `SchemaRegistryClient` and use it to interact with a schema registry.
```scala
import cats.effect.IO
import cats.effect.IOApp
import cats.syntax.all._
import com.magine.http4s.karapace.SchemaRegistryClient
import com.magine.http4s.karapace.SubjectName
import org.http4s.ember.client.EmberClientBuilder
import org.http4s.syntax.all._
object Main extends IOApp.Simple {
override def run: IO[Unit] =
EmberClientBuilder.default[IO].build.use { client =>
for {
schemaRegistryClient <- SchemaRegistryClient
.builder(client, uri"http://localhost:8081")
.withBasicAuth("username", "password")
.build
name = SubjectName("topic-value")
subject <- schemaRegistryClient.getSubject(name)
_ <- IO.println(subject)
} yield ()
}
}
```