This project provides a JavaDoc doclet that collects various information about an API and uses one or more exchangeable reporters to create an API documentation.
JAX-RS 2.0 annotations (JSR339 2.0 rev A)
Supported annotations:
@ApplicationPath
@Path
@Produces
@Consumes
- standard method designators
- custom method designators (annotations annotated
@HttpMethod
) - params
@DefaultValue
- HTTP body payload
Not yet supported:
BeanValidation (JSR303 1.0 final)
Currently not supported
annotation | format | description |
---|---|---|
@apiTitle | string |
|
@apiVersion | string |
|
@apiHost | string |
|
@apiBasePath | string |
|
@apiDescription | string |
|
@apiExternalDocs | [description](url) |
|
@apiTermsOfService | string |
|
@apiContactName | string |
|
@apiContactEmail | string |
|
@apiContactUrl | url |
|
@apiLicense | [name](url) |
annotation | format | description |
---|---|---|
@apiExternalDocs | [description](url) |
|
@apiDescription | string |
annotation | format | description |
---|---|---|
@apiOperationSummary | string |
|
@apiDescription | string |
|
@apiResponse | [httpStatusCode](responseClass) description |
(responseClass) is optional |
The doclet itself does not write any report but invokes any reporter on the class path.
A reporter implements ch.webmate.api.doclet.reporter.ApiReporter and is registered as a Java 6 service.
<groupId>ch.webmate.api.doclet</groupId>
<artifactId>api-doclet-swagger2-reporter</artifactId>
Generates reports conforming to the swagger spec v2.0
Swagger 2 does not support matrix style parameters
(@MatrixParam
).
The reporter will throw an error if it encounters a matrix style parameter.
Swagger 2 supports the http methods GET
, POST
, DELETE
, PUT
and PATCH
. The
reporter will throw an error if it encounters any other http method (e.g. OPTIONS
).
Simply add the doclet and the reporter of your choice to your build.
The following example shows how to add the doclet and the swagger2 reporter to a maven build.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<executions>
<execution>
<id>generate-swagger2-spec</id>
<goals>
<goal>javadoc</goal>
</goals>
<phase>generate-resources</phase>
</execution>
</executions>
<configuration>
<doclet>ch.webmate.api.doclet.ApiDoclet</doclet>
<docletArtifact>
<groupId>ch.webmate.api.doclet</groupId>
<artifactId>api-doclet</artifactId>
<version>${project.version}</version>
</docletArtifact>
<!-- TODO: this currently doesn't work -->
<additionalDependencies>
<additionalDependency>
<groupId>ch.webmate.api.doclet</groupId>
<artifactId>api-doclet-swagger2-reporter</artifactId>
<version>${project.version}</version>
</additionalDependency>
</additionalDependencies>
<useStandardDocletOptions>false</useStandardDocletOptions>
</configuration>
</plugin>
</plugins>
</build>
Do not hesitate, we appreciate every contribution. Do not fear non-perfect Pull Requests, nobody is perfect.
When contributing please stick to the following guides:
Please add every feature/bugfix in a separate branch and create a pull request to the develop branch.
We stick to the following naming conventions for branches:
feature/...
for new featuresbugfix/...
for bugfixesimprovement/...
for improvements on existing features
- Begin your commit message with a verb in the imperative.
(E.g.
Introduce foo bar
,Fix baz
, ...) - Try to have small, atomic commits.
- First line of a commit message should sum up your changes and should not be longer than 50 characters.
- Second line should be empty
- Third and following lines can optionally contain a longer description
TBD
The source is validated against a slightly customized Sonar way
profile of SonarQube 5.1.
Excludes com.sun.javadoc since there is no non-sun API.
The MIT License (MIT)
Copyright (c) 2015 Sven Tschui
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.