You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2016/11/30 20:57:56 UTC
usergrid-qakka git commit: Add Swagger annotations to Queue API
Repository: usergrid-qakka
Updated Branches:
refs/heads/master 6426fde9a -> 2513d0a69
Add Swagger annotations to Queue API
Project: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/commit/2513d0a6
Tree: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/tree/2513d0a6
Diff: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/diff/2513d0a6
Branch: refs/heads/master
Commit: 2513d0a6986b71267a75f95b3f731949d2d36ae2
Parents: 6426fde
Author: Dave Johnson <sn...@apache.org>
Authored: Wed Nov 30 15:57:33 2016 -0500
Committer: Dave Johnson <sn...@apache.org>
Committed: Wed Nov 30 15:57:33 2016 -0500
----------------------------------------------------------------------
pom.xml | 42 +++++-
.../persistence/qakka/api/ApiDefinition.java | 32 +++++
.../persistence/qakka/api/ApiResponse.java | 7 +
.../persistence/qakka/api/QueueResource.java | 131 +++++++++++++++----
.../persistence/qakka/api/StatusResource.java | 6 +-
templates/markdown.hbs | 105 +++++++++++++++
templates/operation.hbs | 73 +++++++++++
templates/security.hbs | 88 +++++++++++++
templates/strapdown.html.hbs | 10 ++
9 files changed, 467 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/2513d0a6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 008a2d7..b2807f6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,7 +62,7 @@
<forkCount>0</forkCount>
<threadCount>0</threadCount>
<argLine>
- -Xms2G -Xmx4G -Dlog4j.configuration=file:${basedir}/src/test/resources/log4j.properties
+ -Xms2G -Xmx4G -Dlog4j.configuration=file:${basedir}/src/test/resources/log4j.properties
</argLine>
</configuration>
</plugin>
@@ -90,6 +90,40 @@
</configuration>
</plugin>
+ <plugin>
+ <groupId>com.github.kongchen</groupId>
+ <artifactId>swagger-maven-plugin</artifactId>
+ <version>3.1.3</version>
+ <configuration>
+ <apiSources>
+ <apiSource>
+ <springmvc>false</springmvc>
+ <locations>org.apache.usergrid.persistence.qakka.api</locations>
+ <info>
+ <title>Qakka</title>
+ <version>v1</version>
+ <description>API for Qakka Queue System</description>
+ <license>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
+ <name>Apache 2.0</name>
+ </license>
+ </info>
+ <templatePath>${basedir}/templates/strapdown.html.hbs</templatePath>
+ <outputPath>${basedir}/target/swagger-docs/document.html</outputPath>
+ <swaggerDirectory>${basedir}/target/swagger-docs</swaggerDirectory>
+ </apiSource>
+ </apiSources>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
<testResources>
@@ -185,6 +219,12 @@
<artifactId>jersey-test-framework-provider-jetty</artifactId>
<version>${jersey.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-jersey2-jaxrs</artifactId>
+ <version>1.5.0</version>
+ </dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/2513d0a6/src/main/java/org/apache/usergrid/persistence/qakka/api/ApiDefinition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/ApiDefinition.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/ApiDefinition.java
new file mode 100644
index 0000000..68a0d79
--- /dev/null
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/ApiDefinition.java
@@ -0,0 +1,32 @@
+package org.apache.usergrid.persistence.qakka.api;
+
+
+import io.swagger.annotations.*;
+
+@SwaggerDefinition(
+ info = @Info(
+ description = "Queue Management and Messages",
+ version = "v1.0",
+ title = "Apache Usergrid - Qakka API",
+ contact = @Contact(
+ name = "Apache Usergrid project",
+ email = "dev@usergrid.apache.org",
+ url = "http://usergrid.apache.org"
+ ),
+ license = @License(
+ name = "Apache 2.0",
+ url = "http://www.apache.org/licenses/LICENSE-2.0"
+ )
+ ),
+ consumes = {"application/json", "application/xml"},
+ produces = {"application/json", "application/xml"},
+ schemes = {SwaggerDefinition.Scheme.HTTP, SwaggerDefinition.Scheme.HTTPS},
+ tags = {
+ @Tag(name = "Private", description = "Tag used to denote operations as private")
+ },
+ externalDocs = @ExternalDocs(value = "README", url = "https://github.com/apache/usergrid-qakka")
+)
+/**
+ * Created by Dave Johnson (snoopdave@apache.org) on 11/30/16.
+ */
+public interface ApiDefinition {}
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/2513d0a6/src/main/java/org/apache/usergrid/persistence/qakka/api/ApiResponse.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/ApiResponse.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/ApiResponse.java
index c2c0910..0dffc8a 100644
--- a/src/main/java/org/apache/usergrid/persistence/qakka/api/ApiResponse.java
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/ApiResponse.java
@@ -19,6 +19,8 @@
package org.apache.usergrid.persistence.qakka.api;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
import org.apache.usergrid.persistence.qakka.core.Queue;
import org.apache.usergrid.persistence.qakka.core.QueueMessage;
@@ -26,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import java.util.Collection;
+@ApiModel(value="ApiResponse", description="Response returned by most Queue API calls.")
@XmlRootElement
public class ApiResponse {
@@ -34,6 +37,7 @@ public class ApiResponse {
private Collection<Queue> queues;
private Collection<QueueMessage> queueMessages;
+ @ApiModelProperty(value = "Queues returned but the call, or empty if not applicable.")
public Collection<Queue> getQueues() {
return queues;
}
@@ -42,6 +46,7 @@ public class ApiResponse {
this.queues = queues;
}
+ @ApiModelProperty(value = "Queues Messages returned by the call, or empty if not applicable.")
public Collection<QueueMessage> getQueueMessages() {
return queueMessages;
}
@@ -50,6 +55,7 @@ public class ApiResponse {
this.queueMessages = queueMessages;
}
+ @ApiModelProperty(value = "Count of Queues or QueueMessages returned by the call.")
public Integer getCount() {
return count;
}
@@ -58,6 +64,7 @@ public class ApiResponse {
this.count = count;
}
+ @ApiModelProperty(value = "Informative message intended for client.")
public String getMessage() {
return message;
}
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/2513d0a6/src/main/java/org/apache/usergrid/persistence/qakka/api/QueueResource.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/QueueResource.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/QueueResource.java
index 7d5599a..38fbf76 100644
--- a/src/main/java/org/apache/usergrid/persistence/qakka/api/QueueResource.java
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/QueueResource.java
@@ -22,6 +22,10 @@ package org.apache.usergrid.persistence.qakka.api;
import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream;
import com.google.common.base.Preconditions;
import com.google.common.io.ByteStreams;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponses;
import org.apache.usergrid.persistence.qakka.URIStrategy;
import org.apache.usergrid.persistence.qakka.core.*;
import org.slf4j.Logger;
@@ -38,6 +42,7 @@ import java.util.List;
import java.util.UUID;
+@Api(value="/queues", description = "Queue management, send, get and ack.")
@Path("queues")
public class QueueResource {
private static final Logger logger = LoggerFactory.getLogger( QueueResource.class );
@@ -64,6 +69,11 @@ public class QueueResource {
}
+ @ApiOperation(value = "Create new queue.", response=ApiResponse.class)
+ @ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 400,
+ message = "No Queue object posted, or name field is missing"),
+ })
@POST
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
@@ -80,6 +90,11 @@ public class QueueResource {
}
+ @ApiOperation(value = "Update Queue configuration.", response=ApiResponse.class)
+ @ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 400,
+ message = "No Queue object posted, or name field is missing"),
+ })
@PUT
@Path( "{queueName}/config" )
@Consumes({MediaType.APPLICATION_JSON})
@@ -98,6 +113,11 @@ public class QueueResource {
}
+ @ApiOperation(value = "Delete Queue.", response=ApiResponse.class)
+ @ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 400,
+ message = "Queue name or confirm flag missing."),
+ })
@DELETE
@Path( "{queueName}" )
@Produces({MediaType.APPLICATION_JSON})
@@ -119,10 +139,16 @@ public class QueueResource {
}
+ @ApiOperation(value = "Get Queue config.", response=ApiResponse.class)
+ @ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 400,
+ message = "Queue name or confirm flag missing."),
+ })
@GET
@Path( "{queueName}/config" )
@Produces({MediaType.APPLICATION_JSON})
- public Response getQueueConfig( @PathParam("queueName") String queueName) {
+ public Response getQueueConfig(
+ @ApiParam(value = "Name of Queue", required = true) @PathParam("queueName") String queueName) {
Preconditions.checkArgument(!QakkaUtils.isNullOrEmpty(queueName), "Queue name is required");
@@ -136,25 +162,27 @@ public class QueueResource {
}
+ @ApiOperation(value = "Get list of all Queues.", response=ApiResponse.class)
@GET
@Produces({MediaType.APPLICATION_JSON})
public List<String> getListOfQueues() {
// TODO: create design to handle large number of queues, e.g. paging and/or hierarchy of queues
-
// TODO: create design to support multi-tenant usage, authentication, etc.
-
return queueManager.getListOfQueues();
}
- @GET
- @Path( "{queueName}/stats" )
- @Produces({MediaType.APPLICATION_JSON})
- public Response getQueueStats( @PathParam("queueName") String queueName) throws Exception {
- // TODO: implement GET /queues/{queueName}/stats
- throw new UnsupportedOperationException();
- }
+// @GET
+// @Path( "{queueName}/stats" )
+// @Produces({MediaType.APPLICATION_JSON})
+// public Response getQueueStats(
+// @ApiParam(value = "Name of Queue", required = true) @PathParam("queueName") String queueName)
+// throws Exception {
+//
+// // TODO: implement GET /queues/{queueName}/stats
+// throw new UnsupportedOperationException();
+// }
Long convertDelayParameter(String delayParam) {
@@ -207,16 +235,25 @@ public class QueueResource {
* @param expirationParam Time (ms) after which message will expire (not yet supported)
* @param messageBody JSON payload in string form
*/
+ @ApiOperation(value = "Send Queue Message with a JSON payload.", response=ApiResponse.class)
@POST
@Path( "{queueName}/messages" )
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response sendMessageJson(
- @PathParam("queueName") String queueName,
- @QueryParam("regions" ) @DefaultValue("") String regionsParam,
+
+ @ApiParam(value = "Name of Queue", required = true)
+ @PathParam("queueName") String queueName,
+
+ @ApiParam(value = "Regions to which message is to be sent", required = false)
+ @QueryParam("regions" ) @DefaultValue("") String regionsParam,
+
@QueryParam("delay") @DefaultValue("") String delayParam,
@QueryParam("expiration") @DefaultValue("") String expirationParam,
- String messageBody) throws Exception {
+
+ @ApiParam(value = "Data to be send with Queue Message", required = true) String messageBody)
+
+ throws Exception {
return sendMessage( queueName, regionsParam, delayParam, expirationParam,
MediaType.APPLICATION_JSON, ByteBuffer.wrap( messageBody.getBytes() ) );
@@ -233,18 +270,30 @@ public class QueueResource {
* @param actualContentType Content type of messageBody data (if not application/octet-stream)
* @param messageBody Binary data that is the payload of the queue message
*/
+ @ApiOperation(value = "Send Queue Message with a binary data (blob) payload.", response=ApiResponse.class)
@POST
@Path( "{queueName}/messages" )
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
@Produces(MediaType.APPLICATION_JSON)
public Response sendMessageBinary(
- @PathParam("queueName") String queueName,
- @QueryParam("regions" ) @DefaultValue("") String regionsParam,
- @QueryParam("delay") @DefaultValue("") String delayParam,
+
+ @ApiParam(value = "Name of Queue", required = true)
+ @PathParam("queueName") String queueName,
+
+ @ApiParam(value = "Regions to which message is to be sent", required = false)
+ @QueryParam("regions" ) @DefaultValue("") String regionsParam,
+
+ @QueryParam("delay") @DefaultValue("") String delayParam,
@QueryParam("expiration") @DefaultValue("") String expirationParam,
- @QueryParam("contentType") String actualContentType,
- byte[] messageBody) throws Exception {
-
+
+ @ApiParam(value = "Content type of the data to be sent with Queue Message", required = true)
+ @QueryParam("contentType") String actualContentType,
+
+ @ApiParam(value = "Data to be send with Queue Message", required = true)
+ byte[] messageBody)
+
+ throws Exception {
+
String contentType = actualContentType != null ? actualContentType : MediaType.APPLICATION_OCTET_STREAM;
return sendMessage( queueName, regionsParam, delayParam, expirationParam,
@@ -286,11 +335,22 @@ public class QueueResource {
}
+ @ApiOperation(value = "Get next Queue Messages from a Queue", response=ApiResponse.class)
+ @ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid count parameter"),
+ })
@GET
@Path( "{queueName}/messages" )
@Produces({MediaType.APPLICATION_JSON})
- public Response getNextMessages( @PathParam("queueName") String queueName,
- @QueryParam("count") @DefaultValue("1") String countParam) throws Exception {
+ public Response getNextMessages(
+
+ @ApiParam(value = "Name of Queue", required = false)
+ @PathParam("queueName") String queueName,
+
+ @ApiParam(value = "Number of messages to get", required = false)
+ @QueryParam("count") @DefaultValue("1") String countParam)
+
+ throws Exception {
Preconditions.checkArgument( !QakkaUtils.isNullOrEmpty( queueName ), "Queue name is required" );
@@ -320,11 +380,23 @@ public class QueueResource {
}
+ @ApiOperation(value = "Acknowledge that Queue Message has been processed.", response=ApiResponse.class)
+ @ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 400,
+ message = "Queue Message ID invalid, or message not in-flight"),
+ })
@DELETE
@Path( "{queueName}/messages/{queueMessageId}" )
@Produces({MediaType.APPLICATION_JSON})
- public Response ackMessage( @PathParam("queueName") String queueName,
- @PathParam("queueMessageId") String queueMessageId) throws Exception {
+ public Response ackMessage(
+
+ @ApiParam(value = "Name of Queue", required = true)
+ @PathParam("queueName") String queueName,
+
+ @ApiParam(value = "ID of Queue Message to be acknowledged", required = true)
+ @PathParam("queueMessageId") String queueMessageId)
+
+ throws Exception {
Preconditions.checkArgument( !QakkaUtils.isNullOrEmpty( queueName ), "Queue name is required" );
@@ -341,11 +413,20 @@ public class QueueResource {
}
+ @ApiOperation(value = "Get data associated with a Queue Message.", response=ApiResponse.class)
+ @ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 400, message = "Message ID invalid"),
+ @io.swagger.annotations.ApiResponse(code = 404, message = "Queue Message or data not found")
+ })
@GET
@Path( "{queueName}/data/{queueMessageId}" )
public Response getMessageData(
- @PathParam("queueName") String queueName,
- @PathParam("queueMessageId") String queueMessageIdParam ) {
+
+ @ApiParam(value = "Name of Queue", required = true)
+ @PathParam("queueName") String queueName,
+
+ @ApiParam(value = "ID of Queue Message for which data is to be returned", required = true)
+ @PathParam("queueMessageId") String queueMessageIdParam ) {
Preconditions.checkArgument(!QakkaUtils.isNullOrEmpty(queueName), "Queue name is required");
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/2513d0a6/src/main/java/org/apache/usergrid/persistence/qakka/api/StatusResource.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/StatusResource.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/StatusResource.java
index 3067a5d..46a3476 100644
--- a/src/main/java/org/apache/usergrid/persistence/qakka/api/StatusResource.java
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/StatusResource.java
@@ -21,6 +21,8 @@ package org.apache.usergrid.persistence.qakka.api;
import com.codahale.metrics.Timer;
import com.google.inject.servlet.RequestScoped;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
import org.apache.usergrid.persistence.qakka.App;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,6 +39,7 @@ import java.util.HashMap;
import java.util.SortedSet;
+@Api(value="/status", description = "Status end-point.")
@Path("status")
@RequestScoped
public class StatusResource {
@@ -50,7 +53,8 @@ public class StatusResource {
logger.info( "Constructed" );
}
-
+
+ @ApiOperation(value = "Status of webapp.")
@GET
@Produces( MediaType.APPLICATION_JSON )
public Object status() {
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/2513d0a6/templates/markdown.hbs
----------------------------------------------------------------------
diff --git a/templates/markdown.hbs b/templates/markdown.hbs
new file mode 100644
index 0000000..0d9dd53
--- /dev/null
+++ b/templates/markdown.hbs
@@ -0,0 +1,105 @@
+#{{#info}}{{title}}
+
+
+{{description}}
+
+{{#contact}}
+[**Contact the developer**](mailto:{{email}})
+{{/contact}}
+
+**Version** {{version}}
+
+{{#license}}[**{{name}}**]({{url}}){{/license}}
+
+{{/info}}
+
+{{#if consumes}}**Consumes:** {{join consumes ", "}}{{/if}}
+
+{{#if produces}}**Produces:** {{join produces ", "}}{{/if}}
+
+{{#if securityDefinitions}}
+# Security Definitions
+{{/if}}
+{{> security}}
+
+# APIs
+
+{{#each paths}}
+## {{@key}}
+{{#this}}
+{{#get}}
+### GET
+{{> operation}}
+{{/get}}
+
+{{#put}}
+### PUT
+{{> operation}}
+{{/put}}
+
+{{#post}}
+### POST
+
+{{> operation}}
+
+{{/post}}
+
+{{#delete}}
+### DELETE
+{{> operation}}
+{{/delete}}
+
+{{#option}}
+### OPTION
+{{> operation}}
+{{/option}}
+
+{{#patch}}
+### PATCH
+{{> operation}}
+{{/patch}}
+
+{{#head}}
+### HEAD
+{{> operation}}
+{{/head}}
+
+{{/this}}
+{{/each}}
+
+# Definitions
+{{#each definitions}}
+## <a name="/definitions/{{key}}">{{@key}}</a>
+
+<p> {{description}} </p>
+
+<table border="1">
+ <tr>
+ <th>name</th>
+ <th>type</th>
+ <th>required</th>
+ <th>description</th>
+ <th>example</th>
+ </tr>
+ {{#each this.properties}}
+ <tr>
+ <td>{{@key}}</td>
+ <td>
+ {{#ifeq type "array"}}
+ {{#items.$ref}}
+ {{type}}[<a href="{{items.$ref}}">{{basename items.$ref}}</a>]
+ {{/items.$ref}}
+ {{^items.$ref}}{{type}}[{{items.type}}]{{/items.$ref}}
+ {{else}}
+ {{#$ref}}<a href="{{$ref}}">{{basename $ref}}</a>{{/$ref}}
+ {{^$ref}}{{type}}{{#format}} ({{format}}){{/format}}{{/$ref}}
+ {{/ifeq}}
+ </td>
+ <td>{{#required}}required{{/required}}{{^required}}optional{{/required}}</td>
+ <td>{{#description}}{{{description}}}{{/description}}{{^description}}-{{/description}}</td>
+ <td>{{example}}</td>
+ </tr>
+ {{/each}}
+</table>
+{{/each}}
+
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/2513d0a6/templates/operation.hbs
----------------------------------------------------------------------
diff --git a/templates/operation.hbs b/templates/operation.hbs
new file mode 100644
index 0000000..a581961
--- /dev/null
+++ b/templates/operation.hbs
@@ -0,0 +1,73 @@
+{{#deprecated}}-deprecated-{{/deprecated}}
+<a id="{{operationId}}">{{summary}}</a>
+
+{{description}}
+
+{{#if externalDocs.url}}{{externalDocs.description}}. [See external documents for more details]({{externalDocs.url}})
+{{/if}}
+
+{{#if security}}
+#### Security
+{{/if}}
+
+{{#security}}
+{{#each this}}
+* {{@key}}
+{{#this}} * {{this}}
+{{/this}}
+{{/each}}
+{{/security}}
+
+#### Request
+
+{{#if consumes}}
+**Content-Type: ** {{join consumes ", "}}{{/if}}
+
+##### Parameters
+{{#if parameters}}
+<table border="1">
+ <tr>
+ <th>Name</th>
+ <th>Located in</th>
+ <th>Required</th>
+ <th>Description</th>
+ <th>Default</th>
+ <th>Schema</th>
+ </tr>
+{{/if}}
+
+{{#parameters}}
+<tr>
+ <th>{{name}}</th>
+ <td>{{in}}</td>
+ <td>{{#if required}}yes{{else}}no{{/if}}</td>
+ <td>{{description}}{{#if pattern}} (**Pattern**: `{{pattern}}`){{/if}}</td>
+ <td> - </td>
+{{#ifeq in "body"}}
+ <td>
+ {{#ifeq schema.type "array"}}Array[<a href="{{schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}}
+ {{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a> {{/schema.$ref}}
+ </td>
+{{else}}
+ {{#ifeq type "array"}}
+ <td>Array[{{items.type}}] ({{collectionFormat}})</td>
+ {{else}}
+ <td>{{type}} {{#format}}({{format}}){{/format}}</td>
+ {{/ifeq}}
+{{/ifeq}}
+</tr>
+{{/parameters}}
+{{#if parameters}}
+</table>
+{{/if}}
+
+
+#### Response
+
+{{#if produces}}**Content-Type: ** {{join produces ", "}}{{/if}}
+
+
+| Status Code | Reason | Response Model |
+|-------------|-------------|----------------|
+{{#each responses}}| {{@key}} | {{description}} | {{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a>{{/schema.$ref}}{{#ifeq schema.type "array"}}Array[<a href="{{schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}}{{^schema}} - {{/schema}}|
+{{/each}}
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/2513d0a6/templates/security.hbs
----------------------------------------------------------------------
diff --git a/templates/security.hbs b/templates/security.hbs
new file mode 100644
index 0000000..04f86e8
--- /dev/null
+++ b/templates/security.hbs
@@ -0,0 +1,88 @@
+{{#each securityDefinitions}}
+### {{@key}}
+{{#this}}
+{{#ifeq type "oauth2"}}
+<table>
+ <tr>
+ <th>type</th>
+ <th colspan="2">{{type}}</th>
+ </tr>
+{{#if description}}
+ <tr>
+ <th>description</th>
+ <th colspan="2">{{description}}</th>
+ </tr>
+{{/if}}
+{{#if authorizationUrl}}
+ <tr>
+ <th>authorizationUrl</th>
+ <th colspan="2">{{authorizationUrl}}</th>
+ </tr>
+{{/if}}
+{{#if flow}}
+ <tr>
+ <th>flow</th>
+ <th colspan="2">{{flow}}</th>
+ </tr>
+{{/if}}
+{{#if tokenUrl}}
+ <tr>
+ <th>tokenUrl</th>
+ <th colspan="2">{{tokenUrl}}</th>
+ </tr>
+{{/if}}
+{{#if scopes}}
+ <tr>
+ <td rowspan="3">scopes</td>
+{{#each scopes}}
+ <td>{{@key}}</td>
+ <td>{{this}}</td>
+ </tr>
+ <tr>
+{{/each}}
+ </tr>
+{{/if}}
+</table>
+{{/ifeq}}
+{{#ifeq type "apiKey"}}
+<table>
+ <tr>
+ <th>type</th>
+ <th colspan="2">{{type}}</th>
+ </tr>
+{{#if description}}
+ <tr>
+ <th>description</th>
+ <th colspan="2">{{description}}</th>
+ </tr>
+{{/if}}
+{{#if name}}
+ <tr>
+ <th>name</th>
+ <th colspan="2">{{name}}</th>
+ </tr>
+{{/if}}
+{{#if in}}
+ <tr>
+ <th>in</th>
+ <th colspan="2">{{in}}</th>
+ </tr>
+{{/if}}
+</table>
+{{/ifeq}}
+{{#ifeq type "basic"}}
+<table>
+ <tr>
+ <th>type</th>
+ <th colspan="2">{{type}}</th>
+ </tr>
+{{#if description}}
+ <tr>
+ <th>description</th>
+ <th colspan="2">{{description}}</th>
+ </tr>
+{{/if}}
+</table>
+{{/ifeq}}
+{{/this}}
+{{/each}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/2513d0a6/templates/strapdown.html.hbs
----------------------------------------------------------------------
diff --git a/templates/strapdown.html.hbs b/templates/strapdown.html.hbs
new file mode 100644
index 0000000..ec02669
--- /dev/null
+++ b/templates/strapdown.html.hbs
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<title>API Document</title>
+
+<xmp theme="united" style="display:none;">
+{{>markdown}}
+</xmp>
+
+<script src="http://strapdownjs.com/v/0.2/strapdown.js"></script>
+</html>
\ No newline at end of file