BisnodeInformatics/swagger-jaxrs-doclet

Name: swagger-jaxrs-doclet

Owner: Bisnode Informatics Deutschland

Description: fork: maven javadoclet for generating swagger json out of javadoc and jaxrs annotation

Created: 2014-06-25 12:28:42.0

Updated: 2014-06-25 16:35:57.0

Pushed: 2014-06-26 06:42:04.0

Homepage:

Size: 9314

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Bisnode Swagger Doclet

A JavaDoc Doclet that can be used to generate a Swagger resource listing suitable for feeding to swagger-ui.

Usage

To use the Swagger Doclet in your Maven project, add the following to your POM file.

l version="1.0" encoding="UTF-8"?>
ject xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>?</groupId>
<artifactId>?</artifactId>
<version>?</version>

<dependencies>
    ?
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9.1</version>
            <executions>
                <execution>
                    <id>generate-service-docs</id>
                    <phase>generate-resources</phase>
                    <configuration>
                        <doclet>com.hypnoticocelot.jaxrs.doclet.ServiceDoclet</doclet>
                        <docletArtifact>
                            <groupId>com.hypnoticocelot</groupId>
                            <artifactId>jaxrs-doclet</artifactId>
                            <version>Bisnode-SNAPSHOT</version>
                        </docletArtifact>
                        <reportOutputDirectory>${project.build.outputDirectory}</reportOutputDirectory>
                        <useStandardDocletOptions>false</useStandardDocletOptions>
                        <additionalparam>-apiVersion 1 -docBasePath /apidocs -yukonPath /${jaxrs.path}</additionalparam>
                    </configuration>
                    <goals>
                        <goal>javadoc</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
l>
Example

An example project using Dropwizard is included in jaxrs-doclet-sample-dropwizard. To get it running, run the following commands.

 jaxrs-doclet-sample-dropwizard
n package
va -jar target/jaxrs-doclet-sample-dropwizard-Bisnode-SNAPSHOT.jar server sample.yml

The example server should be running on port 8080:

rl localhost:8080/apidocs/service.json

piVersion" : "1",
asePath" : "/apidocs/",
pis" : [ {
"path" : "/Auth.{format}",
"description" : ""
 {
"path" : "/HttpServletRequest.{format}",
"description" : ""
 {
"path" : "/ModelResource_modelid.{format}",
"description" : ""
 {
"path" : "/Recursive.{format}",
"description" : ""
 {
"path" : "/Response.{format}",
"description" : ""
 {
"path" : "/greetings_name.{format}",
"description" : ""
],
waggerVersion" : "1.1"


Override Swagger UI

To override the swagger ui included with the doclet, create your own swagger-ui.zip file and add a swaggerUiZipPath to the additionalparam attribute in the pom file.

itionalparam>-apiVersion 1 -docBasePath /apidocs -apiBasePath / -swaggerUiZipPath ../../../src/main/resources/swagger-ui.zip</additionalparam>

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.