From ea02a4f16f082497378fd78725b69065534f5e85 Mon Sep 17 00:00:00 2001 From: Victor Smirnov <53015676+vityaman@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:03:09 +0300 Subject: [PATCH] #1 Host OpenAPI specification web page (#4) --- .vscode/settings.json | 3 + compose.yml | 15 +++ matchmaker/api/pom.xml | 2 +- .../main/resources/static/openapi}/api.yml | 2 +- matchmaker/app/pom.xml | 50 ++++++++++ .../ru/ifmo/se/dating/matchmaker/Main.java | 11 +++ .../app/src/main/resources/application.yml | 6 ++ matchmaker/pom.xml | 2 + matchmaker/server/pom.xml | 90 ++++++++++++++++++ people/api/pom.xml | 2 +- .../main/resources/static/openapi}/api.yml | 2 +- people/app/pom.xml | 50 ++++++++++ .../java/ru/ifmo/se/dating/people/Main.java | 11 +++ people/app/src/main/resources/application.yml | 6 ++ people/pom.xml | 2 + people/server/pom.xml | 90 ++++++++++++++++++ pom.xml | 94 ++++++++++++++++++- 17 files changed, 432 insertions(+), 6 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 compose.yml rename {people/api/src/main/resources => matchmaker/api/src/main/resources/static/openapi}/api.yml (96%) create mode 100644 matchmaker/app/pom.xml create mode 100644 matchmaker/app/src/main/java/ru/ifmo/se/dating/matchmaker/Main.java create mode 100644 matchmaker/app/src/main/resources/application.yml create mode 100644 matchmaker/server/pom.xml rename {matchmaker/api/src/main/resources => people/api/src/main/resources/static/openapi}/api.yml (96%) create mode 100644 people/app/pom.xml create mode 100644 people/app/src/main/java/ru/ifmo/se/dating/people/Main.java create mode 100644 people/app/src/main/resources/application.yml create mode 100644 people/server/pom.xml diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..e0f15db2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.configuration.updateBuildConfiguration": "automatic" +} \ No newline at end of file diff --git a/compose.yml b/compose.yml new file mode 100644 index 00000000..3527e24f --- /dev/null +++ b/compose.yml @@ -0,0 +1,15 @@ +services: + matchmaker: + image: eclipse-temurin:17-jdk-alpine + volumes: + - ./matchmaker/app/target/matchmaker-app-1.0.0.jar:/matchmaker.jar + command: java -jar /matchmaker.jar + ports: + - 8080:8080 + people: + image: eclipse-temurin:17-jdk-alpine + volumes: + - ./people/app/target/people-app-1.0.0.jar:/people.jar + command: java -jar /people.jar + ports: + - 8081:8080 diff --git a/matchmaker/api/pom.xml b/matchmaker/api/pom.xml index 43438755..73b4557d 100644 --- a/matchmaker/api/pom.xml +++ b/matchmaker/api/pom.xml @@ -11,7 +11,7 @@ matchmaker-api 1.0.0 - pom + jar matchmaker-api diff --git a/people/api/src/main/resources/api.yml b/matchmaker/api/src/main/resources/static/openapi/api.yml similarity index 96% rename from people/api/src/main/resources/api.yml rename to matchmaker/api/src/main/resources/static/openapi/api.yml index 9affe3ae..aaa5b955 100644 --- a/people/api/src/main/resources/api.yml +++ b/matchmaker/api/src/main/resources/static/openapi/api.yml @@ -2,7 +2,7 @@ swagger: "2.0" info: version: "1.0.0" - title: "Swagger Petstore" + title: "Swagger Petstore: Matchmaker" description: "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification" termsOfService: "http://swagger.io/terms/" contact: diff --git a/matchmaker/app/pom.xml b/matchmaker/app/pom.xml new file mode 100644 index 00000000..e3ffcfc9 --- /dev/null +++ b/matchmaker/app/pom.xml @@ -0,0 +1,50 @@ + + 4.0.0 + + + ru.ifmo.se.dating + matchmaker + 1.0.0 + + + matchmaker-app + 1.0.0 + jar + matchmaker-app + + + + ru.ifmo.se.dating + matchmaker-server + + + org.springframework.boot + spring-boot-starter-web + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + ru.ifmo.se.dating.matchmaker.Main + + + + + repackage + + + + + + + diff --git a/matchmaker/app/src/main/java/ru/ifmo/se/dating/matchmaker/Main.java b/matchmaker/app/src/main/java/ru/ifmo/se/dating/matchmaker/Main.java new file mode 100644 index 00000000..6845364d --- /dev/null +++ b/matchmaker/app/src/main/java/ru/ifmo/se/dating/matchmaker/Main.java @@ -0,0 +1,11 @@ +package ru.ifmo.se.dating.matchmaker; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.SpringApplication; + +@SpringBootApplication +public class Main { + public static void main(String[] args) { + SpringApplication.run(Main.class, args); + } +} diff --git a/matchmaker/app/src/main/resources/application.yml b/matchmaker/app/src/main/resources/application.yml new file mode 100644 index 00000000..9ec99f3b --- /dev/null +++ b/matchmaker/app/src/main/resources/application.yml @@ -0,0 +1,6 @@ +springdoc: + api-docs: + path: /openapi + swagger-ui: + url: /openapi/api.yml + path: /swagger-ui.html diff --git a/matchmaker/pom.xml b/matchmaker/pom.xml index 99a4709f..ec5ca8d8 100644 --- a/matchmaker/pom.xml +++ b/matchmaker/pom.xml @@ -16,5 +16,7 @@ api + app + server diff --git a/matchmaker/server/pom.xml b/matchmaker/server/pom.xml new file mode 100644 index 00000000..cb35c76e --- /dev/null +++ b/matchmaker/server/pom.xml @@ -0,0 +1,90 @@ + + 4.0.0 + + + ru.ifmo.se.dating + matchmaker + 1.0.0 + + + matchmaker-server + 1.0.0 + jar + matchmaker-server + + + + ru.ifmo.se.dating + matchmaker-api + + + + io.swagger.core.v3 + swagger-annotations + + + io.swagger.core.v3 + swagger-models + + + org.openapitools + jackson-databind-nullable + + + + org.springframework + spring-web + + + org.springframework + spring-context + + + org.springframework.boot + spring-boot + + + org.springframework.boot + spring-boot-starter-web + + + + javax.validation + validation-api + + + javax.servlet + javax.servlet-api + provided + + + javax.annotation + javax.annotation-api + 1.3.2 + + + + com.fasterxml.jackson.core + jackson-databind + + + + + + + org.openapitools + openapi-generator-maven-plugin + + + + ${project.basedir}/../api/src/main/resources/static/openapi/api.yml + spring + + + + + + + diff --git a/people/api/pom.xml b/people/api/pom.xml index c86d5b75..c7ffe838 100644 --- a/people/api/pom.xml +++ b/people/api/pom.xml @@ -11,7 +11,7 @@ people-api 1.0.0 - pom + jar people-api diff --git a/matchmaker/api/src/main/resources/api.yml b/people/api/src/main/resources/static/openapi/api.yml similarity index 96% rename from matchmaker/api/src/main/resources/api.yml rename to people/api/src/main/resources/static/openapi/api.yml index 9affe3ae..c5aaf3c3 100644 --- a/matchmaker/api/src/main/resources/api.yml +++ b/people/api/src/main/resources/static/openapi/api.yml @@ -2,7 +2,7 @@ swagger: "2.0" info: version: "1.0.0" - title: "Swagger Petstore" + title: "Swagger Petstore: People" description: "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification" termsOfService: "http://swagger.io/terms/" contact: diff --git a/people/app/pom.xml b/people/app/pom.xml new file mode 100644 index 00000000..6a3733d1 --- /dev/null +++ b/people/app/pom.xml @@ -0,0 +1,50 @@ + + 4.0.0 + + + ru.ifmo.se.dating + people + 1.0.0 + + + people-app + 1.0.0 + jar + people-app + + + + ru.ifmo.se.dating + people-server + + + org.springframework.boot + spring-boot-starter-web + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + ru.ifmo.se.dating.people.Main + + + + + repackage + + + + + + + diff --git a/people/app/src/main/java/ru/ifmo/se/dating/people/Main.java b/people/app/src/main/java/ru/ifmo/se/dating/people/Main.java new file mode 100644 index 00000000..ac8bb102 --- /dev/null +++ b/people/app/src/main/java/ru/ifmo/se/dating/people/Main.java @@ -0,0 +1,11 @@ +package ru.ifmo.se.dating.people; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.SpringApplication; + +@SpringBootApplication +public class Main { + public static void main(String[] args) { + SpringApplication.run(Main.class, args); + } +} diff --git a/people/app/src/main/resources/application.yml b/people/app/src/main/resources/application.yml new file mode 100644 index 00000000..9ec99f3b --- /dev/null +++ b/people/app/src/main/resources/application.yml @@ -0,0 +1,6 @@ +springdoc: + api-docs: + path: /openapi + swagger-ui: + url: /openapi/api.yml + path: /swagger-ui.html diff --git a/people/pom.xml b/people/pom.xml index fddac7dc..651b6e43 100644 --- a/people/pom.xml +++ b/people/pom.xml @@ -16,5 +16,7 @@ api + app + server diff --git a/people/server/pom.xml b/people/server/pom.xml new file mode 100644 index 00000000..df1474e1 --- /dev/null +++ b/people/server/pom.xml @@ -0,0 +1,90 @@ + + 4.0.0 + + + ru.ifmo.se.dating + people + 1.0.0 + + + people-server + 1.0.0 + jar + people-server + + + + ru.ifmo.se.dating + people-api + + + + io.swagger.core.v3 + swagger-annotations + + + io.swagger.core.v3 + swagger-models + + + org.openapitools + jackson-databind-nullable + + + + org.springframework + spring-web + + + org.springframework + spring-context + + + org.springframework.boot + spring-boot + + + org.springframework.boot + spring-boot-starter-web + + + + javax.validation + validation-api + + + javax.servlet + javax.servlet-api + provided + + + javax.annotation + javax.annotation-api + 1.3.2 + + + + com.fasterxml.jackson.core + jackson-databind + + + + + + + org.openapitools + openapi-generator-maven-plugin + + + + ${project.basedir}/../api/src/main/resources/static/openapi/api.yml + spring + + + + + + + diff --git a/pom.xml b/pom.xml index f44dcd1e..7b0f5bfe 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,92 @@ + + ru.ifmo.se.dating + matchmaker-api + 1.0.0 + + + ru.ifmo.se.dating + matchmaker-server + 1.0.0 + + + + ru.ifmo.se.dating + people-api + 1.0.0 + + + ru.ifmo.se.dating + people-server + 1.0.0 + + + + org.springframework.boot + spring-boot-starter-web + 3.3.3 + + + org.springframework + spring-web + 6.1.13 + + + org.springframework + spring-context + 6.1.13 + + + org.springframework.boot + spring-boot + 3.3.3 + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.6.0 + + + + io.swagger.core.v3 + swagger-annotations + 2.2.23 + + + io.swagger.core.v3 + swagger-models + 2.2.23 + + + org.openapitools + jackson-databind-nullable + 0.2.6 + + + + javax.validation + validation-api + 2.0.1.Final + + + javax.servlet + javax.servlet-api + 4.0.1 + + + javax.annotation + javax.annotation-api + 1.3.2 + + + + com.fasterxml.jackson.core + jackson-databind + 2.17.2 + + @@ -30,7 +116,6 @@ org.apache.maven.plugins maven-compiler-plugin - 3.11.0 org.apache.maven.plugins @@ -83,6 +168,11 @@ + + org.springframework.boot + spring-boot-maven-plugin + + org.openapitools openapi-generator-maven-plugin @@ -93,7 +183,7 @@ generate - ${project.basedir}/src/main/resources/api.yml + ${project.basedir}/src/main/resources/static/openapi/api.yml src/java/main