Document generation of Akka-HTTP using Swagger

Hello All,  In this blog we are using Swagger to generate document of Akka-HTTP.

For Swagger you can get more information from  Introduction to Swagger .

For Akka you can get more information from Introduction to Akka-Http

You can find complete code here.

build.sbt file of the project contains all dependency.

build

SwaggerDocService.scala

swaggerdoc

AkkaSwagger.Scala

route

Get the Json in response by hitting localhost:8080/api-docs/swagger.json

Swagger

 

You can get the document by pasting json on http://editor.swagger.io/#/

Swagger

Resources

Swagger

Thanks !!!

 

KNOLDUS-advt-sticker

4 thoughts on “Document generation of Akka-HTTP using Swagger

  1. I tried your example, it ran successfully but when I integrated the same code in my project it is generating error :

    [ERROR] [11/14/2017 14:56:25.250] [akka-http-sample-akka.actor.default-dispatcher-3] [akka.actor.ActorSystemImpl(akka-http-sample)] Error during processing of request: ‘io.swagger.converter.ModelConverter: Provider io.swagger.scala.converter.SwaggerScalaModelConverter could not be instantiated’.

    java.util.ServiceConfigurationError: io.swagger.converter.ModelConverter: Provider

    io.swagger.scala.converter.SwaggerScalaModelConverter could not be instantiated
    at java.util.ServiceLoader.fail(ServiceLoader.java:232)

    Please let me know if this can be solved…

Leave a Reply

%d bloggers like this: