Skip to content

Commit 6f9e517

Browse files
authored
#1 Add example OpenAPI specifications (#3)
1 parent d56f5ed commit 6f9e517

File tree

9 files changed

+341
-0
lines changed

9 files changed

+341
-0
lines changed

.github/workflows/maven.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Maven
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- lab-[1234]
8+
pull_request:
9+
branches:
10+
- main
11+
- lab-[1234]
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Setup up JDK 17
20+
uses: actions/setup-java@v3
21+
with:
22+
java-version: '17'
23+
distribution: 'temurin'
24+
cache: maven
25+
26+
- name: Compile
27+
run: mvn compile
28+
29+
- name: Unit Test
30+
run: mvn test
31+
32+
- name: Package
33+
run: mvn package

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@
2222
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2323
hs_err_pid*
2424
replay_pid*
25+
26+
# Maven
27+
target/

matchmaker/api/pom.xml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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-api</artifactId>
13+
<version>1.0.0</version>
14+
<packaging>pom</packaging>
15+
<name>matchmaker-api</name>
16+
17+
<build>
18+
<plugins>
19+
<plugin>
20+
<groupId>org.openapitools</groupId>
21+
<artifactId>openapi-generator-maven-plugin</artifactId>
22+
<executions>
23+
<execution>
24+
<configuration>
25+
<dryRun>true</dryRun>
26+
<generatorName>java</generatorName>
27+
</configuration>
28+
</execution>
29+
</executions>
30+
</plugin>
31+
</plugins>
32+
</build>
33+
</project>
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
swagger: "2.0"
3+
info:
4+
version: "1.0.0"
5+
title: "Swagger Petstore"
6+
description: "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification"
7+
termsOfService: "http://swagger.io/terms/"
8+
contact:
9+
name: "Swagger API Team"
10+
license:
11+
name: "MIT"
12+
host: "petstore.swagger.io"
13+
basePath: "/api"
14+
schemes:
15+
- "http"
16+
consumes:
17+
- "application/json"
18+
produces:
19+
- "application/json"
20+
paths:
21+
/pets:
22+
get:
23+
description: "Returns all pets from the system that the user has access to"
24+
produces:
25+
- "application/json"
26+
responses:
27+
"200":
28+
description: "A list of pets."
29+
schema:
30+
type: "array"
31+
items:
32+
$ref: "#/definitions/Pet"
33+
definitions:
34+
Pet:
35+
type: "object"
36+
required:
37+
- "id"
38+
- "name"
39+
properties:
40+
id:
41+
type: "integer"
42+
format: "int64"
43+
name:
44+
type: "string"
45+
tag:
46+
type: "string"

matchmaker/pom.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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>itmo-dating</artifactId>
9+
<version>1.0.0</version>
10+
</parent>
11+
12+
<artifactId>matchmaker</artifactId>
13+
<version>1.0.0</version>
14+
<packaging>pom</packaging>
15+
<name>matchmaker</name>
16+
17+
<modules>
18+
<module>api</module>
19+
</modules>
20+
</project>

people/api/pom.xml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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-api</artifactId>
13+
<version>1.0.0</version>
14+
<packaging>pom</packaging>
15+
<name>people-api</name>
16+
17+
<build>
18+
<plugins>
19+
<plugin>
20+
<groupId>org.openapitools</groupId>
21+
<artifactId>openapi-generator-maven-plugin</artifactId>
22+
<executions>
23+
<execution>
24+
<configuration>
25+
<dryRun>true</dryRun>
26+
<generatorName>java</generatorName>
27+
</configuration>
28+
</execution>
29+
</executions>
30+
</plugin>
31+
</plugins>
32+
</build>
33+
</project>

