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

swaggerjsonresponse

 

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

output

Resources

Swagger

Thanks !!!

 

KNOLDUS-advt-sticker

This entry was posted in Akka, akka-http, Scala, Swagger and tagged , , , . Bookmark the permalink.

4 Responses to Document generation of Akka-HTTP using Swagger

  1. Rohit says:

    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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s