Skip to content

Commit 680c24f

Browse files
committed
Merge branch 'dev' into feat/client-v1
2 parents eb037d8 + 7fe7105 commit 680c24f

File tree

15 files changed

+459
-19
lines changed

15 files changed

+459
-19
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ sketch
381381
## OpenAPI Generator ###
382382
/client/src/api/
383383
/gateway/src/main/java/de/tum/aet/devops25/api/generated/
384-
/concept-svc/src/main/java/generated/
385-
/user-svc/src/main/java/generated/
384+
/concept-svc/src/main/java/de/tum/aet/devops25/api/generated/
385+
/user-svc/src/main/java/de/tum/aet/devops25/api/generated/
386386
/genai-svc/client/
387387

388388
# OpenAPI Generator CLI configuration

README.md

Lines changed: 64 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ The project is split into several main directories:
8585

8686
- `/api`: OpenAPI specifications (single source of truth)
8787
- `/client`: Angular 19 frontend
88-
- `/server`: Spring Boot microservices (API Gateway)
88+
- `/gateway`: API Gateway (Spring Boot)
8989
- `/user-svc`: User Service (Spring Boot)
9090
- `/concept-svc`: Concept Service (Spring Boot)
9191
- `/genai-svc`: GenAI Service (Python/Flask/LangChain)
@@ -166,36 +166,73 @@ cd team-git-push-force
166166
npm install
167167
```
168168

169-
### Server Setup
169+
### Backend Services Setup
170170

171-
1. Navigate to the `server` directory:
171+
1. Generate code from OpenAPI specifications:
172172
```bash
173-
cd server
173+
./api/scripts/gen-all.sh
174174
```
175-
2. Build the project:
175+
176+
2. Navigate to each service directory and build the project:
176177
```bash
178+
# For Gateway
179+
cd gateway
180+
./gradlew build
181+
182+
# For User Service
183+
cd ../user-svc
177184
./gradlew build
185+
186+
# For Concept Service
187+
cd ../concept-svc
188+
./gradlew build
189+
190+
# For GenAI Service
191+
cd ../genai-svc
192+
pip install -r requirements.txt
178193
```
179194

180195
## Running the Application
181196

182197
### Option 1: Using Docker Compose (Recommended)
183198

184-
The easiest way to run the entire application is using Docker Compose:
199+
Before running the application, you need to generate code from the OpenAPI specifications. You can use the provided start-dev script which handles this automatically:
200+
201+
```bash
202+
./start-dev.sh
203+
```
204+
205+
This script will:
206+
1. Run code generation from OpenAPI specs
207+
2. Start all services using Docker Compose
208+
209+
Alternatively, you can run these steps manually:
185210

186211
```bash
212+
# First, generate code from OpenAPI specs
213+
./api/scripts/gen-all.sh
214+
215+
# Then start Docker Compose
187216
docker-compose up
188217
```
189218

190219
This will start all services:
191220
- Client (Angular frontend) at [http://localhost:3000](http://localhost:3000)
192-
- Server (API Gateway) at [http://localhost:8080](http://localhost:8080)
221+
- API Gateway at [http://localhost:8080](http://localhost:8080)
193222
- User Service at [http://localhost:8081](http://localhost:8081)
194223
- Concept Service at [http://localhost:8082](http://localhost:8082)
195-
- GenAI Service at [http://localhost:8083](http://localhost:5000)
224+
- GenAI Service at [http://localhost:8083](http://localhost:8083)
196225

197226
### Option 2: Manual Startup
198227

228+
Before starting the services manually, you need to generate code from the OpenAPI specifications:
229+
230+
```bash
231+
./api/scripts/gen-all.sh
232+
```
233+
234+
This will generate the necessary code for all services based on the OpenAPI specifications in the `/api` directory.
235+
199236
#### Start the Client
200237

201238
```bash
@@ -204,13 +241,29 @@ npm run dev
204241
```
205242
The client will be available at [http://localhost:3000](http://localhost:3000).
206243

207-
#### Start the Server
244+
#### Start the Gateway
245+
246+
```bash
247+
cd gateway
248+
./gradlew bootRun
249+
```
250+
The API Gateway will be available at [http://localhost:8080](http://localhost:8080).
251+
252+
#### Start the User Service
253+
254+
```bash
255+
cd user-svc
256+
./gradlew bootRun
257+
```
258+
The User Service will be available at [http://localhost:8081](http://localhost:8081).
259+
260+
#### Start the Concept Service
208261

209262
```bash
210-
cd server
263+
cd concept-svc
211264
./gradlew bootRun
212265
```
213-
The server API will be available at [http://localhost:8080](http://localhost:8080).
266+
The Concept Service will be available at [http://localhost:8082](http://localhost:8082).
214267

215268
#### Start the GenAI Service
216269

api/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ We follow an API-first approach to development:
2525

2626
## Usage
2727

28+
### Installation
29+
30+
Install the required tools for linting and code generation:
31+
32+
```bash
33+
# Install Redocly CLI for linting OpenAPI specs
34+
npm install -g @redocly/cli@latest
35+
36+
# Install OpenAPI Generator tools
37+
npm install -g @openapitools/openapi-generator-cli
38+
pip install openapi-python-client
39+
```
40+
2841
### Linting OpenAPI Specs
2942

3043
```bash
@@ -42,6 +55,38 @@ This will generate:
4255
- Python client for the GenAI service
4356
- TypeScript SDK for the web client
4457

