Skip to content

Commit ea02a4f

Browse files
authored
#1 Host OpenAPI specification web page (#4)
1 parent 6f9e517 commit ea02a4f

File tree

17 files changed

+432
-6
lines changed

17 files changed

+432
-6
lines changed

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"java.configuration.updateBuildConfiguration": "automatic"
3+
}

compose.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
services:
2+
matchmaker:
3+
image: eclipse-temurin:17-jdk-alpine
4+
volumes:
5+
- ./matchmaker/app/target/matchmaker-app-1.0.0.jar:/matchmaker.jar
6+
command: java -jar /matchmaker.jar
7+
ports:
8+
- 8080:8080
9+
people:
10+
image: eclipse-temurin:17-jdk-alpine
11+
volumes:
12+
- ./people/app/target/people-app-1.0.0.jar:/people.jar
13+
command: java -jar /people.jar
14+
ports:
15+
- 8081:8080

matchmaker/api/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<artifactId>matchmaker-api</artifactId>
1313
<version>1.0.0</version>
14-
<packaging>pom</packaging>
14+
<packaging>jar</packaging>
1515
<name>matchmaker-api</name>
1616

1717
<build>

people/api/src/main/resources/api.yml matchmaker/api/src/main/resources/static/openapi/api.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
swagger: "2.0"
33
info:
44
version: "1.0.0"
5-
title: "Swagger Petstore"
5+
title: "Swagger Petstore: Matchmaker"
66
description: "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification"
77
termsOfService: "http://swagger.io/terms/"
88
contact:

