Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit c0abd99

Browse files
committed
jdk9 support and updated UI
1 parent ff13841 commit c0abd99

File tree

36 files changed

+454
-35
lines changed

36 files changed

+454
-35
lines changed

java/inflector-dropwizard-guice/pom.xml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@
2525
<version>1.0.0-SNAPSHOT</version>
2626

2727
<properties>
28-
<dropwizard-version>1.0.2</dropwizard-version>
28+
<maven.compiler.source>1.8</maven.compiler.source>
29+
<maven.compiler.target>1.8</maven.compiler.target>
30+
31+
<dropwizard-version>1.3.1</dropwizard-version>
2932
<inflector-version>2.0.0-SNAPSHOT</inflector-version>
30-
<jackson.version>2.8.9</jackson.version>
33+
<jackson.version>2.9.5</jackson.version>
3134
<jersey2.version>2.23.1</jersey2.version>
3235
</properties>
3336

@@ -102,6 +105,10 @@
102105
<artifactId>swagger-inflector</artifactId>
103106
<version>${inflector-version}</version>
104107
<exclusions>
108+
<exclusion>
109+
<groupId>org.glassfish.jersey.inject</groupId>
110+
<artifactId>jersey-hk2</artifactId>
111+
</exclusion>
105112
<exclusion>
106113
<groupId>ch.qos.logback</groupId>
107114
<artifactId>logback-classic</artifactId>

java/inflector-dropwizard/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ java -jar ./target/inflector-dropwizard-sample-1.0.0-SNAPSHOT.jar server server.
1717
You can get to the swagger file at:
1818

1919
```
20-
http://localhost:8080/v2/swagger.json
20+
http://localhost:8080/v2/openapi.json
2121
```
2222

2323
Have fun!

java/inflector-dropwizard/pom.xml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@
2525
<version>1.0.0-SNAPSHOT</version>
2626

2727
<properties>
28-
<dropwizard-version>1.0.2</dropwizard-version>
28+
<maven.compiler.source>1.8</maven.compiler.source>
29+
<maven.compiler.target>1.8</maven.compiler.target>
30+
31+
<dropwizard-version>1.3.1</dropwizard-version>
2932
<inflector-version>2.0.0-SNAPSHOT</inflector-version>
30-
<jackson.version>2.8.9</jackson.version>
31-
<jersey2.version>2.23.1</jersey2.version>
33+
<jackson.version>2.9.5</jackson.version>
34+
<jersey2.version>2.25.1</jersey2.version>
3235
</properties>
3336

3437
<dependencies>
@@ -39,12 +42,6 @@
3942
<version>${dropwizard-version}</version>
4043
</dependency>
4144

42-
<dependency>
43-
<groupId>org.glassfish.jersey.core</groupId>
44-
<artifactId>jersey-server</artifactId>
45-
<version>${jersey2.version}</version>
46-
</dependency>
47-
4845
<dependency>
4946
<groupId>org.glassfish.jersey.containers</groupId>
5047
<artifactId>jersey-container-servlet-core</artifactId>
@@ -110,6 +107,12 @@
110107
<version>${jackson.version}</version>
111108
</dependency>
112109

110+
<dependency>
111+
<groupId>com.fasterxml.jackson.module</groupId>
112+
<artifactId>jackson-module-afterburner</artifactId>
113+
<version>${jackson.version}</version>
114+
</dependency>
115+
113116
</dependencies>
114117

115118

java/inflector-jetty-webxml/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@
117117
</dependency>
118118
</dependencies>
119119
<properties>
120+
<maven.compiler.source>1.8</maven.compiler.source>
121+
<maven.compiler.target>1.8</maven.compiler.target>
122+
120123
<maven-plugin-version>1.0.0</maven-plugin-version>
121124
<jetty-version>9.4.9.v20180320</jetty-version>
122125
<logback-version>1.0.1</logback-version>