58+
#### Generated Code Locations
59+
60+
The code generation script places files in the following locations:
61+
62+
- **Java (Spring Boot)**:
63+
- Gateway: `gateway/src/main/java/de/tum/aet/devops25/api/generated/`
64+
- User Service: `user-svc/src/main/java/de/tum/aet/devops25/api/generated/`
65+
- Concept Service: `concept-svc/src/main/java/de/tum/aet/devops25/api/generated/`
66+
67+
- **Python Client**:
68+
- GenAI Service: `genai-svc/client/`
69+
70+
- **TypeScript SDK**:
71+
- Web Client: `client/src/api/generated.ts`
72+
73+
#### Code Generation Options
74+
75+
The script supports generating code for specific languages:
76+
77+
```bash
78+
# Generate only Java code
79+
./api/scripts/gen-all.sh java
80+
81+
# Generate only Python client
82+
./api/scripts/gen-all.sh python
83+
84+
# Generate only TypeScript SDK
85+
./api/scripts/gen-all.sh typescript
86+
```
87+
88+
Running the script without arguments generates code for all languages.
89+
4590
## Versioning
4691

4792
All APIs are versioned in the URL path (e.g., `/api/v1/resource`). When making breaking changes:

api/scripts/gen-all.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ generate_java() {
2828
echo "Generating Java code..."
2929
check_command openapi-generator-cli
3030

31-
# Create output directories
32-
create_dir "user-svc/src/main/java/generated"
33-
create_dir "concept-svc/src/main/java/generated"
34-
3531
# Generate code for API Gateway
3632
openapi-generator-cli generate \
3733
-i api/gateway.yaml \
@@ -46,7 +42,7 @@ generate_java() {
4642
openapi-generator-cli generate \
4743
-i api/user-service.yaml \
4844
-g spring \
49-
-o user-svc/src/main/java/generated \
45+
-o user-svc \
5046
--skip-validate-spec \
5147
--api-package de.tum.aet.devops25.api.generated.controller \
5248
--model-package de.tum.aet.devops25.api.generated.model \
@@ -56,7 +52,7 @@ generate_java() {
5652
openapi-generator-cli generate \
5753
-i api/concept-service.yaml \
5854
-g spring \
59-
-o concept-svc/src/main/java/generated \
55+
-o concept-svc \
6056
--skip-validate-spec \
6157
--api-package de.tum.aet.devops25.api.generated.controller \
6258
--model-package de.tum.aet.devops25.api.generated.model \
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
README.md
2+
pom.xml
3+
src/main/java/de/tum/aet/devops25/api/generated/controller/ApiUtil.java
4+
src/main/java/de/tum/aet/devops25/api/generated/controller/ConceptsApi.java
5+
src/main/java/de/tum/aet/devops25/api/generated/controller/HealthApi.java
6+
src/main/java/de/tum/aet/devops25/api/generated/model/AgendaItem.java
7+
src/main/java/de/tum/aet/devops25/api/generated/model/ApplyConceptSuggestionRequest.java
8+
src/main/java/de/tum/aet/devops25/api/generated/model/ApplyConceptSuggestionRequestSuggestion.java
9+
src/main/java/de/tum/aet/devops25/api/generated/model/Concept.java
10+
src/main/java/de/tum/aet/devops25/api/generated/model/CreateConceptRequest.java
11+
src/main/java/de/tum/aet/devops25/api/generated/model/CreateConceptRequestInitialRequirements.java
12+
src/main/java/de/tum/aet/devops25/api/generated/model/ErrorResponse.java
13+
src/main/java/de/tum/aet/devops25/api/generated/model/EventDetails.java
14+
src/main/java/de/tum/aet/devops25/api/generated/model/GetConceptServiceHealth200Response.java
15+
src/main/java/de/tum/aet/devops25/api/generated/model/GetUserConcepts200Response.java
16+
src/main/java/de/tum/aet/devops25/api/generated/model/Pricing.java
17+
src/main/java/de/tum/aet/devops25/api/generated/model/Speaker.java
18+
src/main/java/de/tum/aet/devops25/api/generated/model/UpdateConceptRequest.java
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.14.0

concept-svc/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
# OpenAPI generated API stub
3+
4+
Spring Framework stub
5+
6+
7+
## Overview
8+
This code was generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
9+
By using the [OpenAPI-Spec](https://openapis.org), you can easily generate an API stub.
10+
This is an example of building API stub interfaces in Java using the Spring framework.
11+
12+
The stubs generated can be used in your existing Spring-MVC or Spring-Boot application to create controller endpoints
13+
by adding ```@Controller``` classes that implement the interface. Eg:
14+
```java
15+
@Controller
16+
public class PetController implements PetApi {
17+
// implement all PetApi methods
18+
}
19+
```
20+
21+
You can also use the interface to create [Spring-Cloud Feign clients](http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-feign-inheritance).Eg:
22+
```java
23+
@FeignClient(name="pet", url="http://petstore.swagger.io/v2")
24+
public interface PetClient extends PetApi {
25+
26+
}
27+
```

concept-svc/pom.xml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<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/maven-v4_0_0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>org.openapitools</groupId>
4+
<artifactId>openapi-spring</artifactId>
5+
<packaging>jar</packaging>
6+
<name>openapi-spring</name>
7+
<version>1.0.0</version>
8+
<properties>
9+
<java.version>17</java.version>
10+
<maven.compiler.source>${java.version}</maven.compiler.source>
11+
<maven.compiler.target>${java.version}</maven.compiler.target>
12+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13+
<springdoc.version>2.6.0</springdoc.version>
14+
<swagger-ui.version>5.17.14</swagger-ui.version>
15+
</properties>
16+
<parent>
17+
<groupId>org.springframework.boot</groupId>
18+
<artifactId>spring-boot-starter-parent</artifactId>
19+
<version>3.1.3</version>
20+
<relativePath/> <!-- lookup parent from repository -->
21+
</parent>
22+
23+
<repositories>
24+
<repository>
25+
<id>repository.spring.milestone</id>
26+
<name>Spring Milestone Repository</name>
27+
<url>https://repo.spring.io/milestone</url>
28+
</repository>
29+
</repositories>
30+
<pluginRepositories>
31+
<pluginRepository>
32+
<id>spring-milestones</id>
33+
<url>https://repo.spring.io/milestone</url>
34+
</pluginRepository>
35+
</pluginRepositories>
36+
37+
<build>
38+
<sourceDirectory>src/main/java</sourceDirectory>
39+
<plugins>
40+
<plugin>
41+
<groupId>org.apache.maven.plugins</groupId>
42+
<artifactId>maven-source-plugin</artifactId>
43+
<executions>
44+
<execution>
45+
<id>attach-sources</id>
46+
<goals>
47+
<goal>jar</goal>
48+
</goals>
49+
</execution>
50+
</executions>
51+
</plugin>
52+
</plugins>
53+
</build>
54+
<dependencies>
55+
<dependency>
56+
<groupId>org.springframework.boot</groupId>
57+
<artifactId>spring-boot-starter-web</artifactId>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.springframework.data</groupId>
61+
<artifactId>spring-data-commons</artifactId>
62+
</dependency>
63+
<!--SpringDoc dependencies -->
64+
<dependency>
65+
<groupId>org.springdoc</groupId>
66+
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
67+
<version>${springdoc.version}</version>
68+
</dependency>
69+
<!-- @Nullable annotation -->
70+
<dependency>
71+
<groupId>com.google.code.findbugs</groupId>
72+
<artifactId>jsr305</artifactId>
73+
<version>3.0.2</version>
74+
</dependency>
75+
<dependency>
76+
<groupId>com.fasterxml.jackson.dataformat</groupId>
77+
<artifactId>jackson-dataformat-yaml</artifactId>
78+
</dependency>
79+
<dependency>
80+
<groupId>com.fasterxml.jackson.datatype</groupId>
81+
<artifactId>jackson-datatype-jsr310</artifactId>
82+
</dependency>
83+
<dependency>
84+
<groupId>org.openapitools</groupId>
85+
<artifactId>jackson-databind-nullable</artifactId>
86+
<version>0.2.6</version>
87+
</dependency>
88+
<!-- Bean Validation API support -->
89+
<dependency>
90+
<groupId>org.springframework.boot</groupId>
91+
<artifactId>spring-boot-starter-validation</artifactId>
92+
</dependency>
93+
<dependency>
94+
<groupId>com.fasterxml.jackson.core</groupId>
95+
<artifactId>jackson-databind</artifactId>
96+
</dependency>
97+
<dependency>
98+
<groupId>org.springframework.boot</groupId>
99+
<artifactId>spring-boot-starter-test</artifactId>
100+
<scope>test</scope>
101+
</dependency>
102+
</dependencies>
103+
</project>

0 commit comments

Comments
 (0)