matchmaker/app/pom.xml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>ru.ifmo.se.dating</groupId>
8+
<artifactId>matchmaker</artifactId>
9+
<version>1.0.0</version>
10+
</parent>
11+
12+
<artifactId>matchmaker-app</artifactId>
13+
<version>1.0.0</version>
14+
<packaging>jar</packaging>
15+
<name>matchmaker-app</name>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>ru.ifmo.se.dating</groupId>
20+
<artifactId>matchmaker-server</artifactId>
21+
</dependency>
22+
<dependency>
23+
<groupId>org.springframework.boot</groupId>
24+
<artifactId>spring-boot-starter-web</artifactId>
25+
</dependency>
26+
<dependency>
27+
<groupId>org.springdoc</groupId>
28+
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
29+
</dependency>
30+
</dependencies>
31+
32+
<build>
33+
<plugins>
34+
<plugin>
35+
<groupId>org.springframework.boot</groupId>
36+
<artifactId>spring-boot-maven-plugin</artifactId>
37+
<configuration>
38+
<mainClass>ru.ifmo.se.dating.matchmaker.Main</mainClass>
39+
</configuration>
40+
<executions>
41+
<execution>
42+
<goals>
43+
<goal>repackage</goal>
44+
</goals>
45+
</execution>
46+
</executions>
47+
</plugin>
48+
</plugins>
49+
</build>
50+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package ru.ifmo.se.dating.matchmaker;
2+
3+
import org.springframework.boot.autoconfigure.SpringBootApplication;
4+
import org.springframework.boot.SpringApplication;
5+
6+
@SpringBootApplication
7+
public class Main {
8+
public static void main(String[] args) {
9+
SpringApplication.run(Main.class, args);
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
springdoc:
2+
api-docs:
3+
path: /openapi
4+
swagger-ui:
5+
url: /openapi/api.yml
6+
path: /swagger-ui.html

matchmaker/pom.xml

+2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@
1616

1717
<modules>
1818
<module>api</module>
19+
<module>app</module>
20+
<module>server</module>
1921
</modules>
2022
</project>

matchmaker/server/pom.xml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>ru.ifmo.se.dating</groupId>
8+
<artifactId>matchmaker</artifactId>
9+
<version>1.0.0</version>
10+
</parent>
11+
12+
<artifactId>matchmaker-server</artifactId>
13+
<version>1.0.0</version>
14+
<packaging>jar</packaging>
15+
<name>matchmaker-server</name>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>ru.ifmo.se.dating</groupId>
20+
<artifactId>matchmaker-api</artifactId>
21+
</dependency>
22+
23+
<dependency>
24+
<groupId>io.swagger.core.v3</groupId>
25+
<artifactId>swagger-annotations</artifactId>
26+
</dependency>
27+
<dependency>
28+
<groupId>io.swagger.core.v3</groupId>
29+
<artifactId>swagger-models</artifactId>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.openapitools</groupId>
33+
<artifactId>jackson-databind-nullable</artifactId>
34+
</dependency>
35+
36+
<dependency>
37+
<groupId>org.springframework</groupId>
38+
<artifactId>spring-web</artifactId>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.springframework</groupId>
42+
<artifactId>spring-context</artifactId>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.springframework.boot</groupId>
46+
<artifactId>spring-boot</artifactId>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.springframework.boot</groupId>
50+
<artifactId>spring-boot-starter-web</artifactId>
51+
</dependency>
52+
53+
<dependency>
54+
<groupId>javax.validation</groupId>
55+
<artifactId>validation-api</artifactId>
56+
</dependency>
57+
<dependency>
58+
<groupId>javax.servlet</groupId>
59+
<artifactId>javax.servlet-api</artifactId>
60+
<scope>provided</scope>
61+
</dependency>
62+
<dependency>
63+
<groupId>javax.annotation</groupId>
64+
<artifactId>javax.annotation-api</artifactId>
65+
<version>1.3.2</version>
66+
</dependency>
67+
68+
<dependency>
69+
<groupId>com.fasterxml.jackson.core</groupId>
70+
<artifactId>jackson-databind</artifactId>
71+
</dependency>
72+
</dependencies>
73+
74+
<build>
75+
<plugins>
76+
<plugin>
77+
<groupId>org.openapitools</groupId>
78+
<artifactId>openapi-generator-maven-plugin</artifactId>
79+
<executions>
80+
<execution>
81+
<configuration>
82+
<inputSpec>${project.basedir}/../api/src/main/resources/static/openapi/api.yml</inputSpec>
83+
<generatorName>spring</generatorName>
84+
</configuration>
85+
</execution>
86+
</executions>
87+
</plugin>
88+
</plugins>
89+
</build>
90+
</project>

people/api/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<artifactId>people-api</artifactId>
1313
<version>1.0.0</version>
14-
<packaging>pom</packaging>
14+
<packaging>jar</packaging>
1515
<name>people-api</name>
1616

1717
<build>

matchmaker/api/src/main/resources/api.yml people/api/src/main/resources/static/openapi/api.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
swagger: "2.0"
33
info:
44
version: "1.0.0"
5-
title: "Swagger Petstore"
5+
title: "Swagger Petstore: People"
66
description: "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification"
77
termsOfService: "http://swagger.io/terms/"
88
contact:

people/app/pom.xml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>ru.ifmo.se.dating</groupId>
8+
<artifactId>people</artifactId>
9+
<version>1.0.0</version>
10+
</parent>
11+
12+
<artifactId>people-app</artifactId>
13+
<version>1.0.0</version>
14+
<packaging>jar</packaging>
15+
<name>people-app</name>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>ru.ifmo.se.dating</groupId>
20+
<artifactId>people-server</artifactId>
21+
</dependency>
22+
<dependency>
23+
<groupId>org.springframework.boot</groupId>
24+
<artifactId>spring-boot-starter-web</artifactId>
25+
</dependency>
26+
<dependency>
27+
<groupId>org.springdoc</groupId>
28+
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
29+
</dependency>
30+
</dependencies>
31+
32+
<build>
33+
<plugins>
34+
<plugin>
35+
<groupId>org.springframework.boot</groupId>
36+
<artifactId>spring-boot-maven-plugin</artifactId>
37+
<configuration>
38+
<mainClass>ru.ifmo.se.dating.people.Main</mainClass>
39+
</configuration>
40+
<executions>
41+
<execution>
42+
<goals>
43+
<goal>repackage</goal>
44+
</goals>
45+
</execution>
46+
</executions>
47+
</plugin>
48+
</plugins>
49+
</build>
50+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package ru.ifmo.se.dating.people;
2+
3+
import org.springframework.boot.autoconfigure.SpringBootApplication;
4+
import org.springframework.boot.SpringApplication;
5+
6+
@SpringBootApplication
7+
public class Main {
8+
public static void main(String[] args) {
9+
SpringApplication.run(Main.class, args);
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
springdoc:
2+
api-docs:
3+
path: /openapi
4+
swagger-ui:
5+
url: /openapi/api.yml
6+
path: /swagger-ui.html

people/pom.xml

+2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@
1616

1717
<modules>
1818
<module>api</module>
19+
<module>app</module>
20+
<module>server</module>
1921
</modules>
2022
</project>

people/server/pom.xml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>ru.ifmo.se.dating</groupId>
8+
<artifactId>people</artifactId>
9+
<version>1.0.0</version>
10+
</parent>
11+
12+
<artifactId>people-server</artifactId>
13+
<version>1.0.0</version>
14+
<packaging>jar</packaging>
15+
<name>people-server</name>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>ru.ifmo.se.dating</groupId>
20+
<artifactId>people-api</artifactId>
21+
</dependency>
22+
23+
<dependency>
24+
<groupId>io.swagger.core.v3</groupId>
25+
<artifactId>swagger-annotations</artifactId>
26+
</dependency>
27+
<dependency>
28+
<groupId>io.swagger.core.v3</groupId>
29+
<artifactId>swagger-models</artifactId>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.openapitools</groupId>
33+
<artifactId>jackson-databind-nullable</artifactId>
34+
</dependency>
35+
36+
<dependency>
37+
<groupId>org.springframework</groupId>
38+
<artifactId>spring-web</artifactId>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.springframework</groupId>
42+
<artifactId>spring-context</artifactId>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.springframework.boot</groupId>
46+
<artifactId>spring-boot</artifactId>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.springframework.boot</groupId>
50+
<artifactId>spring-boot-starter-web</artifactId>
51+
</dependency>
52+
53+
<dependency>
54+
<groupId>javax.validation</groupId>
55+
<artifactId>validation-api</artifactId>
56+
</dependency>
57+
<dependency>
58+
<groupId>javax.servlet</groupId>
59+
<artifactId>javax.servlet-api</artifactId>
60+
<scope>provided</scope>
61+
</dependency>
62+
<dependency>
63+
<groupId>javax.annotation</groupId>
64+
<artifactId>javax.annotation-api</artifactId>
65+
<version>1.3.2</version>
66+
</dependency>
67+
68+
<dependency>
69+
<groupId>com.fasterxml.jackson.core</groupId>
70+
<artifactId>jackson-databind</artifactId>
71+
</dependency>
72+
</dependencies>
73+
74+
<build>
75+
<plugins>
76+
<plugin>
77+
<groupId>org.openapitools</groupId>
78+
<artifactId>openapi-generator-maven-plugin</artifactId>
79+
<executions>
80+
<execution>
81+
<configuration>
82+
<inputSpec>${project.basedir}/../api/src/main/resources/static/openapi/api.yml</inputSpec>
83+
<generatorName>spring</generatorName>
84+
</configuration>
85+
</execution>
86+
</executions>
87+
</plugin>
88+
</plugins>
89+
</build>
90+
</project>

0 commit comments

Comments
 (0)