Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ jobs:
continue-on-error: false
steps:
- name: Checking out code base
uses: actions/checkout@v2
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v5
with:
java-version: 11
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ target
*.iws
/dep
out
.DS_Store
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright © 2021 Vector Pro
Copyright © 2021 Vector Pro (teamvectorpro@googlegroups.com)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
Dropwizard Swagger Integration
==================

[![Apache License V2.0](http://img.shields.io/badge/license-Apache%20V2-50ca22.svg)](//github.com/Vect0rPro/dropwizard-swagger/blob/master/LICENSE)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/in.vectorpro.dropwizard/dropwizard-swagger/badge.svg)](https://maven-badges.herokuapp.com/maven-central/in.vectorpro.dropwizard/dropwizard-swagger)
[![Apache License V2.0](https://img.shields.io/badge/License-Apache%20V2-50ca22.svg)](https://github.com/Vect0rPro/dropwizard-swagger/blob/master/LICENSE)
[![Maven Central](https://img.shields.io/maven-central/v/in.vectorpro.dropwizard/dropwizard-swagger?label=Maven%20Central&color=50ca22)](https://central.sonatype.com/artifact/in.vectorpro.dropwizard/dropwizard-swagger)

A Dropwizard bundle that serves Swagger UI static content and loads Swagger endpoints.

Current version has been tested with Dropwizard 2.0.28 and Swagger 2.1.13 which supports OpenApi 3.0 specifications
Current version has been tested with Dropwizard 2.1.12 and Swagger 2.2.2 which supports OpenApi 3.0 specifications

Requirements
--------------
* Dropwizard 2.0.28
* Swagger API 2.1.13
* Swagger UI 4.6.2
* Dropwizard 2.1.12
* Swagger API 2.2.2
* Swagger UI 5.27.0

Usage
-------------
Expand All @@ -23,7 +23,7 @@ Usage
<dependency>
<groupId>in.vectorpro.dropwizard</groupId>
<artifactId>dropwizard-swagger</artifactId>
<version>2.0.28-2</version>
<version>2.1.12-1</version>
</dependency>
```

Expand All @@ -46,8 +46,19 @@ prop2: value2
# the only required property is resourcePackage, for more config options see below
swagger:
resourcePackage: <a comma separated string of the packages that contain your @OpenAPIDefinition annotated resources>

# Configure page title or code snippet targets as needed
swaggerViewConfiguration:
pageTitle: "API Documentation"
# Default value of code snippet targets is always provided by the bundle
# Include supported snippet targets as per link provided below if modification to default value is required
codeSnippetTargets:
- java_okhttp
- python_requests
```

Supported code snippet targets: [link](https://github.com/tronto20/swagger-snippet-generator?tab=readme-ov-file#targets)

* In your Application class:

```java
Expand Down
114 changes: 78 additions & 36 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<groupId>in.vectorpro.dropwizard</groupId>
<artifactId>dropwizard-swagger</artifactId>

<version>2.0.28-3</version>
<version>2.1.12-1</version>
<name>Dropwizard Swagger v2.x and OpenAPI 3.x Integration</name>
<url>https://github.com/Vect0rPro/dropwizard-swagger</url>
<description>A simple way to document your REST APIs in Dropwizard using Swagger</description>
Expand Down Expand Up @@ -69,17 +69,6 @@
<url>https://github.com/Vect0rPro/dropwizard-swagger/issues</url>
</issueManagement>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<properties>
<maven.compiler.release>8</maven.compiler.release>
<maven.compiler.source>1.8</maven.compiler.source>
Expand All @@ -89,12 +78,12 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<file.encoding>UTF-8</file.encoding>

<dropwizard.version>2.0.28</dropwizard.version>
<guava.version>30.1.1-jre</guava.version>
<junit.jupiter.version>5.8.2</junit.jupiter.version>
<swagger.version>2.1.13</swagger.version>
<dropwizard.swagger.ui.version>4.6.2</dropwizard.swagger.ui.version>
<javassist.version>3.28.0-GA</javassist.version>
<dropwizard.version>2.1.12</dropwizard.version>
<guava.version>33.5.0-jre</guava.version>
<junit.jupiter.version>5.10.5</junit.jupiter.version>
<swagger.version>2.2.2</swagger.version>
<dropwizard.swagger.ui.version>5.27.0</dropwizard.swagger.ui.version>
<javassist.version>3.30.2-GA</javassist.version>
</properties>

<dependencyManagement>
Expand All @@ -104,6 +93,13 @@
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-bom</artifactId>
<version>${dropwizard.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -184,7 +180,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<version>3.2.8</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -195,6 +191,15 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.9.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand All @@ -206,20 +211,20 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.14.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<version>3.5.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<version>3.5.4</version>
<executions>
<execution>
<goals>
Expand All @@ -232,7 +237,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -245,7 +250,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
Expand All @@ -257,20 +262,20 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.14.1</version>
<configuration>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<version>3.9.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<version>3.12.0</version>
<configuration>
<additionalOptions>
<option>-html5</option>
Expand All @@ -286,15 +291,52 @@
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.12</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.6.2</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<fail>true</fail>
<rules>
<requireFilesExist>
<files>
<file>LICENSE</file>
</files>
</requireFilesExist>
<requireFileChecksum>
<file>LICENSE</file>
<checksum>52965201dab336f278d9ca6786e36b69cd0db6fbbac88d05923004518fe4166d</checksum>
<type>sha256</type>
</requireFileChecksum>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>bom-builder-maven-plugin</artifactId>
<version>1.2.0</version>
<executions>
<execution>
<id>build-bom</id>
<phase>package</phase>
<goals>
<goal>build-bom</goal>
</goals>
<configuration>
<bomGroupId>${project.groupId}</bomGroupId>
<bomArtifactId>${project.artifactId}-bom</bomArtifactId>
<bomVersion>${project.version}</bomVersion>
<bomName>${project.name} :: Bill of Materials</bomName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
29 changes: 3 additions & 26 deletions src/main/java/in/vectorpro/dropwizard/swagger/SwaggerView.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,32 +86,9 @@ public String getContextPath() {
return contextPath;
}

/**
* Returns the location of the validator URL or null to disable
*
* @return String
*/
@Nullable
public String getValidatorUrl() {
return viewConfiguration.getValidatorUrl();
}

/**
* Returns whether to display the authorization input boxes
*
* @return String
*/
public boolean getShowAuth() {
return viewConfiguration.isShowAuth();
}

/**
* Returns whether to display the swagger spec selector
*
* @return boolean
*/
public boolean getShowApiSelector() {
return viewConfiguration.isShowApiSelector();
/** @return {@link SwaggerViewConfiguration} containing every properties to customize swagger */
public SwaggerViewConfiguration getViewConfiguration() {
return viewConfiguration;
}

/** @return {@link SwaggerOAuth2Configuration} containing every properties to init oauth2 */
Expand Down
Loading