Giter Club home page Giter Club logo

swagger-finatra's Introduction

swagger-finatra

Add Swagger support for Finatra web framework.

Getting started

Gradle

Add repository

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

Add Dependency

Scala 2.10, Finatra 1.6.0

compile "com.github.xiaodongw:swagger-finatra_2.10:0.1.0-SNAPSHOT"

Scala 2.10, Finatra 2.0.0.M1

compile "com.github.xiaodongw:swagger-finatra2_2.10:0.1.0-SNAPSHOT"

Scala 2.11, Finatra 2.0.0.M1

compile "com.github.xiaodongw:swagger-finatra2_2.11:0.1.0-SNAPSHOT"

SBT

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

Add Dependency

Finatra 1.6.0

libraryDependencies += "com.github.xiaodongw" %% "swagger-finatra" % "0.1.0-SNAPSHOT"

Finatra 2.0.0.M1

libraryDependencies += "com.github.xiaodongw" %% "swagger-finatra2" % "0.1.0-SNAPSHOT"

Add document information for you controller

class SampleController extends Controller with SwaggerSupport {
  get("/students/:id",
    swagger { o =>
      o.summary("Read the detail information about the student")
      o.tags("Student")
      o.routeParam[String]("id", "the student id")
      o.response[Student](200, "the student details")
      o.response(404, "the student is not found")
    }) { request =>
    ...
  }

Add document controller

object SampleApp extends FinatraServer {
  FinatraSwagger.registerInfo(
    description = "The Student / Course management API, this is a sample for swagger document generation",
    version = "1.0.1",
    title = "Student / Course Management API")

  register(new SwaggerController())
  ...
}

Now, check your shining API documents at

Swagger API document: http://localhost:7070/api-docs

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

swagger-finatra's People

Contributors

xiaodongw avatar

Watchers

Syamantak Mukhopadhyay avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.