swagger-finatra

Add Swagger support for Finatra to generate REST API docuemnt

License

License

Categories

Categories

Swagger Program Interface REST Frameworks
GroupId

GroupId

com.github.xiaodongw
ArtifactId

ArtifactId

swagger-finatra_2.10
Last Version

Last Version

0.5.1
Release Date

Release Date

Type

Type

jar
Description

Description

swagger-finatra
Add Swagger support for Finatra to generate REST API docuemnt
Project URL

Project URL

https://github.com/xiaodongw/swagger-finatra/
Source Code Management

Source Code Management

https://github.com/xiaodongw/swagger-finatra.git

Download swagger-finatra_2.10

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.xiaodongw/swagger-finatra_2.10/ -->
<dependency>
    <groupId>com.github.xiaodongw</groupId>
    <artifactId>swagger-finatra_2.10</artifactId>
    <version>0.5.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.xiaodongw/swagger-finatra_2.10/
implementation 'com.github.xiaodongw:swagger-finatra_2.10:0.5.1'
// https://jarcasting.com/artifacts/com.github.xiaodongw/swagger-finatra_2.10/
implementation ("com.github.xiaodongw:swagger-finatra_2.10:0.5.1")
'com.github.xiaodongw:swagger-finatra_2.10:jar:0.5.1'
<dependency org="com.github.xiaodongw" name="swagger-finatra_2.10" rev="0.5.1">
  <artifact name="swagger-finatra_2.10" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.xiaodongw', module='swagger-finatra_2.10', version='0.5.1')
)
libraryDependencies += "com.github.xiaodongw" % "swagger-finatra_2.10" % "0.5.1"
[com.github.xiaodongw/swagger-finatra_2.10 "0.5.1"]

Dependencies

compile (4)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.10.6
io.swagger : swagger-core jar 1.5.7
io.swagger : swagger-scala-module_2.10 jar 1.0.1
com.twitter : finatra_2.10 jar 1.6.0

test (2)

Group / Artifact Type Version
org.scalatest : scalatest_2.10 jar 2.2.4
joda-time : joda-time jar 2.7

Project Modules

There are no modules declared in this project.

swagger-finatra

Add Swagger support for Finatra (1.6 and 2.2.0) web framework.

It requires Java 8 from version 0.6.0.

Getting started

Gradle

Add repository

repositories {
  maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}

Add Dependency

Scala 2.10, Finatra 2.2.0
compile "com.github.xiaodongw:swagger-finatra_2.10:0.7.2"
Scala 2.11, Finatra 2.2.0
compile "com.github.xiaodongw:swagger-finatra_2.11:0.7.2"

SBT

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/releases/"

Add Dependency

Finatra 2.2.0
libraryDependencies += "com.github.xiaodongw" %% "swagger-finatra" % "0.7.2"

Add document information for you controller

object SampleSwagger extends Swagger

class SampleController extends Controller with SwaggerSupport {
  implicit protected val swagger = SampleSwagger

  getWithDoc("/students/:id") { o =>
    o.summary("Read the detail information about the student")
      .tag("Student")
      .routeParam[String]("id", "the student id")
      .responseWith[Student](200, "the student details")
      .responseWith(404, "the student is not found")
  } { request =>
    ...
  }

Add document controller

Finatra 2.2.0
object SampleApp extends HttpServer {
  val info = new Info()
    .description("The Student / Course management API, this is a sample for swagger document generation")
    .version("1.0.1")
    .title("Student / Course Management API")
  SampleSwagger.info(info)

  override def configureHttp(router: HttpRouter) {
    router
      .add[WebjarsController]
      .add(new SwaggerController(swagger = SampleSwagger))
      ...
  }
}

Swagger API document: http://localhost:8888/api-docs/model

Swagger UI: http://localhost:8888/api-docs/ui

Finatra 1.6

Previous version of Finatra (1.6) is also supported, Check here for the guide.

Versions

Version
0.5.1
0.5.0
0.4.2
0.4.1
0.4.0
0.3.1
0.3.0
0.2.0