Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Files

Latest commit

 

History

History

dropwizard-raml-apidocs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

DropWizard API Docs Bundle

This library contains a DropWizard Bundle that can be added to your service with the goal of providing a human-readable endpoint for describing your API specification.

The bundle will log errors and and return 503 Service Unavailable errors if there is an issue trying to initialize the bundle.

It will not cause the application from starting.

Note: Due to current limitations in Mulesoft's JVM libraries, the bundle is currently unable to provide a raw dump of the RAML specification at runtime.

Dependency

Maven

<dependency>
    <groupId>net.ozwolf</groupId>
    <artifactId>dropwizard-raml-apidocs</artifactId>
    <version>2.1.0</version>
</dependency>

Gradle

compile 'net.ozwolf:dropwizard-raml-generator:2.1.0'

Example Usage

Runtime Package Scanning

public class MyApp extends Application<MyAppConfiguration> {
    @Override
    public String getName() {
        return "my-app";
    }
    
    @Override
    public void initialize(Bootstrap<MyAppConfiguration> bootstrap){
        bootstrap.addBundle(new ApiDocsBundle("com.my.app", PropertyUtils.getValueFrom("application.properties", "version")));
    }
}

Existing RAML Specification File

public class MyApp extends Application<MyAppConfiguration> {
    @Override
    public String getName() {
        return "my-app";
    }
    
    @Override
    public void initialize(Bootstrap<MyAppConfiguration> bootstrap){
        bootstrap.addBundle(new ApiDocsBundle("apidocs/apidocs.yml"));
    }
}

Viewing API Specifications

Your API specifications can then be viewed via the /apidocs resource on your application's operations pot.