• Embedding SwaggerUI into http4s projects

    I’d like to share an approach for integrating SwaggerUI into Scala projects, using http4s as example. With webjars available you don’t need to copy its complete code into your project, you’ll need just a small piece of it along with 2 dependencies to your build.sbt file - one with SwaggerUI code, and another - webjar ulitity library: libraryDependencies ++= { "org.webjars" % "webjars-locator" % "0.34", "org.webjars" % "swagger-ui" % "3.17.3" } Now we need to customize index.
  • FS2: how to stop the queue

    If you want to get FS2 is a streaming library for Scala which offers more lightweight and more “functional” alternative to Akka Streams. However, as it’s relatively young it either misses some functionality, or has it available in non-obvious way and lacks appropriate documentation. One such example is retrieving data from callback-based API which expects an interface with callbacks for next element, stream end and stream failure - like Subscriber from Reactive Streams Initiative.