Code Monkey home page Code Monkey logo

api-doclet's Introduction

API Doclet

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.

Sources of information

JAX-RS 2.0 annotations (JSR339 2.0 rev A)

Supported annotations:

Not yet supported:

BeanValidation (JSR303 1.0 final)

Currently not supported

JavaDoc tags

Tags per javax.ws.rs.Application

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)

Tags per resource class

annotation format description
@apiExternalDocs [description](url)
@apiDescription string

Tags per resource class' method

annotation format description
@apiOperationSummary string
@apiDescription string
@apiResponse [httpStatusCode](responseClass) description (responseClass) is optional

Reporter

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.

Known reporters

Swagger 2

<groupId>ch.webmate.api.doclet</groupId>
<artifactId>api-doclet-swagger2-reporter</artifactId>

Generates reports conforming to the swagger spec v2.0

Limitations

MatrixParam

Swagger 2 does not support matrix style parameters (@MatrixParam). The reporter will throw an error if it encounters a matrix style parameter.

HTTP methods

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).

Usage

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>

Contribution

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:

Branching

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 features
  • bugfix/... for bugfixes
  • improvement/... for improvements on existing features

Commit messages

  • 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

Code style guidelines

TBD

The source is validated against a slightly customized Sonar way profile of SonarQube 5.1.

Customization

Classes from "sun.*" packages should not be used

Excludes com.sun.javadoc since there is no non-sun API.

License

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.

api-doclet's People

Watchers

 avatar  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.