Skip to content

Commit

Permalink
#1 Host OpenAPI specification web page (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
vityaman authored Sep 19, 2024
1 parent 6f9e517 commit ea02a4f
Show file tree
Hide file tree
Showing 17 changed files with 432 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}
15 changes: 15 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion matchmaker/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<artifactId>matchmaker-api</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<packaging>jar</packaging>
<name>matchmaker-api</name>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
50 changes: 50 additions & 0 deletions matchmaker/app/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>ru.ifmo.se.dating</groupId>
<artifactId>matchmaker</artifactId>
<version>1.0.0</version>
</parent>

<artifactId>matchmaker-app</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>matchmaker-app</name>

<dependencies>
<dependency>
<groupId>ru.ifmo.se.dating</groupId>
<artifactId>matchmaker-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>ru.ifmo.se.dating.matchmaker.Main</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -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);
}
}
6 changes: 6 additions & 0 deletions matchmaker/app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
springdoc:
api-docs:
path: /openapi
swagger-ui:
url: /openapi/api.yml
path: /swagger-ui.html
2 changes: 2 additions & 0 deletions matchmaker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@

<modules>
<module>api</module>
<module>app</module>
<module>server</module>
</modules>
</project>
90 changes: 90 additions & 0 deletions matchmaker/server/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>ru.ifmo.se.dating</groupId>
<artifactId>matchmaker</artifactId>
<version>1.0.0</version>
</parent>

<artifactId>matchmaker-server</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>matchmaker-server</name>

<dependencies>
<dependency>
<groupId>ru.ifmo.se.dating</groupId>
<artifactId>matchmaker-api</artifactId>
</dependency>

<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<executions>
<execution>
<configuration>
<inputSpec>${project.basedir}/../api/src/main/resources/static/openapi/api.yml</inputSpec>
<generatorName>spring</generatorName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion people/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<artifactId>people-api</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<packaging>jar</packaging>
<name>people-api</name>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
50 changes: 50 additions & 0 deletions people/app/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>ru.ifmo.se.dating</groupId>
<artifactId>people</artifactId>
<version>1.0.0</version>
</parent>

<artifactId>people-app</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>people-app</name>

<dependencies>
<dependency>
<groupId>ru.ifmo.se.dating</groupId>
<artifactId>people-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>ru.ifmo.se.dating.people.Main</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
11 changes: 11 additions & 0 deletions people/app/src/main/java/ru/ifmo/se/dating/people/Main.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
6 changes: 6 additions & 0 deletions people/app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
springdoc:
api-docs:
path: /openapi
swagger-ui:
url: /openapi/api.yml
path: /swagger-ui.html
2 changes: 2 additions & 0 deletions people/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@

<modules>
<module>api</module>
<module>app</module>
<module>server</module>
</modules>
</project>
90 changes: 90 additions & 0 deletions people/server/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>ru.ifmo.se.dating</groupId>
<artifactId>people</artifactId>
<version>1.0.0</version>
</parent>

<artifactId>people-server</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>people-server</name>

<dependencies>
<dependency>
<groupId>ru.ifmo.se.dating</groupId>
<artifactId>people-api</artifactId>
</dependency>

<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<executions>
<execution>
<configuration>
<inputSpec>${project.basedir}/../api/src/main/resources/static/openapi/api.yml</inputSpec>
<generatorName>spring</generatorName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit ea02a4f

Please sign in to comment.