Skip to content

neandertech/jsonrpclib

Repository files navigation

CI

jsonrpclib-fs2 Scala version support

jsonrpclib-fs2 Scala version support

jsonrpclib

This is a cross-platform, cross-scala-version library that provides construct for bidirectional communication using the jsonrpc protocol. It is built on top of fs2 and jsoniter-scala

This library does not enforce any transport, and can work on top of stdin/stdout or other channels.

Installation

The dependencies below are following cross-platform semantics. Adapt according to your needs

SBT

libraryDependencies += "tech.neander" %%% "jsonrpclib-fs2" % version

Mill

override def ivyDeps = super.ivyDeps() ++ Agg(ivy"tech.neander::jsonrpclib-fs2::$version")

Scala-cli

//> using lib "tech.neander::jsonrpclib-fs2:<VERSION>"

Usage

/!\ Please be aware that this library is in its early days and offers strictly no guarantee with regards to backward compatibility

See the modules/examples folder.

Smithy Integration

You can now use jsonrpclib directly with Smithy and smithy4s, enabling type-safe, schema-first JSON-RPC APIs with minimal boilerplate.

This integration is supported by the following modules:

// Defines the Smithy protocol for JSON-RPC
libraryDependencies += "tech.neander" % "jsonrpclib-smithy" % <version>

// Provides smithy4s client/server bindings for JSON-RPC
libraryDependencies += "tech.neander" %%% "jsonrpclib-smithy4s" % <version>

With these modules, you can:

  • Annotate your Smithy operations with @jsonRpcRequest or @jsonRpcNotification
  • Generate client and server interfaces using smithy4s
  • Use ClientStub to invoke remote services over JSON-RPC
  • Use ServerEndpoints to expose service implementations via a Channel

This allows you to define your API once in Smithy and interact with it as a fully typed JSON-RPC service—without writing manual encoders, decoders, or dispatch logic.

About

A cross-platform (JVM, JS, Native) pure-Scala JsonRPC library, made with Cats Effect, fs2, and jsoniter

Topics

Resources

License

Stars

Watchers

Forks