people/api/src/main/resources/api.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
swagger: "2.0"
3+
info:
4+
version: "1.0.0"
5+
title: "Swagger Petstore"
6+
description: "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification"
7+
termsOfService: "http://swagger.io/terms/"
8+
contact:
9+
name: "Swagger API Team"
10+
license:
11+
name: "MIT"
12+
host: "petstore.swagger.io"
13+
basePath: "/api"
14+
schemes:
15+
- "http"
16+
consumes:
17+
- "application/json"
18+
produces:
19+
- "application/json"
20+
paths:
21+
/pets:
22+
get:
23+
description: "Returns all pets from the system that the user has access to"
24+
produces:
25+
- "application/json"
26+
responses:
27+
"200":
28+
description: "A list of pets."
29+
schema:
30+
type: "array"
31+
items:
32+
$ref: "#/definitions/Pet"
33+
definitions:
34+
Pet:
35+
type: "object"
36+
required:
37+
- "id"
38+
- "name"
39+
properties:
40+
id:
41+
type: "integer"
42+
format: "int64"
43+
name:
44+
type: "string"
45+
tag:
46+
type: "string"

people/pom.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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>itmo-dating</artifactId>
9+
<version>1.0.0</version>
10+
</parent>
11+
12+
<artifactId>people</artifactId>
13+
<version>1.0.0</version>
14+
<packaging>pom</packaging>
15+
<name>people</name>
16+
17+
<modules>
18+
<module>api</module>
19+
</modules>
20+
</project>

pom.xml

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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+
<groupId>ru.ifmo.se.dating</groupId>
7+
<artifactId>itmo-dating</artifactId>
8+
<version>1.0.0</version>
9+
<packaging>pom</packaging>
10+
11+
<name>itmo-dating</name>
12+
13+
<modules>
14+
<module>matchmaker</module>
15+
<module>people</module>
16+
</modules>
17+
18+
<properties>
19+
<maven.compiler.release>17</maven.compiler.release>
20+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
21+
</properties>
22+
23+
<dependencyManagement>
24+
<dependencies>
25+
</dependencies>
26+
</dependencyManagement>
27+
28+
<build>
29+
<plugins>
30+
<plugin>
31+
<groupId>org.apache.maven.plugins</groupId>
32+
<artifactId>maven-compiler-plugin</artifactId>
33+
<version>3.11.0</version>
34+
</plugin>
35+
<plugin>
36+
<groupId>org.apache.maven.plugins</groupId>
37+
<artifactId>maven-surefire-plugin</artifactId>
38+
</plugin>
39+
<plugin>
40+
<groupId>org.apache.maven.plugins</groupId>
41+
<artifactId>maven-failsafe-plugin</artifactId>
42+
</plugin>
43+
</plugins>
44+
45+
<pluginManagement>
46+
<plugins>
47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-compiler-plugin</artifactId>
50+
<version>3.10.1</version>
51+
</plugin>
52+
53+
<plugin>
54+
<groupId>org.apache.maven.plugins</groupId>
55+
<artifactId>maven-surefire-plugin</artifactId>
56+
<version>2.12.4</version>
57+
<configuration>
58+
<parallel>methods</parallel>
59+
<threadCount>10</threadCount>
60+
</configuration>
61+
</plugin>
62+
63+
<plugin>
64+
<groupId>org.apache.maven.plugins</groupId>
65+
<artifactId>maven-failsafe-plugin</artifactId>
66+
<version>2.22.1</version>
67+
<executions>
68+
<execution>
69+
<goals>
70+
<goal>integration-test</goal>
71+
<goal>verify</goal>
72+
</goals>
73+
</execution>
74+
</executions>
75+
</plugin>
76+
77+
<plugin>
78+
<groupId>org.apache.maven.plugins</groupId>
79+
<artifactId>maven-war-plugin</artifactId>
80+
<version>3.3.2</version>
81+
<configuration>
82+
<failOnMissingWebXml>false</failOnMissingWebXml>
83+
</configuration>
84+
</plugin>
85+
86+
<plugin>
87+
<groupId>org.openapitools</groupId>
88+
<artifactId>openapi-generator-maven-plugin</artifactId>
89+
<version>7.8.0</version>
90+
<executions>
91+
<execution>
92+
<goals>
93+
<goal>generate</goal>
94+
</goals>
95+
<configuration>
96+
<inputSpec>${project.basedir}/src/main/resources/api.yml</inputSpec>
97+
<configOptions>
98+
<sourceFolder>src/java/main</sourceFolder>
99+
</configOptions>
100+
</configuration>
101+
</execution>
102+
</executions>
103+
</plugin>
104+
</plugins>
105+
</pluginManagement>
106+
</build>
107+
</project>

0 commit comments

Comments
 (0)