ngocdaothanh/xitrum — pull request #166 by caiiiycuk (2013-09-09 08:32:00+00:00)
Title: Swagger integration

What do you think about adding action for generation api-docs. I implement SwaggerDocAction for Swagger-UI. It is collect all routes with @SwaggerDoc annotation and generate /api-docs.json which can be used in swagger-ui to display api documentation.

For example, in our project documenting looks like:
```
@GET("organization/:respondType")
@SwaggerDoc(summary = "Full text search for organizations",
parameters = Array(
new SwaggerParameter(name = "town", typename = "int", description = "List of town ids to search",
required = true, allowMultiple = true),
new SwaggerParameter(name = "query", typename = "string", description = "Full text search query", required = true),
new SwaggerParameter(name = "doctype", typename = "string", description = "Type of result document", required = true),
new SwaggerParameter(name = "limit", typename = "int"),
new SwaggerParameter(name = "offset", typename = "int")))
class OrganizationSearch extends APIAction {
import CatalogConfig._

def execute {
val towns = params[Long]("town")
val query = param("query")
val docType = param("doctype")

val organizations = FTS.organization(query, towns)
val request = requestForDocument(organizations, docType, respondType)
val response = WS.prepareGet(request).execute.get

respondText(response.getResponseBody, response.getContentType)
}

}
```