java/java-dropwizard/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ java -jar target/swagger-java-dropwizard-sample-app-2.0.0.jar server conf/swagge
1616
1717
```
1818

19-
This will start Jetty embedded on port 8002.
19+
This will start Dropwizard app on port 8080.
2020

2121
### Testing the server
2222

23-
Once started, you can navigate to http://localhost:8080/openapi.json or http://localhost:8080/openapi.yaml to view the Swagger Resource Listing.
23+
Once started, you can navigate to http://localhost:8080/api/openapi.json or http://localhost:8080/api/openapi.yaml to view the Swagger Resource Listing.
2424
This tells you that the server is up and ready to demonstrate Swagger.
25+
26+
### Using the UI
27+
There is an HTML5-based API tool bundled in this sample--you can view it it at [http://localhost:8080](http://localhost:8080). This lets you inspect the API using an interactive UI. You can access the source of this code from [here](https://github.com/swagger-api/swagger-ui)

java/java-dropwizard/conf/swagger-sample.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
defaultName: Swagger-sample
2+
server:
3+
rootPath: /api/
24
logging:
35
level: ERROR
46
appenders:

java/java-dropwizard/pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
<executions>
6868
<execution>
6969
<id>swagger-ui</id>
70+
<phase>validate</phase>
7071
<goals>
7172
<goal>wget</goal>
7273
</goals>
@@ -89,7 +90,7 @@
8990
<goal>copy-resources</goal>
9091
</goals>
9192
<configuration>
92-
<outputDirectory>target/${project.artifactId}-${project.version}</outputDirectory>
93+
<outputDirectory>target/classes/app</outputDirectory>
9394
<resources>
9495
<resource>
9596
<directory>${project.build.directory}/swagger-ui-master/dist</directory>
@@ -118,7 +119,7 @@
118119
<dependency>
119120
<groupId>io.dropwizard</groupId>
120121
<artifactId>dropwizard-bom</artifactId>
121-
<version>1.0.2</version>
122+
<version>1.3.1</version>
122123
<type>pom</type>
123124
<scope>import</scope>
124125
</dependency>
@@ -139,6 +140,10 @@
139140
<groupId>io.dropwizard</groupId>
140141
<artifactId>dropwizard-core</artifactId>
141142
</dependency>
143+
<dependency>
144+
<groupId>io.dropwizard</groupId>
145+
<artifactId>dropwizard-assets</artifactId>
146+
</dependency>
142147
<dependency>
143148
<groupId>io.swagger.core.v3</groupId>
144149
<artifactId>swagger-jaxrs2</artifactId>

java/java-dropwizard/src/main/java/io/swagger/sample/SwaggerSampleApplication.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.fasterxml.jackson.annotation.JsonInclude;
44

55
import io.dropwizard.Application;
6+
import io.dropwizard.assets.AssetsBundle;
67
import io.dropwizard.setup.Bootstrap;
78
import io.dropwizard.setup.Environment;
89
import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource;
@@ -22,7 +23,10 @@ public static void main(String[] args) throws Exception {
2223
}
2324

2425
@Override
25-
public void initialize(Bootstrap<SwaggerSampleConfiguration> bootstrap) { }
26+
public void initialize(Bootstrap<SwaggerSampleConfiguration> bootstrap) {
27+
// UI
28+
bootstrap.addBundle(new AssetsBundle("/app", "/", "index.html", "static"));
29+
}
2630

2731
@Override
2832
public String getName() {
@@ -78,6 +82,5 @@ public void run(SwaggerSampleConfiguration configuration, Environment environmen
7882
// or
7983
//environment.jersey().register(new OpenApiResource().resourceClasses("io.swagger.sample.resource.PetResource"));
8084

81-
8285
}
8386
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<!-- HTML for static distribution bundle build -->
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<head>
5+
<meta charset="UTF-8">
6+
<title>Swagger UI</title>
7+
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
8+
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
9+
<link rel="icon" type="image/png" href="../public/favicon-32x32.png" sizes="32x32" />
10+
<link rel="icon" type="image/png" href="../public/favicon-16x16.png" sizes="16x16" />
11+
<style>
12+
html
13+
{
14+
box-sizing: border-box;
15+
overflow: -moz-scrollbars-vertical;
16+
overflow-y: scroll;
17+
}
18+
*,
19+
*:before,
20+
*:after
21+
{
22+
box-sizing: inherit;
23+
}
24+
25+
body {
26+
margin:0;
27+
background: #fafafa;
28+
}
29+
</style>
30+
</head>
31+
32+
<body>
33+
34+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
35+
<defs>
36+
<symbol viewBox="0 0 20 20" id="unlocked">
37+
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
38+
</symbol>
39+
40+
<symbol viewBox="0 0 20 20" id="locked">
41+
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
42+
</symbol>
43+
44+
<symbol viewBox="0 0 20 20" id="close">
45+
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
46+
</symbol>
47+
48+
<symbol viewBox="0 0 20 20" id="large-arrow">
49+
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
50+
</symbol>
51+
52+
<symbol viewBox="0 0 20 20" id="large-arrow-down">
53+
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
54+
</symbol>
55+
56+
57+
<symbol viewBox="0 0 24 24" id="jump-to">
58+
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
59+
</symbol>
60+
61+
<symbol viewBox="0 0 24 24" id="expand">
62+
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
63+
</symbol>
64+
65+
</defs>
66+
</svg>
67+
68+
<div id="swagger-ui"></div>
69+
70+
<script src="./swagger-ui-bundle.js"> </script>
71+
<script src="./swagger-ui-standalone-preset.js"> </script>
72+
<script>
73+
window.onload = function() {
74+
var url = window.location.search.match(/url=([^&]+)/);
75+
if (url && url.length > 1) {
76+
url = decodeURIComponent(url[1]);
77+
} else {
78+
url = 'http://localhost:8080/api/openapi.json';
79+
}
80+
81+
// Build a system
82+
const ui = SwaggerUIBundle({
83+
url: url,
84+
dom_id: '#swagger-ui',
85+
presets: [
86+
SwaggerUIBundle.presets.apis,
87+
SwaggerUIStandalonePreset
88+
],
89+
plugins: [
90+
SwaggerUIBundle.plugins.DownloadUrl
91+
],
92+
layout: "StandaloneLayout"
93+
})
94+
95+
window.ui = ui
96+
}
97+
</script>
98+
</body>
99+
100+
</html>

java/java-jaxrs2-openapiservlet-resourceslib/pom.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,34 @@
111111
<artifactId>javax.ws.rs-api</artifactId>
112112
<version>2.1</version>
113113
</dependency>
114+
<dependency>
115+
<groupId>javax.activation</groupId>
116+
<artifactId>javax.activation-api</artifactId>
117+
</dependency>
118+
<dependency>
119+
<groupId>com.sun.xml.bind</groupId>
120+
<artifactId>jaxb-impl</artifactId>
121+
</dependency>
122+
<dependency>
123+
<groupId>com.sun.xml.bind</groupId>
124+
<artifactId>jaxb-core</artifactId>
125+
</dependency>
126+
<dependency>
127+
<groupId>com.sun.xml.bind</groupId>
128+
<artifactId>jaxb-jxc</artifactId>
129+
</dependency>
130+
<dependency>
131+
<groupId>com.sun.xml.bind</groupId>
132+
<artifactId>jaxb-xjc</artifactId>
133+
</dependency>
134+
<dependency>
135+
<groupId>com.sun.xml.ws</groupId>
136+
<artifactId>jaxws-ri</artifactId>
137+
<version>2.3.0</version>
138+
<type>pom</type>
139+
</dependency>
140+
141+
114142
<dependency>
115143
<groupId>ch.qos.logback</groupId>
116144
<artifactId>logback-classic</artifactId>

java/java-jaxrs2-resources/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<groupId>io.swagger.core.v3</groupId>
3030
<artifactId>swagger-jaxrs2</artifactId>
3131
<scope>compile</scope>
32-
<version>2.0.0-SNAPSHOT</version>
32+
<version>2.0.1</version>
3333
</dependency>
3434
<dependency>
3535
<groupId>javax.servlet</groupId>

java/java-jersey2-alternatives/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,5 +183,25 @@
183183
<artifactId>jersey-hk2</artifactId>
184184
<version>${jersey2-version}</version>
185185
</dependency>
186+
<dependency>
187+
<groupId>javax.activation</groupId>
188+
<artifactId>javax.activation-api</artifactId>
189+
</dependency>
190+
<dependency>
191+
<groupId>com.sun.xml.bind</groupId>
192+
<artifactId>jaxb-impl</artifactId>
193+
</dependency>
194+
<dependency>
195+
<groupId>com.sun.xml.bind</groupId>
196+
<artifactId>jaxb-core</artifactId>
197+
</dependency>
198+
<dependency>
199+
<groupId>com.sun.xml.bind</groupId>
200+
<artifactId>jaxb-jxc</artifactId>
201+
</dependency>
202+
<dependency>
203+
<groupId>com.sun.xml.bind</groupId>
204+
<artifactId>jaxb-xjc</artifactId>
205+
</dependency>
186206
</dependencies>
187207
</project>

java/java-jersey2-alternatives/src/main/webapp/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
window.onload = function() {
7474
// Build a system
7575
const ui = SwaggerUIBundle({
76-
url: "http://localhost:8002/openapi/swagger.json",
76+
url: "http://localhost:8002/api/openapi.json",
7777
dom_id: '#swagger-ui',
7878
presets: [
7979
SwaggerUIBundle.presets.apis,

java/java-jersey2-appclasses/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,5 +186,25 @@
186186
<artifactId>jersey-hk2</artifactId>
187187
<version>${jersey2-version}</version>
188188
</dependency>
189+
<dependency>
190+
<groupId>javax.activation</groupId>
191+
<artifactId>javax.activation-api</artifactId>
192+
</dependency>
193+
<dependency>
194+
<groupId>com.sun.xml.bind</groupId>
195+
<artifactId>jaxb-impl</artifactId>
196+
</dependency>
197+
<dependency>
198+
<groupId>com.sun.xml.bind</groupId>
199+
<artifactId>jaxb-core</artifactId>
200+
</dependency>
201+
<dependency>
202+
<groupId>com.sun.xml.bind</groupId>
203+
<artifactId>jaxb-jxc</artifactId>
204+
</dependency>
205+
<dependency>
206+
<groupId>com.sun.xml.bind</groupId>
207+
<artifactId>jaxb-xjc</artifactId>
208+
</dependency>
189209
</dependencies>
190210
</project>

0 commit comments

Comments
 (0)