api4s - HTTP API in Scala
Document your HTTP API with swagger and generate Scala code from it.
The simplest way to use this library is via sbt plugin. Add following line to
addSbtPlugin("com.github.IndiscriminateCoding" % "api4s-sbt" % "0.2.6")
Also you need to enable plugin usage in
lazy val root = (project in file(".")) .enablePlugins(Api4s) .settings( libraryDependencies += "com.github.IndiscriminateCoding" %% "api4s-core" % "0.2.6", api4sSources := Seq(Api4s.Src( file = sourceDirectory.value / "main" / "swagger" / "my-specification.yaml", pkg = "com.example", server = true, client = true )) )
At this point you can just compile your project and see what is generated by plugin.
Detailed example is here.
- No OpenAPI 3.0 support at this moment; only swagger is supported
- Specifications in JSON format isn't supported; use YAML instead